|
...
|
...
|
@@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo; |
|
6
|
6
|
import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
|
|
7
|
7
|
import com.lframework.starter.common.utils.CollectionUtil;
|
|
8
|
8
|
import com.lframework.starter.common.utils.StringUtil;
|
|
|
9
|
+import com.lframework.starter.mq.core.service.MqProducerService;
|
|
9
|
10
|
import com.lframework.starter.web.core.components.security.SecurityUtil;
|
|
10
|
11
|
import com.lframework.starter.web.core.impl.BaseMpServiceImpl;
|
|
11
|
12
|
import com.lframework.starter.web.core.utils.PageResultUtil;;
|
|
...
|
...
|
@@ -20,16 +21,22 @@ import com.lframework.starter.web.core.utils.PageHelperUtil; |
|
20
|
21
|
import com.lframework.starter.common.utils.Assert;
|
|
21
|
22
|
import com.lframework.starter.web.inner.bo.usercenter.UserInfoBo;
|
|
22
|
23
|
import com.lframework.starter.web.inner.components.oplog.OtherOpLogType;
|
|
|
24
|
+import com.lframework.starter.web.inner.dto.message.SysSiteMessageDto;
|
|
23
|
25
|
import com.lframework.starter.web.inner.dto.system.UserInfoDto;
|
|
|
26
|
+import com.lframework.starter.web.inner.entity.SysRole;
|
|
|
27
|
+import com.lframework.starter.web.inner.service.system.SysRoleService;
|
|
|
28
|
+import com.lframework.starter.web.inner.service.system.SysUserRoleService;
|
|
24
|
29
|
import com.lframework.starter.web.inner.service.system.SysUserService;
|
|
25
|
30
|
import com.lframework.xingyun.sc.entity.DelayedShipment;
|
|
26
|
31
|
import com.lframework.xingyun.sc.entity.DelayedShipmentDetail;
|
|
|
32
|
+import com.lframework.xingyun.sc.handlers.TransactorHandler;
|
|
27
|
33
|
import com.lframework.xingyun.sc.mappers.DelayedShipmentMapper;
|
|
28
|
34
|
import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
|
|
29
|
35
|
import com.lframework.xingyun.sc.service.shipments.ShipmentsPlanDetailService;
|
|
30
|
36
|
import com.lframework.xingyun.sc.service.shipments.delay.DelayedShipmentDetailService;
|
|
31
|
37
|
import com.lframework.xingyun.sc.service.shipments.delay.DelayedShipmentService;
|
|
32
|
38
|
import com.lframework.xingyun.sc.vo.shipments.delay.*;
|
|
|
39
|
+import org.apache.commons.collections.CollectionUtils;
|
|
33
|
40
|
import org.springframework.transaction.annotation.Transactional;
|
|
34
|
41
|
import org.springframework.stereotype.Service;
|
|
35
|
42
|
import javax.annotation.Resource;
|
|
...
|
...
|
@@ -51,6 +58,12 @@ public class DelayedShipmentServiceImpl extends BaseMpServiceImpl<DelayedShipmen |
|
51
|
58
|
private SysUserService sysUserService;
|
|
52
|
59
|
@Resource
|
|
53
|
60
|
private PurchaseOrderLineService purchaseOrderLineService;
|
|
|
61
|
+ @Resource
|
|
|
62
|
+ private MqProducerService mqProducerService;
|
|
|
63
|
+ @Resource
|
|
|
64
|
+ private SysUserRoleService sysUserRoleService;
|
|
|
65
|
+ @Resource
|
|
|
66
|
+ private TransactorHandler transactorHandler;
|
|
54
|
67
|
|
|
55
|
68
|
@Override
|
|
56
|
69
|
public PageResult<DelayedShipment> query(Integer pageIndex, Integer pageSize, QueryDelayedShipmentVo vo) {
|
|
...
|
...
|
@@ -160,9 +173,9 @@ public class DelayedShipmentServiceImpl extends BaseMpServiceImpl<DelayedShipmen |
|
160
|
173
|
newRoleCodes.add("sfcsckjhy");
|
|
161
|
174
|
newRoleCodes.add("ztfcsckjhy");
|
|
162
|
175
|
boolean hasAny = newRoleCodes.stream().anyMatch(roleCodes::contains);
|
|
|
176
|
+ DelayedShipmentDetail delayedShipmentDetail = delayedShipmentDetailService.findById(id);
|
|
163
|
177
|
if (delayedExceedOneDay && !hasAny) {
|
|
164
|
178
|
//开启审核
|
|
165
|
|
- DelayedShipmentDetail delayedShipmentDetail = delayedShipmentDetailService.findById(id);
|
|
166
|
179
|
vo.setWorkshopCode(delayedShipmentDetail.getWorkshopCode());
|
|
167
|
180
|
|
|
168
|
181
|
flowInstanceWrapperService.startInstance(BPM_FLAG, data.getId(), BPM_FLAG, vo);
|
|
...
|
...
|
@@ -174,14 +187,68 @@ public class DelayedShipmentServiceImpl extends BaseMpServiceImpl<DelayedShipmen |
|
174
|
187
|
vo1.setDelayedShipmentId(data.getId());
|
|
175
|
188
|
List<DelayedShipmentDetail> query = delayedShipmentDetailService.query(vo1);
|
|
176
|
189
|
if (CollectionUtil.isNotEmpty(query)) {
|
|
177
|
|
- for (DelayedShipmentDetail delayedShipmentDetail : query) {
|
|
178
|
|
- purchaseOrderLineService.updateDeliveryDate(delayedShipmentDetail.getOrderSpecId(),
|
|
179
|
|
- delayedShipmentDetail.getApplyShipmentDate());
|
|
|
190
|
+ for (DelayedShipmentDetail detail : query) {
|
|
|
191
|
+ purchaseOrderLineService.updateDeliveryDate(detail.getOrderSpecId(), detail.getApplyShipmentDate());
|
|
180
|
192
|
}
|
|
181
|
193
|
}
|
|
182
|
194
|
}
|
|
183
|
|
- //todo 消息通知
|
|
184
|
|
-
|
|
|
195
|
+ //todo 消息通知经营办计划员、经营办发货员、业务员、办事处内勤和经营办主管。
|
|
|
196
|
+ List<String> userIdList = new ArrayList<>();
|
|
|
197
|
+ List<String> codeList = new ArrayList<>();
|
|
|
198
|
+ String workshopCode = delayedShipmentDetail.getWorkshopCode();
|
|
|
199
|
+ //业务员
|
|
|
200
|
+ String contractCreateById = delayedShipmentDetail.getContractCreateById();
|
|
|
201
|
+ userIdList.add(contractCreateById);
|
|
|
202
|
+ //办事处内勤
|
|
|
203
|
+ List<String> list1 = transactorHandler.listTransactorsByRoleCode("bscnq", contractCreateById);
|
|
|
204
|
+ if (CollectionUtils.isNotEmpty(list1)) {
|
|
|
205
|
+ userIdList.addAll(list1);
|
|
|
206
|
+ }
|
|
|
207
|
+ if ("yfc".equals(workshopCode)) {
|
|
|
208
|
+ //经营办计划员、经营办发货员、经营办主管
|
|
|
209
|
+ codeList.add("yfcjybjhy");
|
|
|
210
|
+ codeList.add("yfcjybfhy");
|
|
|
211
|
+ codeList.add("yfcjybzg");
|
|
|
212
|
+ List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(codeList);
|
|
|
213
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
214
|
+ userIdList.addAll(userIds);
|
|
|
215
|
+ }
|
|
|
216
|
+ } else if ("efc".equals(workshopCode)) {
|
|
|
217
|
+ //经营办计划员、经营办发货员、经营办主管
|
|
|
218
|
+ codeList.add("efcjybjhy");
|
|
|
219
|
+ codeList.add("efcjybfhy");
|
|
|
220
|
+ codeList.add("efcjybzg");
|
|
|
221
|
+ List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(codeList);
|
|
|
222
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
223
|
+ userIdList.addAll(userIds);
|
|
|
224
|
+ }
|
|
|
225
|
+ } else if ("sfc".equals(workshopCode)) {
|
|
|
226
|
+ //经营办计划员、经营办发货员、经营办主管
|
|
|
227
|
+ codeList.add("sfcjybjhy");
|
|
|
228
|
+ codeList.add("sfcjybfhy");
|
|
|
229
|
+ codeList.add("sfcjybzg");
|
|
|
230
|
+ List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(codeList);
|
|
|
231
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
232
|
+ userIdList.addAll(userIds);
|
|
|
233
|
+ }
|
|
|
234
|
+ } else if ("sfc".equals(workshopCode)) {
|
|
|
235
|
+ //经营办计划员、经营办发货员、经营办主管
|
|
|
236
|
+ codeList.add("ztfcjybjhy");
|
|
|
237
|
+ codeList.add("ztfcjybfhy");
|
|
|
238
|
+ codeList.add("ztcjybzg");
|
|
|
239
|
+ List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(codeList);
|
|
|
240
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
241
|
+ userIdList.addAll(userIds);
|
|
|
242
|
+ }
|
|
|
243
|
+ }
|
|
|
244
|
+ SysSiteMessageDto messageDto = new SysSiteMessageDto();
|
|
|
245
|
+ messageDto.setUserIdList(userIdList);
|
|
|
246
|
+ messageDto.setTitle("延期发货通知");
|
|
|
247
|
+ messageDto.setContent("延期发货通知!");
|
|
|
248
|
+ messageDto.setBizKey(IdUtil.getId());
|
|
|
249
|
+ //如果是空表示由系统自动发起
|
|
|
250
|
+ messageDto.setCreateUserId(null);
|
|
|
251
|
+ mqProducerService.createSysSiteMessage(messageDto);
|
|
185
|
252
|
return data.getId();
|
|
186
|
253
|
}
|
|
187
|
254
|
|
|
...
|
...
|
@@ -256,9 +323,9 @@ public class DelayedShipmentServiceImpl extends BaseMpServiceImpl<DelayedShipmen |
|
256
|
323
|
newRoleCodes.add("sfcsckjhy");
|
|
257
|
324
|
newRoleCodes.add("ztfcsckjhy");
|
|
258
|
325
|
boolean hasAny = newRoleCodes.stream().anyMatch(roleCodes::contains);
|
|
|
326
|
+ DelayedShipmentDetail delayedShipmentDetail = delayedShipmentDetailService.findById(id);
|
|
259
|
327
|
if (delayedExceedOneDay && !hasAny) {
|
|
260
|
328
|
//开启审核
|
|
261
|
|
- DelayedShipmentDetail delayedShipmentDetail = delayedShipmentDetailService.findById(id);
|
|
262
|
329
|
vo.setWorkshopCode(delayedShipmentDetail.getWorkshopCode());
|
|
263
|
330
|
|
|
264
|
331
|
flowInstanceWrapperService.startInstance(BPM_FLAG, vo.getId(), BPM_FLAG, vo);
|
|
...
|
...
|
@@ -270,13 +337,68 @@ public class DelayedShipmentServiceImpl extends BaseMpServiceImpl<DelayedShipmen |
|
270
|
337
|
vo1.setDelayedShipmentId(data.getId());
|
|
271
|
338
|
List<DelayedShipmentDetail> query = delayedShipmentDetailService.query(vo1);
|
|
272
|
339
|
if (CollectionUtil.isNotEmpty(query)) {
|
|
273
|
|
- for (DelayedShipmentDetail delayedShipmentDetail : query) {
|
|
274
|
|
- purchaseOrderLineService.updateDeliveryDate(delayedShipmentDetail.getOrderSpecId(),
|
|
275
|
|
- delayedShipmentDetail.getApplyShipmentDate());
|
|
|
340
|
+ for (DelayedShipmentDetail detail : query) {
|
|
|
341
|
+ purchaseOrderLineService.updateDeliveryDate(detail.getOrderSpecId(), detail.getApplyShipmentDate());
|
|
276
|
342
|
}
|
|
277
|
343
|
}
|
|
278
|
344
|
}
|
|
279
|
|
- //todo 消息通知
|
|
|
345
|
+ //todo 消息通知经营办计划员、经营办发货员、业务员、办事处内勤和经营办主管。
|
|
|
346
|
+ List<String> userIdList = new ArrayList<>();
|
|
|
347
|
+ List<String> codeList = new ArrayList<>();
|
|
|
348
|
+ String workshopCode = delayedShipmentDetail.getWorkshopCode();
|
|
|
349
|
+ //业务员
|
|
|
350
|
+ String contractCreateById = delayedShipmentDetail.getContractCreateById();
|
|
|
351
|
+ userIdList.add(contractCreateById);
|
|
|
352
|
+ //办事处内勤
|
|
|
353
|
+ List<String> list1 = transactorHandler.listTransactorsByRoleCode("bscnq", contractCreateById);
|
|
|
354
|
+ if (CollectionUtils.isNotEmpty(list1)) {
|
|
|
355
|
+ userIdList.addAll(list1);
|
|
|
356
|
+ }
|
|
|
357
|
+ if ("yfc".equals(workshopCode)) {
|
|
|
358
|
+ //经营办计划员、经营办发货员、经营办主管
|
|
|
359
|
+ codeList.add("yfcjybjhy");
|
|
|
360
|
+ codeList.add("yfcjybfhy");
|
|
|
361
|
+ codeList.add("yfcjybzg");
|
|
|
362
|
+ List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(codeList);
|
|
|
363
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
364
|
+ userIdList.addAll(userIds);
|
|
|
365
|
+ }
|
|
|
366
|
+ } else if ("efc".equals(workshopCode)) {
|
|
|
367
|
+ //经营办计划员、经营办发货员、经营办主管
|
|
|
368
|
+ codeList.add("efcjybjhy");
|
|
|
369
|
+ codeList.add("efcjybfhy");
|
|
|
370
|
+ codeList.add("efcjybzg");
|
|
|
371
|
+ List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(codeList);
|
|
|
372
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
373
|
+ userIdList.addAll(userIds);
|
|
|
374
|
+ }
|
|
|
375
|
+ } else if ("sfc".equals(workshopCode)) {
|
|
|
376
|
+ //经营办计划员、经营办发货员、经营办主管
|
|
|
377
|
+ codeList.add("sfcjybjhy");
|
|
|
378
|
+ codeList.add("sfcjybfhy");
|
|
|
379
|
+ codeList.add("sfcjybzg");
|
|
|
380
|
+ List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(codeList);
|
|
|
381
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
382
|
+ userIdList.addAll(userIds);
|
|
|
383
|
+ }
|
|
|
384
|
+ } else if ("ztfc".equals(workshopCode)) {
|
|
|
385
|
+ //经营办计划员、经营办发货员、经营办主管
|
|
|
386
|
+ codeList.add("ztfcjybjhy");
|
|
|
387
|
+ codeList.add("ztfcjybfhy");
|
|
|
388
|
+ codeList.add("ztcjybzg");
|
|
|
389
|
+ List<String> userIds = sysUserRoleService.listUserIdByRoleCodes(codeList);
|
|
|
390
|
+ if (CollectionUtils.isNotEmpty(userIds)) {
|
|
|
391
|
+ userIdList.addAll(userIds);
|
|
|
392
|
+ }
|
|
|
393
|
+ }
|
|
|
394
|
+ SysSiteMessageDto messageDto = new SysSiteMessageDto();
|
|
|
395
|
+ messageDto.setUserIdList(userIdList);
|
|
|
396
|
+ messageDto.setTitle("延期发货通知");
|
|
|
397
|
+ messageDto.setContent("延期发货通知!");
|
|
|
398
|
+ messageDto.setBizKey(IdUtil.getId());
|
|
|
399
|
+ //如果是空表示由系统自动发起
|
|
|
400
|
+ messageDto.setCreateUserId(null);
|
|
|
401
|
+ mqProducerService.createSysSiteMessage(messageDto);
|
|
280
|
402
|
}
|
|
281
|
403
|
|
|
282
|
404
|
@OpLog(type = OtherOpLogType.class, name = "修改状态,ID:{}", params = {"#id"})
|
...
|
...
|
|