|
...
|
...
|
@@ -3,15 +3,26 @@ package com.lframework.xingyun.sc.impl.customer; |
|
3
|
3
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
4
|
4
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
5
|
5
|
import com.lframework.starter.bpm.service.FlowTaskService;
|
|
|
6
|
+import com.lframework.starter.common.exceptions.impl.DefaultClientException;
|
|
|
7
|
+import com.lframework.starter.common.utils.ObjectUtil;
|
|
|
8
|
+import com.lframework.starter.mq.core.service.MqProducerService;
|
|
6
|
9
|
import com.lframework.starter.web.core.annotations.oplog.OpLog;
|
|
|
10
|
+import com.lframework.starter.web.core.components.security.SecurityUtil;
|
|
|
11
|
+import com.lframework.starter.web.core.utils.IdUtil;
|
|
7
|
12
|
import com.lframework.starter.web.core.utils.JsonUtil;
|
|
8
|
13
|
import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
|
|
|
14
|
+import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto;
|
|
|
15
|
+import com.lframework.starter.web.inner.service.system.SysUserRoleService;
|
|
|
16
|
+import com.lframework.xingyun.sc.entity.FundCoordination;
|
|
|
17
|
+import com.lframework.xingyun.sc.handlers.TransactorHandler;
|
|
9
|
18
|
import com.lframework.xingyun.sc.service.customer.CustomerCreditService;
|
|
|
19
|
+import com.lframework.xingyun.sc.service.ledger.FundCoordinationService;
|
|
10
|
20
|
import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService;
|
|
11
|
21
|
import com.lframework.xingyun.sc.service.purchase.ReplenishmentOrderService;
|
|
12
|
22
|
import com.lframework.xingyun.sc.vo.customer.credit.*;
|
|
13
|
23
|
import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderInfoVo;
|
|
14
|
24
|
import com.lframework.xingyun.sc.vo.purchase.UpdateReplenishmentOrderVo;
|
|
|
25
|
+import org.apache.commons.collections.CollectionUtils;
|
|
15
|
26
|
import org.springframework.stereotype.Service;
|
|
16
|
27
|
import org.springframework.transaction.annotation.Transactional;
|
|
17
|
28
|
|
|
...
|
...
|
@@ -27,6 +38,14 @@ public class FlowTaskServiceImpl implements FlowTaskService { |
|
27
|
38
|
private PurchaseOrderInfoService purchaseOrderInfoService;
|
|
28
|
39
|
@Resource
|
|
29
|
40
|
private ReplenishmentOrderService replenishmentOrderService;
|
|
|
41
|
+ @Resource
|
|
|
42
|
+ private FundCoordinationService fundCoordinationService;
|
|
|
43
|
+ @Resource
|
|
|
44
|
+ private MqProducerService mqProducerService;
|
|
|
45
|
+ @Resource
|
|
|
46
|
+ private TransactorHandler transactorHandler;
|
|
|
47
|
+ @Resource
|
|
|
48
|
+ private SysUserRoleService sysUserRoleService;
|
|
30
|
49
|
|
|
31
|
50
|
|
|
32
|
51
|
@OpLog(type = OtherOpLogType.class, name = "修改客户资信,ID:{}", params = {"#id"})
|
|
...
|
...
|
@@ -93,34 +112,185 @@ public class FlowTaskServiceImpl implements FlowTaskService { |
|
93
|
112
|
//审核状态
|
|
94
|
113
|
Object e = map.get("examStatus");
|
|
95
|
114
|
String examStatus = String.valueOf(e);
|
|
|
115
|
+ //主键
|
|
|
116
|
+ Object i = map.get("id");
|
|
|
117
|
+ String id = String.valueOf(i);
|
|
|
118
|
+ FundCoordination data = fundCoordinationService.findById(id);
|
|
|
119
|
+ if (ObjectUtil.isNull(data)) {
|
|
|
120
|
+ throw new DefaultClientException("资金协调手续不存在!");
|
|
|
121
|
+ }
|
|
|
122
|
+ //办事处Code
|
|
|
123
|
+ Object d = map.get("deptCode");
|
|
|
124
|
+ String deptCode = String.valueOf(d);
|
|
|
125
|
+ //审核人
|
|
|
126
|
+ String userId = SecurityUtil.getCurrentUser().getId();
|
|
|
127
|
+ //更新审核人及意见
|
|
|
128
|
+ fundCoordinationService.updateExamine(id, userId, nodeCode, message);
|
|
96
|
129
|
|
|
97
|
|
- if (nodeCode.equals("fund_coordination_1")) {
|
|
98
|
|
- //办事处内勤
|
|
99
|
|
-
|
|
100
|
|
- } else if (nodeCode.equals("fund_coordination_2")) {
|
|
101
|
|
- //办事处主管
|
|
102
|
|
-
|
|
103
|
|
- } else if (nodeCode.startsWith("fund_coordination_3-")) {
|
|
|
130
|
+ //消息通知
|
|
|
131
|
+ List<String> userIdList = new ArrayList<>();
|
|
|
132
|
+ //申请人
|
|
|
133
|
+ userIdList.add(data.getApplicant());
|
|
|
134
|
+ //资金清收责任人
|
|
|
135
|
+ userIdList.add(data.getFundResponsiblePerson());
|
|
|
136
|
+ //办事处内勤
|
|
|
137
|
+ List<String> list1 = transactorHandler.listTransactorsByRoleCode("bscnq", data.getCreateById());
|
|
|
138
|
+ if (CollectionUtils.isNotEmpty(list1)) {
|
|
|
139
|
+ userIdList.addAll(list1);
|
|
|
140
|
+ }
|
|
|
141
|
+ //办事处主管
|
|
|
142
|
+ List<String> list2 = transactorHandler.listTransactorsByRoleCode("bsczg", data.getCreateById());
|
|
|
143
|
+ if (CollectionUtils.isNotEmpty(list2)) {
|
|
|
144
|
+ userIdList.addAll(list2);
|
|
|
145
|
+ }
|
|
|
146
|
+ //营销部分管
|
|
|
147
|
+ String roleCode = null;
|
|
|
148
|
+ if ("SZ".equals(deptCode) || "CZ".equals(deptCode) || "BF".equals(deptCode)) {
|
|
|
149
|
+ //苏州常州北方办事处
|
|
|
150
|
+ roleCode = "szczbfbscfg";
|
|
|
151
|
+ } else if ("GD".equals(deptCode) || "FS".equals(deptCode)) {
|
|
|
152
|
+ //东莞佛山办事处
|
|
|
153
|
+ roleCode = "dgfsbscfg";
|
|
|
154
|
+ } else if ("NB".equals(deptCode) || "WZ".equals(deptCode)) {
|
|
|
155
|
+ //宁波温州办事处
|
|
|
156
|
+ roleCode = "nbwzbscfg";
|
|
|
157
|
+ } else if ("ZT".equals(deptCode)) {
|
|
|
158
|
+ //紫铜办事处分管
|
|
|
159
|
+ roleCode = "ztbscfg";
|
|
|
160
|
+ }
|
|
|
161
|
+ if (nodeCode.startsWith("fund_coordination_3-")) {
|
|
104
|
162
|
//办事处分管
|
|
|
163
|
+ //营销部分管审批的审批意见推送至:申请人、资金清收责任人、办事处内勤、办事处主管、运作科资金管理岗、运作科主管
|
|
|
164
|
+ // 获取角色下人员ID
|
|
|
165
|
+ List<String> roleCodes = new ArrayList<>();
|
|
|
166
|
+ roleCodes.add("yzkzjglg");
|
|
|
167
|
+ roleCodes.add("yzkzg");
|
|
|
168
|
+ List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(roleCodes);
|
|
|
169
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
170
|
+ userIdList.addAll(userIds);
|
|
|
171
|
+ }
|
|
105
|
172
|
|
|
|
173
|
+ SysSiteMessageDto messageDto = new SysSiteMessageDto();
|
|
|
174
|
+ messageDto.setUserIdList(userIdList);
|
|
|
175
|
+ messageDto.setTitle("资金协调手续审核通知");
|
|
|
176
|
+ if ("PASS".equals(examStatus)) {
|
|
|
177
|
+ messageDto.setContent("资金协调手续:营销部分管审核通过,具体审核意见:" + message);
|
|
|
178
|
+ } else {
|
|
|
179
|
+ messageDto.setContent("资金协调手续:营销部分管审核拒绝,具体审核意见:" + message);
|
|
|
180
|
+ }
|
|
|
181
|
+ messageDto.setBizKey(IdUtil.getId());
|
|
|
182
|
+ //如果是空表示由系统自动发起
|
|
|
183
|
+ messageDto.setCreateUserId(null);
|
|
|
184
|
+ mqProducerService.createSysSiteMessage(messageDto);
|
|
106
|
185
|
} else if (nodeCode.equals("fund_coordination_4")) {
|
|
107
|
186
|
//运作科资金管理岗
|
|
|
187
|
+ //运作科审批的审批意见推送至:申请人、资金清收责任人、办事处内勤、办事处主管
|
|
108
|
188
|
|
|
|
189
|
+ SysSiteMessageDto messageDto = new SysSiteMessageDto();
|
|
|
190
|
+ messageDto.setUserIdList(userIdList);
|
|
|
191
|
+ messageDto.setTitle("资金协调手续审核通知");
|
|
|
192
|
+ if ("PASS".equals(examStatus)) {
|
|
|
193
|
+ messageDto.setContent("资金协调手续:运作科资金管理岗审核通过,具体审核意见:" + message);
|
|
|
194
|
+ } else {
|
|
|
195
|
+ messageDto.setContent("资金协调手续:运作科资金管理岗审核拒绝,具体审核意见:" + message);
|
|
|
196
|
+ }
|
|
|
197
|
+ messageDto.setBizKey(IdUtil.getId());
|
|
|
198
|
+ //如果是空表示由系统自动发起
|
|
|
199
|
+ messageDto.setCreateUserId(null);
|
|
|
200
|
+ mqProducerService.createSysSiteMessage(messageDto);
|
|
109
|
201
|
} else if (nodeCode.equals("fund_coordination_5")) {
|
|
110
|
202
|
//运作科主管
|
|
|
203
|
+ //运作科审批的审批意见推送至:申请人、资金清收责任人、办事处内勤、办事处主管
|
|
111
|
204
|
|
|
|
205
|
+ SysSiteMessageDto messageDto = new SysSiteMessageDto();
|
|
|
206
|
+ messageDto.setUserIdList(userIdList);
|
|
|
207
|
+ messageDto.setTitle("资金协调手续审核通知");
|
|
|
208
|
+ if ("PASS".equals(examStatus)) {
|
|
|
209
|
+ messageDto.setContent("资金协调手续:运作科主管审核通过,具体审核意见:" + message);
|
|
|
210
|
+ } else {
|
|
|
211
|
+ messageDto.setContent("资金协调手续:运作科主管审核拒绝,具体审核意见:" + message);
|
|
|
212
|
+ }
|
|
|
213
|
+ messageDto.setBizKey(IdUtil.getId());
|
|
|
214
|
+ //如果是空表示由系统自动发起
|
|
|
215
|
+ messageDto.setCreateUserId(null);
|
|
|
216
|
+ mqProducerService.createSysSiteMessage(messageDto);
|
|
112
|
217
|
} else if (nodeCode.equals("fund_coordination_6")) {
|
|
113
|
218
|
//营销部主管
|
|
|
219
|
+ //营销部主管审批的审批意见推送至:申请人、资金清收责任人、办事处内勤、办事处主管、营销部分管、运作科资金管理岗、运作科主管
|
|
|
220
|
+ // 获取角色下人员ID
|
|
|
221
|
+ List<String> roleCodes = new ArrayList<>();
|
|
|
222
|
+ roleCodes.add("yzkzjglg");
|
|
|
223
|
+ roleCodes.add("yzkzg");
|
|
|
224
|
+ roleCodes.add(roleCode);
|
|
|
225
|
+ List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(roleCodes);
|
|
|
226
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
227
|
+ userIdList.addAll(userIds);
|
|
|
228
|
+ }
|
|
114
|
229
|
|
|
115
|
|
- } else if (nodeCode.equals("fund_coordination_7")) {
|
|
116
|
|
- //财务部副经理
|
|
117
|
|
-
|
|
|
230
|
+ SysSiteMessageDto messageDto = new SysSiteMessageDto();
|
|
|
231
|
+ messageDto.setUserIdList(userIdList);
|
|
|
232
|
+ messageDto.setTitle("资金协调手续审核通知");
|
|
|
233
|
+ if ("PASS".equals(examStatus)) {
|
|
|
234
|
+ messageDto.setContent("资金协调手续:营销部主管审核通过,具体审核意见:" + message);
|
|
|
235
|
+ } else {
|
|
|
236
|
+ messageDto.setContent("资金协调手续:营销部主管审核拒绝,具体审核意见:" + message);
|
|
|
237
|
+ }
|
|
|
238
|
+ messageDto.setBizKey(IdUtil.getId());
|
|
|
239
|
+ //如果是空表示由系统自动发起
|
|
|
240
|
+ messageDto.setCreateUserId(null);
|
|
|
241
|
+ mqProducerService.createSysSiteMessage(messageDto);
|
|
118
|
242
|
} else if (nodeCode.equals("fund_coordination_8")) {
|
|
119
|
243
|
//营销中心主管
|
|
|
244
|
+ //营销中心主管审批的审批意见推送至:申请人、资金清收责任人、办事处内勤、办事处主管、营销部分管、运作科资金管理岗、运作科主管、营销部主管
|
|
|
245
|
+ // 获取角色下人员ID
|
|
|
246
|
+ List<String> roleCodes = new ArrayList<>();
|
|
|
247
|
+ roleCodes.add("yzkzjglg");
|
|
|
248
|
+ roleCodes.add("yzkzg");
|
|
|
249
|
+ roleCodes.add(roleCode);
|
|
|
250
|
+ roleCodes.add("yxbzg");
|
|
|
251
|
+ List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(roleCodes);
|
|
|
252
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
253
|
+ userIdList.addAll(userIds);
|
|
|
254
|
+ }
|
|
120
|
255
|
|
|
|
256
|
+ SysSiteMessageDto messageDto = new SysSiteMessageDto();
|
|
|
257
|
+ messageDto.setUserIdList(userIdList);
|
|
|
258
|
+ messageDto.setTitle("资金协调手续审核通知");
|
|
|
259
|
+ if ("PASS".equals(examStatus)) {
|
|
|
260
|
+ messageDto.setContent("资金协调手续:营销中心主管审核通过,具体审核意见:" + message);
|
|
|
261
|
+ } else {
|
|
|
262
|
+ messageDto.setContent("资金协调手续:营销中心主管审核拒绝,具体审核意见:" + message);
|
|
|
263
|
+ }
|
|
|
264
|
+ messageDto.setBizKey(IdUtil.getId());
|
|
|
265
|
+ //如果是空表示由系统自动发起
|
|
|
266
|
+ messageDto.setCreateUserId(null);
|
|
|
267
|
+ mqProducerService.createSysSiteMessage(messageDto);
|
|
121
|
268
|
} else if (nodeCode.equals("fund_coordination_9")) {
|
|
122
|
269
|
//总经理
|
|
|
270
|
+ //总经理审批的审批意见推送至:申请人、资金清收责任人、内勤、办事处主管、营销部分管、运作科资金管理岗、运作科主管、营销部主管、营销中心主管
|
|
|
271
|
+ // 获取角色下人员ID
|
|
|
272
|
+ List<String> roleCodes = new ArrayList<>();
|
|
|
273
|
+ roleCodes.add("yzkzjglg");
|
|
|
274
|
+ roleCodes.add("yzkzg");
|
|
|
275
|
+ roleCodes.add(roleCode);
|
|
|
276
|
+ roleCodes.add("yxbzg");
|
|
|
277
|
+ List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(roleCodes);
|
|
|
278
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
279
|
+ userIdList.addAll(userIds);
|
|
|
280
|
+ }
|
|
123
|
281
|
|
|
|
282
|
+ SysSiteMessageDto messageDto = new SysSiteMessageDto();
|
|
|
283
|
+ messageDto.setUserIdList(userIdList);
|
|
|
284
|
+ messageDto.setTitle("资金协调手续审核通知");
|
|
|
285
|
+ if ("PASS".equals(examStatus)) {
|
|
|
286
|
+ messageDto.setContent("资金协调手续:总经理审核通过,具体审核意见:" + message);
|
|
|
287
|
+ } else {
|
|
|
288
|
+ messageDto.setContent("资金协调手续:总经理审核拒绝,具体审核意见:" + message);
|
|
|
289
|
+ }
|
|
|
290
|
+ messageDto.setBizKey(IdUtil.getId());
|
|
|
291
|
+ //如果是空表示由系统自动发起
|
|
|
292
|
+ messageDto.setCreateUserId(null);
|
|
|
293
|
+ mqProducerService.createSysSiteMessage(messageDto);
|
|
124
|
294
|
}
|
|
125
|
295
|
|
|
126
|
296
|
}
|
...
|
...
|
|