MiniProgramShortUrlService.java
1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package cn.com.glsx.entmicro.service;
import cn.com.glsx.entmicro.convert.ConvertRequest;
import cn.com.glsx.entmicro.model.request.shorturl.MiniProShortUrlRpcRequest;
import cn.com.glsx.entmicro.remote.MiniProgramShortUrlRemote;
import cn.com.glsx.entmicro.request.shorturl.MiniProShortUrlConfigRopRequest;
import cn.com.glsx.entmicro.request.shorturl.MiniProShortUrlRopRequest;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @Description
* @author chizw
* @create 2022/10/12 17:14
* @version ver.1.0.0
*/
@Service
@Slf4j
public class MiniProgramShortUrlService {
@Resource
private MiniProgramShortUrlRemote miniProgramShortUrlRemote;
public String getShortUrlConfigUuid(MiniProShortUrlConfigRopRequest request) {
MiniProShortUrlRpcRequest rpcRequest = ConvertRequest.convertRequest(request, new MiniProShortUrlRpcRequest());
RpcResponse<String> response = miniProgramShortUrlRemote.getShortUrlConfigUuid(rpcRequest);
if (response.isSuccess()) {
return response.getResult();
}
throw new RpcServiceException(response.getException().getErrId(), response.getMessage());
}
public String getShortUrlByUuid(MiniProShortUrlRopRequest request) {
RpcResponse<String> response = miniProgramShortUrlRemote.getShortUrlByUuid(request.getMiniproUuid());
if (response.isSuccess()) {
return response.getResult();
}
throw new RpcServiceException(response.getException().getErrId(), response.getMessage());
}
}