CommonService.java
2.34 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package cn.com.glsx.dj.oaapproval.service;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.merchants.model.request.CreateMerchantWithPermissionsRequest;
import cn.com.glsx.merchants.model.request.QueryParentMerchantListRequest;
import cn.com.glsx.merchants.model.response.CreateMerchantWithPermissionsResponse;
import cn.com.glsx.merchants.model.response.ParentMerchantInfoResponse;
import cn.com.glsx.merchants.remote.MerchantWithPermissionsRemote;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author zhouhaibao
* @version 1.0
* @description: TODO
* @date 2021/9/17 9:52
*/
@Slf4j
@Service
public class CommonService {
@Autowired
private MerchantWithPermissionsRemote merchantWithPermissionsRemote;
/**
* 创建园区店商户并分配权限
*
* @param request 创建商户请求参数
* @return 创建结果
*/
public CreateMerchantWithPermissionsResponse createMerchantWithPermissions(CreateMerchantWithPermissionsRequest request) {
log.info("OpenService创建园区店商户并分配权限,商户名称:{}", request.getMerchantName());
RpcResponse<CreateMerchantWithPermissionsResponse> rpcResponse = merchantWithPermissionsRemote.createMerchantWithPermissions(request);
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getMessage());
}
/**
* 查询上级商户列表
*
* @param request 查询参数
* @return 上级商户列表
*/
public List<ParentMerchantInfoResponse> queryParentMerchantList(QueryParentMerchantListRequest request) {
log.info("OpenService查询上级商户列表,当前账户等级:{},商户类型:{}", request.getCurrentAccountLevel(), request.getMerchantType());
RpcResponse<List<ParentMerchantInfoResponse>> rpcResponse = merchantWithPermissionsRemote.queryParentMerchantList(request);
if (rpcResponse.isSuccess()) {
return rpcResponse.getResult();
}
throw new RpcServiceException(rpcResponse.getError(), rpcResponse.getException().getErrId(), rpcResponse.getMessage());
}
}