EntimicroStaffService.java
13.4 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
package cn.com.glsx.entmicro.service;
import cn.com.glsx.entmicro.convert.ConvertRequest;
import cn.com.glsx.entmicro.convert.ConvertResponse;
import cn.com.glsx.entmicro.model.request.EntmicroFollowerStaffRequest;
import cn.com.glsx.entmicro.model.request.EntmicroFollowerTypeRequest;
import cn.com.glsx.entmicro.model.request.EntmicroStaffRequest;
import cn.com.glsx.entmicro.model.request.LordCustomerGroupRequest;
import cn.com.glsx.entmicro.model.request.wechatcloudcontrol.login.WechatDepositRequest;
import cn.com.glsx.entmicro.model.response.EntmicroBusinessTypeResponse;
import cn.com.glsx.entmicro.model.response.EntmicroFollowerStaffResponse;
import cn.com.glsx.entmicro.model.response.EntmicroFollowerTypeResponse;
import cn.com.glsx.entmicro.model.response.EntmicroStaffResponse;
import cn.com.glsx.entmicro.model.response.wechatcloudcontrol.customer.CustomerInfoResponse;
import cn.com.glsx.entmicro.remote.EntmicroFollowerStaffRemote;
import cn.com.glsx.entmicro.remote.EntmicroFollowerTypeRemote;
import cn.com.glsx.entmicro.remote.EntmicroStaffRemote;
import cn.com.glsx.entmicro.request.staff.*;
import cn.com.glsx.entmicro.request.wechatcloudcontrol.login.CustomerListRopResquest;
import cn.com.glsx.entmicro.request.wechatcloudcontrol.login.WechatDepositRopRequest;
import cn.com.glsx.entmicro.response.staff.BusinessTypeResponse;
import cn.com.glsx.entmicro.response.staff.FollowerStaffResponse;
import cn.com.glsx.entmicro.response.staff.FollowerTypeResponse;
import cn.com.glsx.entmicro.response.staff.IsOutSiderStaffResponse;
import cn.com.glsx.entmicro.utils.Pagination;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import com.alibaba.fastjson.JSONArray;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author Lichongyuan
* @Description: 员工Service
* @date 2021/9/22 20:09
*/
@Service
@Slf4j
public class EntimicroStaffService {
@Autowired
private EntmicroFollowerStaffRemote entmicroFollowerStaffRemote;
@Autowired
private EntmicroStaffRemote entmicroStaffRemote;
@Autowired
private EntmicroFollowerTypeRemote entmicroFollowerTypeRemote;
/**
* 同步外部联系人权限员工
*/
public void syncEntmicroIsOutsiderStaff(SycIsOutsiderStaffRequest sycIsOutsiderStaffRequest) {
EntmicroStaffRequest entmicroStaffRequest = ConvertRequest.convertRequest(sycIsOutsiderStaffRequest, new EntmicroStaffRequest());
RpcResponse<Boolean> response = entmicroStaffRemote.syncEntmicroIsOutsiderStaff(entmicroStaffRequest);
if (response.isFailed()) {
throw new RpcServiceException(response.getException().getErrId(), response.getMessage());
}
}
/**
* 查询外部联系人权限员工
*
* @param selectIsOutsiderStaffRequest
* @return
*/
public List<IsOutSiderStaffResponse> listEntmicroStaff(SelectIsOutsiderStaffRequest selectIsOutsiderStaffRequest) {
//转化入参实体
EntmicroStaffRequest entmicroStaffRequest = ConvertRequest.convertRequest(selectIsOutsiderStaffRequest, new EntmicroStaffRequest());
//调用远程
RpcResponse<List<EntmicroStaffResponse>> response = entmicroStaffRemote.listOutSideContactStaff(entmicroStaffRequest);
if (response.isSuccess()) {
//传化为Rop响应体
List<IsOutSiderStaffResponse> isOutSiderStaffResponseList = ConvertResponse.convertList(response.getResult(), IsOutSiderStaffResponse.class);
return isOutSiderStaffResponseList;
}
throw new RpcServiceException(response.getException().getErrId(), response.getMessage());
}
/**
* 批量添加跟进专员
*
* @param saveFollowerStaffRequest
*/
public void saveFollowerStaff(SaveFollowerStaffRequest saveFollowerStaffRequest) {
//转化入参实体
EntmicroFollowerStaffRequest entmicroFollowerStaffRequest = ConvertRequest.convertRequest(saveFollowerStaffRequest, new EntmicroFollowerStaffRequest());
entmicroFollowerStaffRequest.setBusinessTypeId(StringUtils.join(saveFollowerStaffRequest.getBusinessTypeId(),","));
//调用远程
RpcResponse<Boolean> response = entmicroFollowerStaffRemote.saveFollowerStaff(entmicroFollowerStaffRequest);
if (response.isFailed()) {
throw new RpcServiceException(response.getException().getErrId(), response.getMessage());
}
}
/**
* 删除跟进员工
*
* @param deleteFollowerStaffRequest
*/
public void deleteFollowerStaff(DeleteFollowerStaffRequest deleteFollowerStaffRequest) {
//转化入参实体
EntmicroFollowerStaffRequest entmicroFollowerStaffRequest = ConvertRequest.convertRequest(deleteFollowerStaffRequest, new EntmicroFollowerStaffRequest());
//调用远程
RpcResponse<Boolean> response = entmicroFollowerStaffRemote.deleteFollowerStaff(entmicroFollowerStaffRequest);
if (response.isFailed()) {
throw new RpcServiceException(response.getException().getErrId(), response.getMessage());
}
}
/**
* 查询跟进员工列表
*/
public Pagination<FollowerStaffResponse> listFollowerStaffByPage(ListFollowerStaffRequest listFollowerStaffRequest) {
//入参转化
RpcPagination<EntmicroFollowerStaffRequest> pagination = ConvertRequest.convertPage(listFollowerStaffRequest, new EntmicroFollowerStaffRequest());
//调用Rpc
RpcResponse<RpcPagination<EntmicroFollowerStaffResponse>> rpcPaginationRpcResponse = entmicroFollowerStaffRemote.listFollowerStaffByPage(pagination);
if (rpcPaginationRpcResponse.isSuccess()) {
Pagination<FollowerStaffResponse> responsePagination = ConvertResponse.convertPage(rpcPaginationRpcResponse.getResult(), FollowerStaffResponse.class);
return responsePagination;
}
throw new RpcServiceException(rpcPaginationRpcResponse.getException().getErrId(), rpcPaginationRpcResponse.getMessage());
}
/**
* 新增跟进员工类型
*
* @param saveFollowerTypeRequest
* @return
*/
public void saveFollowerType(SaveFollowerTypeRequest saveFollowerTypeRequest) {
//转化入参实体
EntmicroFollowerTypeRequest entmicroFollowerTypeRequest = ConvertRequest.convertRequest(saveFollowerTypeRequest, new EntmicroFollowerTypeRequest());
//调用远程
RpcResponse<Boolean> response = entmicroFollowerTypeRemote.saveEntmicroFollowerType(entmicroFollowerTypeRequest);
if (response.isFailed()) {
throw new RpcServiceException(response.getException().getErrId(), response.getMessage());
}
}
/**
* 删除跟进员工类型
*
* @param deleteFollowerTypeRequest
* @return
*/
public void deleteFollowerType(DeleteFollowerTypeRequest deleteFollowerTypeRequest) {
//转化入参实体
EntmicroFollowerTypeRequest entmicroFollowerTypeRequest = ConvertRequest.convertRequest(deleteFollowerTypeRequest, new EntmicroFollowerTypeRequest());
//调用远程
RpcResponse<Boolean> response = entmicroFollowerTypeRemote.deleteEntmicroFollowerType(entmicroFollowerTypeRequest);
if (response.isFailed()) {
throw new RpcServiceException(response.getException().getErrId(), response.getMessage());
}
}
/**
* 查询所有跟进员工类型
*
* @param
* @return
*/
public List<FollowerTypeResponse> listEntFollowerType(ListFollowerTypeRequest listFollowerTypeRequest) {
//入参转化
EntmicroFollowerTypeRequest entmicroFollowerTypeRequest = ConvertRequest.convertRequest(listFollowerTypeRequest, new EntmicroFollowerTypeRequest());
//调用Rpc
RpcResponse<List<EntmicroFollowerTypeResponse>> responses = entmicroFollowerTypeRemote.listEntFollowerType(entmicroFollowerTypeRequest);
if (responses.isSuccess()) {
List<FollowerTypeResponse> followerTypeResponses = ConvertResponse.convertList(responses.getResult(), FollowerTypeResponse.class);
return followerTypeResponses;
}
throw new RpcServiceException(responses.getException().getErrId(), responses.getMessage());
}
/**
* 查询客户下面的跟进员工
*
* @param listStaffRequest 入参
* @return
*/
public List<FollowerStaffResponse> findlistEntmicroStaff(ListStaffRequest listStaffRequest) {
RpcResponse<List<EntmicroStaffResponse>> listRpcResponse = entmicroStaffRemote.findlistEntmicroStaff(ConvertRequest.convertRequest(listStaffRequest, new EntmicroStaffRequest()));
if (listRpcResponse.isSuccess()) {
List<FollowerStaffResponse> followerTypeResponses = ConvertResponse.convertList(listRpcResponse.getResult(), FollowerStaffResponse.class);
return followerTypeResponses;
}
throw new RpcServiceException(listRpcResponse.getException().getErrId(), listRpcResponse.getMessage());
}
/**
* 查询商户下面的群主列表
*
* @param lordCustomerGroupRopRequest 入参
* @return
*/
public List<FollowerStaffResponse> findLordGroup(LordCustomerGroupRopRequest lordCustomerGroupRopRequest) {
RpcResponse<List<EntmicroStaffResponse>> listRpcResponse = entmicroStaffRemote.findLordGroup(ConvertRequest.convertRequest(lordCustomerGroupRopRequest, new LordCustomerGroupRequest()));
if (listRpcResponse.isSuccess()) {
List<FollowerStaffResponse> followerTypeResponses = ConvertResponse.convertList(listRpcResponse.getResult(), FollowerStaffResponse.class);
return followerTypeResponses;
}
throw new RpcServiceException(listRpcResponse.getException().getErrId(), listRpcResponse.getMessage());
}
/**
* 查询当前商户下所有员工列表
*
* @param selectIsOutsiderStaffRequest
* @return
*/
public List<IsOutSiderStaffResponse> findStaffByMerchantId(SelectIsOutsiderStaffRequest selectIsOutsiderStaffRequest) {
//转化入参实体
EntmicroStaffRequest entmicroStaffRequest = ConvertRequest.convertRequest(selectIsOutsiderStaffRequest, new EntmicroStaffRequest());
//调用远程
RpcResponse<List<EntmicroStaffResponse>> response = entmicroStaffRemote.findStaffByMerchantId(entmicroStaffRequest);
log.info("=======EntimicroStaffService__invoke__entmicroStaffRemote_findStaffByMerchantId:{}", JSONArray.toJSONString(response));
if (response.isSuccess()) {
//传化为Rop响应体
List<IsOutSiderStaffResponse> isOutSiderStaffResponseList = ConvertResponse.convertList(response.getResult(), IsOutSiderStaffResponse.class);
return isOutSiderStaffResponseList;
}
throw new RpcServiceException(response.getException().getErrId(), response.getMessage());
}
/**
* 查询所有跟进员工业务类型
*
* @param
* @return
*/
public List<BusinessTypeResponse> listEntBusinessType(ListFollowerTypeRequest listFollowerTypeRequest) {
//入参转化
EntmicroFollowerTypeRequest entmicroFollowerTypeRequest = ConvertRequest.convertRequest(listFollowerTypeRequest, new EntmicroFollowerTypeRequest());
//调用Rpc
RpcResponse<List<EntmicroBusinessTypeResponse>> responses = entmicroFollowerTypeRemote.listEntBusinessType(entmicroFollowerTypeRequest);
if (responses.isSuccess()) {
List<BusinessTypeResponse> businessTypeResponses = ConvertResponse.convertList(responses.getResult(), BusinessTypeResponse.class);
return businessTypeResponses;
}
throw new RpcServiceException(responses.getException().getErrId(), responses.getMessage());
}
public Pagination<EntmicroStaffResponse> wechatDepositList(WechatDepositRopRequest wechatDepositRopRequest) {
RpcPagination<WechatDepositRequest> pagination = ConvertRequest.convertPage(wechatDepositRopRequest, new WechatDepositRequest());
RpcResponse<RpcPagination<EntmicroStaffResponse>> rpcPaginationRpcResponse = entmicroStaffRemote.wechatDepositList(pagination);
if (rpcPaginationRpcResponse.isSuccess()) {
Pagination<EntmicroStaffResponse> responsePagination = ConvertResponse.convertPage(rpcPaginationRpcResponse.getResult(), EntmicroStaffResponse.class);
return responsePagination;
}
throw new RpcServiceException(rpcPaginationRpcResponse.getException().getErrId(), rpcPaginationRpcResponse.getMessage());
}
public Pagination<EntmicroStaffResponse> wechatDepositNotAccessList(WechatDepositRopRequest wechatDepositRopRequest) {
RpcPagination<WechatDepositRequest> pagination = ConvertRequest.convertPage(wechatDepositRopRequest, new WechatDepositRequest());
RpcResponse<RpcPagination<EntmicroStaffResponse>> rpcPaginationRpcResponse = entmicroStaffRemote.wechatDepositNotAccessList(pagination);
if (rpcPaginationRpcResponse.isSuccess()) {
Pagination<EntmicroStaffResponse> responsePagination = ConvertResponse.convertPage(rpcPaginationRpcResponse.getResult(), EntmicroStaffResponse.class);
return responsePagination;
}
throw new RpcServiceException(rpcPaginationRpcResponse.getException().getErrId(), rpcPaginationRpcResponse.getMessage());
}
}