OpenController.java
7.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
package cn.com.glsx.merchants.controller;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.merchants.request.merchant.MerchantSaveOpenRequest;
import cn.com.glsx.merchants.request.merchant.MerchantSaveRequest;
import cn.com.glsx.merchants.request.merchant.OpenMerchantPageRequest;
import cn.com.glsx.merchants.request.merchant.OpenMerchantRequest;
import cn.com.glsx.merchants.request.user.OpenUserRequest;
import cn.com.glsx.merchants.response.AccountTypeTreeRopResponse;
import cn.com.glsx.merchants.response.MerchantRopResponse;
import cn.com.glsx.merchants.response.OpenUserResponse;
import cn.com.glsx.merchants.service.OpenService;
import cn.com.glsx.merchants.util.Pagination;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* @author zhouhaibao
* @version 1.0
* @description: TODO
* @date 2021/9/17 9:41
*/
@Slf4j
@Api("对外开发接口")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.NO)
public class OpenController {
@Autowired
private OpenService openService;
@ServiceMethod(method = "cn.com.glsx.merchants.open.findMerchantDetailByMerchantNo", needInSession = NeedInSessionType.NO)
@ApiOperation("根据商户号查询商户详情")
public RopResponse<MerchantRopResponse> findMerchantDetailByMerchantNo(OpenMerchantRequest openMerchantRequest) {
try {
MerchantRopResponse merchantRopResponse = openService.findMerchantDetailByMerchantNo(openMerchantRequest);
return RopResponse.success(merchantRopResponse);
} catch (RpcServiceException e) {
log.info("=======OpenController__invoke__findMerchantDetailByMerchantNo__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "cn.com.glsx.merchants.open.findSuperlativeMerchant", needInSession = NeedInSessionType.NO)
@ApiOperation("根据商户号最上级工厂商户号")
public RopResponse<Integer> findSuperlativeMerchant(OpenMerchantRequest openMerchantRequest) {
try {
Integer superlativeMerchant = openService.findSuperlativeMerchant(openMerchantRequest);
return RopResponse.success(superlativeMerchant);
} catch (RpcServiceException e) {
log.info("=======OpenController__invoke__findSuperlativeMerchant__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "cn.com.glsx.merchants.open.findSuperiorList", needInSession = NeedInSessionType.NO)
@ApiOperation("根据商户查询商户上级列表")
public RopResponse<List<MerchantRopResponse>> findSuperiorList(OpenMerchantRequest openMerchantRequest) {
try {
List<MerchantRopResponse> superiorList = openService.findSuperiorList(openMerchantRequest);
return RopResponse.success(superiorList);
} catch (RpcServiceException e) {
log.info("=======OpenController__invoke__findSuperiorList__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "cn.com.glsx.merchants.open.findMerchantList", needInSession = NeedInSessionType.NO)
@ApiOperation("根据商户名称和渠道类型查询商户列表")
public RopResponse<List<MerchantRopResponse>> findMerchantList(OpenMerchantRequest openMerchantRequest) {
try {
List<MerchantRopResponse> superiorList = openService.findMerchantList(openMerchantRequest);
return RopResponse.success(superiorList);
} catch (RpcServiceException e) {
log.info("=======OpenController__invoke__findSuperiorList__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "cn.com.glsx.merchants.open.findSubordinateListByPage", needInSession = NeedInSessionType.NO)
@ApiOperation("根据商户查询商户下级列表")
public RopResponse<Pagination<MerchantRopResponse>> findSubordinateListByPage(OpenMerchantPageRequest openMerchantRequest) {
try {
Pagination<MerchantRopResponse> subordinateListByPage = openService.findSubordinateListByPage(openMerchantRequest);
return RopResponse.success(subordinateListByPage);
} catch (RpcServiceException e) {
log.info("=======OpenController__invoke__findSubordinateListByPage__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "cn.com.glsx.merchants.open.checkBussinessAccount", needInSession = NeedInSessionType.NO)
@ApiOperation("用户登录校验")
public RopResponse<OpenUserResponse> checkBussinessAccount(OpenUserRequest openUserRequest) {
try {
OpenUserResponse openUserResponse = openService.checkBussinessAccount(openUserRequest);
return RopResponse.success(openUserResponse);
} catch (RpcServiceException e) {
log.info("=======OpenController__invoke__checkBussinessAccount__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "cn.com.glsx.merchants.open.findDataPermission", needInSession = NeedInSessionType.NO)
@ApiOperation("用户数据权限获取")
public RopResponse<List<Integer>> findDataPermission(OpenUserRequest openUserRequest) {
try {
List<Integer> dataPermission = openService.findDataPermission(openUserRequest);
return RopResponse.success(dataPermission);
} catch (RpcServiceException e) {
log.info("=======OpenController__invoke__findDataPermission__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "cn.com.glsx.merchants.open.findMenuFunPermission", needInSession = NeedInSessionType.NO)
@ApiOperation("用户菜单权限获取")
public RopResponse<List<AccountTypeTreeRopResponse>> findMenuFunPermission(OpenUserRequest openUserRequest) {
try {
List<AccountTypeTreeRopResponse> menuFunPermission = openService.findMenuFunPermission(openUserRequest);
return RopResponse.success(menuFunPermission);
} catch (RpcServiceException e) {
log.info("=======OpenController__invoke__findMenuFunPermission__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
/**
* 保存商户信息接口(对外)
*
* @param merchantSaveRequest 入参
* @return
*/
@ServiceMethod(method = "cn.com.glsx.merchants.open.saveMerchant", needInSession = NeedInSessionType.NO)
@ApiOperation("保存商户信息接口(对外)")
public RopResponse<Integer> saveMerchant(MerchantSaveOpenRequest merchantSaveRequest) {
try {
Integer merchant = openService.saveMerchant(merchantSaveRequest);
return RopResponse.success(merchant);
} catch (RpcServiceException e) {
log.info("=======OpenController__invoke__saveMerchant__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
}