|
@@ -199,7 +199,8 @@ public class BillLogicImpl implements BillLogic {
|
199
|
199
|
final List<BillOpinionVO> opinionVOS = Lists.newArrayList();
|
200
|
200
|
String firstNodeId = StringPool.EMPTY;
|
201
|
201
|
|
202
|
|
- final List<ProcessNodeExtendEntity> taskNodes = nodeExtendService.findTaskNodeByProcess(processId);
|
|
202
|
+ final List<ProcessNodeExtendEntity> taskNodes =
|
|
203
|
+ nodeExtendService.findTaskNodeByProcess(processId);
|
203
|
204
|
if (CollectionUtil.isNotEmpty(taskNodes)) {
|
204
|
205
|
for (ProcessNodeExtendEntity taskNode : taskNodes) {
|
205
|
206
|
final String linkType = taskNode.getLinkType();
|
|
@@ -214,14 +215,17 @@ public class BillLogicImpl implements BillLogic {
|
214
|
215
|
}
|
215
|
216
|
}
|
216
|
217
|
// 获取授权信息
|
217
|
|
- final List<FormPermissionVO> permissionVOS =
|
218
|
|
- formBasicConvert.formPermissionPOtoVO(nodeFieldPermission.nodeFieldPermission(processId, firstNodeId));
|
|
218
|
+ final List<FormPermissionVO> permissionVOS = formBasicConvert.formPermissionPOtoVO(
|
|
219
|
+ nodeFieldPermission.nodeFieldPermission(processId, firstNodeId));
|
219
|
220
|
// 获取标题字段
|
220
|
221
|
final ToaProcessEntity byId = processService.getById(processId);
|
221
|
|
- final String code = DateTimeUtil.format(LocalDateTime.now(), "yyyyMMddHHmm") + RandomUtil.randomNumbers(6);
|
|
222
|
+ final String code =
|
|
223
|
+ DateTimeUtil.format(LocalDateTime.now(), "yyyyMMddHHmm") + RandomUtil.randomNumbers(
|
|
224
|
+ 6);
|
222
|
225
|
// 获取标题字段
|
223
|
226
|
|
224
|
|
- final UserInfoDTO userInfoByCode = userCenterlogic.getUserInfoByCode(loginUserHolder.getUserCode());
|
|
227
|
+ final UserInfoDTO userInfoByCode =
|
|
228
|
+ userCenterlogic.getUserInfoByCode(loginUserHolder.getUserCode());
|
225
|
229
|
final String title = billTitleLogic.getTitle(processId, userInfoByCode.getNickname());
|
226
|
230
|
final Map<String, Object> formData = bizFormData(process, userInfoByCode, title);
|
227
|
231
|
// 按钮控制
|
|
@@ -251,8 +255,9 @@ public class BillLogicImpl implements BillLogic {
|
251
|
255
|
if (bill == null) {
|
252
|
256
|
throw new RbException(StringPool.EMPTY, BillCode.BILL_NOT_FOUND);
|
253
|
257
|
}
|
254
|
|
- final BillDataJsonEntity billDataJson =
|
255
|
|
- billDataJsonService.getOne(Wrappers.lambdaQuery(BillDataJsonEntity.class).eq(BillDataJsonEntity::getBillId, billId));
|
|
258
|
+ final BillDataJsonEntity billDataJson = billDataJsonService.getOne(
|
|
259
|
+ Wrappers.lambdaQuery(BillDataJsonEntity.class)
|
|
260
|
+ .eq(BillDataJsonEntity::getBillId, billId));
|
256
|
261
|
if (null == billDataJson) {
|
257
|
262
|
throw new RbException(StringPool.EMPTY, BillCode.BILL_NOT_FOUND);
|
258
|
263
|
}
|
|
@@ -270,17 +275,28 @@ public class BillLogicImpl implements BillLogic {
|
270
|
275
|
detailBuilder.selfTaskNames(getSelfNodeName(billId, loginUserHolder.getUserCode(), page));
|
271
|
276
|
final List<BillOpinionVO> opinionVOS = billOpinions(bill);
|
272
|
277
|
final String formSchema = billDataJson.getFormSchema();
|
273
|
|
- return detailBuilder.form(formSchema).opinions(opinionVOS).title(bill.getTitle()).code(bill.getCode()).mode("edit").build();
|
|
278
|
+ return detailBuilder.form(formSchema)
|
|
279
|
+ .opinions(opinionVOS)
|
|
280
|
+ .title(bill.getTitle())
|
|
281
|
+ .code(bill.getCode())
|
|
282
|
+ .mode("edit")
|
|
283
|
+ .build();
|
274
|
284
|
}
|
275
|
285
|
|
276
|
286
|
private Set<String> getSelfNodeName(long billId, String user, String page) {
|
277
|
287
|
if (page.equals("view")) {
|
278
|
|
- List<BillTaskEntity> billTaskEntities = billTaskService.findApprovedByBillAndUser(billId, user);
|
279
|
|
- final Set<String> nodeNames = billTaskEntities.stream().map(BillTaskEntity::getNodeName).collect(Collectors.toSet());
|
|
288
|
+ List<BillTaskEntity> billTaskEntities =
|
|
289
|
+ billTaskService.findApprovedByBillAndUser(billId, user);
|
|
290
|
+ final Set<String> nodeNames = billTaskEntities.stream()
|
|
291
|
+ .map(BillTaskEntity::getNodeName)
|
|
292
|
+ .collect(Collectors.toSet());
|
280
|
293
|
return nodeNames;
|
281
|
294
|
} else {
|
282
|
|
- List<BillTaskEntity> billTaskEntities = billTaskService.findApprovingByBillAndUser(billId, user);
|
283
|
|
- final Set<String> nodeNames = billTaskEntities.stream().map(BillTaskEntity::getNodeName).collect(Collectors.toSet());
|
|
295
|
+ List<BillTaskEntity> billTaskEntities =
|
|
296
|
+ billTaskService.findApprovingByBillAndUser(billId, user);
|
|
297
|
+ final Set<String> nodeNames = billTaskEntities.stream()
|
|
298
|
+ .map(BillTaskEntity::getNodeName)
|
|
299
|
+ .collect(Collectors.toSet());
|
284
|
300
|
return nodeNames;
|
285
|
301
|
}
|
286
|
302
|
}
|
|
@@ -294,7 +310,9 @@ public class BillLogicImpl implements BillLogic {
|
294
|
310
|
if (bill == null) {
|
295
|
311
|
throw new RbException(StringPool.EMPTY, BillCode.BILL_NOT_FOUND);
|
296
|
312
|
}
|
297
|
|
- final BillDataJsonEntity billDataJson = billDataJsonService.getOne(Wrappers.lambdaQuery(BillDataJsonEntity.class).eq(BillDataJsonEntity::getBillId, billId));
|
|
313
|
+ final BillDataJsonEntity billDataJson = billDataJsonService.getOne(
|
|
314
|
+ Wrappers.lambdaQuery(BillDataJsonEntity.class)
|
|
315
|
+ .eq(BillDataJsonEntity::getBillId, billId));
|
298
|
316
|
if (null == billDataJson) {
|
299
|
317
|
throw new RbException(StringPool.EMPTY, BillCode.BILL_NOT_FOUND);
|
300
|
318
|
}
|
|
@@ -312,7 +330,11 @@ public class BillLogicImpl implements BillLogic {
|
312
|
330
|
detailBuilder.selfTaskNames(getSelfNodeName(billId, loginUserHolder.getUserCode(), page));
|
313
|
331
|
final List<BillOpinionVO> opinionVOS = billOpinions(bill);
|
314
|
332
|
final String formSchema = billDataJson.getFormSchema();
|
315
|
|
- return detailBuilder.form(formSchema).code(bill.getCode()).opinions(opinionVOS).mode("view").build();
|
|
333
|
+ return detailBuilder.form(formSchema)
|
|
334
|
+ .code(bill.getCode())
|
|
335
|
+ .opinions(opinionVOS)
|
|
336
|
+ .mode("view")
|
|
337
|
+ .build();
|
316
|
338
|
}
|
317
|
339
|
|
318
|
340
|
/**
|
|
@@ -331,8 +353,8 @@ public class BillLogicImpl implements BillLogic {
|
331
|
353
|
final String userCode = loginUserHolder.getUserCode();
|
332
|
354
|
// 不是自己发起的,记录读取
|
333
|
355
|
final String sender = bill.getSender();
|
334
|
|
- return sender.equals(userCode)
|
335
|
|
- || billReadRecordService.readBillByUserCode(billId, userCode);
|
|
356
|
+ return sender.equals(userCode) || billReadRecordService.readBillByUserCode(billId,
|
|
357
|
+ userCode);
|
336
|
358
|
}
|
337
|
359
|
|
338
|
360
|
/**
|
|
@@ -347,7 +369,8 @@ public class BillLogicImpl implements BillLogic {
|
347
|
369
|
public BillItemVO saveDrafts(long processId, long billId, String formDataJson) {
|
348
|
370
|
Preconditions.checkNotNull(formDataJson);
|
349
|
371
|
final ProcessDetailPO processDetail = this.processService.findDetailById(processId);
|
350
|
|
- final Map<String, Object> dataMap = JSON.parseObject(formDataJson, FastJsonType.MAP_OBJECT_TR);
|
|
372
|
+ final Map<String, Object> dataMap =
|
|
373
|
+ JSON.parseObject(formDataJson, FastJsonType.MAP_OBJECT_TR);
|
351
|
374
|
final BillDataContext billDataValue;
|
352
|
375
|
billDataValue = this.resolveFormData(billId, processDetail, dataMap);
|
353
|
376
|
final ToaBillEntity bill;
|
|
@@ -384,7 +407,9 @@ public class BillLogicImpl implements BillLogic {
|
384
|
407
|
* @return 数据和总数
|
385
|
408
|
*/
|
386
|
409
|
@Override
|
387
|
|
- public Pair<List<BillItemVO>, Long> findApproved(Integer pageNo, Integer pageSize, ApprovedBillQuery query) {
|
|
410
|
+ public Pair<List<BillItemVO>, Long> findApproved(
|
|
411
|
+ Integer pageNo, Integer pageSize, ApprovedBillQuery query
|
|
412
|
+ ) {
|
388
|
413
|
Page page = new Page<>(pageNo, pageSize);
|
389
|
414
|
final List<BillItemPO> billItemDtos;
|
390
|
415
|
final String userCode = loginUserHolder.getUserCode();
|
|
@@ -402,13 +427,15 @@ public class BillLogicImpl implements BillLogic {
|
402
|
427
|
* @return 数据和总数
|
403
|
428
|
*/
|
404
|
429
|
@Override
|
405
|
|
- public Pair<List<BillItemVO>, Long> findTodo(Integer pageNo, Integer pageSize, TodoBillQuery query) {
|
|
430
|
+ public Pair<List<BillItemVO>, Long> findTodo(
|
|
431
|
+ Integer pageNo, Integer pageSize, TodoBillQuery query
|
|
432
|
+ ) {
|
406
|
433
|
Page page = new Page(pageNo, pageSize);
|
407
|
|
- List<Integer> statusList = Lists.newArrayList(
|
408
|
|
- BillStatus.APPROVAL.getStatus(), BillStatus.REFUSE.getStatus()
|
409
|
|
- );
|
|
434
|
+ List<Integer> statusList =
|
|
435
|
+ Lists.newArrayList(BillStatus.APPROVAL.getStatus(), BillStatus.REFUSE.getStatus());
|
410
|
436
|
final String userCode = loginUserHolder.getUserCode();
|
411
|
|
- final List<BillItemPO> billDatas = this.billService.findTodoByStatus(page, userCode, query, statusList);
|
|
437
|
+ final List<BillItemPO> billDatas =
|
|
438
|
+ this.billService.findTodoByStatus(page, userCode, query, statusList);
|
412
|
439
|
final Page<BillItemVO> billItemVOPage = toItemVOList(page, billDatas, userCode);
|
413
|
440
|
return Pair.of(billItemVOPage.getRecords(), billItemVOPage.getTotal());
|
414
|
441
|
}
|
|
@@ -422,10 +449,13 @@ public class BillLogicImpl implements BillLogic {
|
422
|
449
|
* @return 数据和总数
|
423
|
450
|
*/
|
424
|
451
|
@Override
|
425
|
|
- public Pair<List<BillItemVO>, Long> findMeCreate(Integer pageNo, Integer pageSize, MeCreateBillQuery query) {
|
|
452
|
+ public Pair<List<BillItemVO>, Long> findMeCreate(
|
|
453
|
+ Integer pageNo, Integer pageSize, MeCreateBillQuery query
|
|
454
|
+ ) {
|
426
|
455
|
Page page = new Page(pageNo, pageSize);
|
427
|
456
|
final String userCode = loginUserHolder.getUserCode();
|
428
|
|
- final List<BillItemPO> billDatas = this.billService.findCreateByEmployee(page, userCode, query);
|
|
457
|
+ final List<BillItemPO> billDatas =
|
|
458
|
+ this.billService.findCreateByEmployee(page, userCode, query);
|
429
|
459
|
final Page<BillItemVO> billItemVOPage = toItemVOList(page, billDatas, userCode);
|
430
|
460
|
return Pair.of(billItemVOPage.getRecords(), billItemVOPage.getTotal());
|
431
|
461
|
}
|
|
@@ -439,10 +469,13 @@ public class BillLogicImpl implements BillLogic {
|
439
|
469
|
* @return 数据和总数
|
440
|
470
|
*/
|
441
|
471
|
@Override
|
442
|
|
- public Pair<List<BillItemVO>, Long> findDraft(Integer pageNo, Integer pageSize, DraftBillQuery query) {
|
|
472
|
+ public Pair<List<BillItemVO>, Long> findDraft(
|
|
473
|
+ Integer pageNo, Integer pageSize, DraftBillQuery query
|
|
474
|
+ ) {
|
443
|
475
|
Page page = new Page(pageNo, pageSize);
|
444
|
476
|
final String userCode = loginUserHolder.getUserCode();
|
445
|
|
- final List<BillItemPO> billDatas = this.billService.findDraftsBySender(page, userCode, query);
|
|
477
|
+ final List<BillItemPO> billDatas =
|
|
478
|
+ this.billService.findDraftsBySender(page, userCode, query);
|
446
|
479
|
final Page<BillItemVO> billItemVOPage = toItemVOList(page, billDatas, userCode);
|
447
|
480
|
return Pair.of(billItemVOPage.getRecords(), billItemVOPage.getTotal());
|
448
|
481
|
}
|
|
@@ -456,7 +489,9 @@ public class BillLogicImpl implements BillLogic {
|
456
|
489
|
* @return 数据和总数
|
457
|
490
|
*/
|
458
|
491
|
@Override
|
459
|
|
- public Pair<List<BillItemVO>, Long> findCc(Integer pageNo, Integer pageSize, CcBillQuery query) {
|
|
492
|
+ public Pair<List<BillItemVO>, Long> findCc(
|
|
493
|
+ Integer pageNo, Integer pageSize, CcBillQuery query
|
|
494
|
+ ) {
|
460
|
495
|
Page page = new Page(pageNo, pageSize);
|
461
|
496
|
final String userCode = loginUserHolder.getUserCode();
|
462
|
497
|
final List<BillItemPO> cc = this.billService.findCc(page, userCode, query);
|
|
@@ -474,11 +509,13 @@ public class BillLogicImpl implements BillLogic {
|
474
|
509
|
*/
|
475
|
510
|
@Override
|
476
|
511
|
@Transactional(rollbackFor = Exception.class)
|
477
|
|
- public BillItemVO startFlow(long processId, long billId, String formDataJson,
|
478
|
|
- String nextApprover, String billCode) {
|
|
512
|
+ public BillItemVO startFlow(
|
|
513
|
+ long processId, long billId, String formDataJson, String nextApprover, String billCode
|
|
514
|
+ ) {
|
479
|
515
|
Preconditions.checkNotNull(formDataJson);
|
480
|
516
|
final ProcessDetailPO processDetail = processService.findDetailById(processId);
|
481
|
|
- final Map<String, Object> dataMap = JSON.parseObject(formDataJson, FastJsonType.MAP_OBJECT_TR);
|
|
517
|
+ final Map<String, Object> dataMap =
|
|
518
|
+ JSON.parseObject(formDataJson, FastJsonType.MAP_OBJECT_TR);
|
482
|
519
|
final String userCode = loginUserHolder.getUserCode();
|
483
|
520
|
final UserInfoDTO userInfoDTO = userCenterlogic.getUserInfoByCode(userCode);
|
484
|
521
|
final BillDataContext billDataValue;
|
|
@@ -546,11 +583,12 @@ public class BillLogicImpl implements BillLogic {
|
546
|
583
|
//找到审批中的节点,然后把排序前移
|
547
|
584
|
final BillTaskEntity byId = billTaskService.getById(sourceTaskId);
|
548
|
585
|
final String taskId = byId.getTaskId();
|
549
|
|
- final List<BillTaskEntity> approvingByBillAndTaskId = billTaskService.findApprovingByBillAndTaskId(billId, taskId);
|
|
586
|
+ final List<BillTaskEntity> approvingByBillAndTaskId =
|
|
587
|
+ billTaskService.findApprovingByBillAndTaskId(billId, taskId);
|
550
|
588
|
for (BillTaskEntity billTaskEntity : approvingByBillAndTaskId) {
|
551
|
589
|
billTaskEntity.setSort(DateTimeUtil.timeMills());
|
552
|
590
|
}
|
553
|
|
-// approvingByBillAndTaskId.add(createTaskByBill);
|
|
591
|
+ // approvingByBillAndTaskId.add(createTaskByBill);
|
554
|
592
|
byId.setId(null);
|
555
|
593
|
byId.setOpinion(null);
|
556
|
594
|
byId.setNodeStatus(BillTaskStatus.APPROVAL.getStatus());
|
|
@@ -571,7 +609,8 @@ public class BillLogicImpl implements BillLogic {
|
571
|
609
|
}
|
572
|
610
|
// 先发起流程
|
573
|
611
|
final Optional<ProcessInstance> processInstanceOpt;
|
574
|
|
- processInstanceOpt = billBpmnLogic.startFlow(billDataValue, processDetail, userInfoDTO, nextApprover);
|
|
612
|
+ processInstanceOpt =
|
|
613
|
+ billBpmnLogic.startFlow(billDataValue, processDetail, userInfoDTO, nextApprover);
|
575
|
614
|
if (processInstanceOpt.isPresent()) {
|
576
|
615
|
final ProcessInstance processInstance = processInstanceOpt.get();
|
577
|
616
|
final boolean state;
|
|
@@ -603,7 +642,7 @@ public class BillLogicImpl implements BillLogic {
|
603
|
642
|
bill.setStatus(BillStatus.APPROVAL.getStatus());
|
604
|
643
|
state = billService.updateById(bill);
|
605
|
644
|
// 取得审批任务信息进行更新
|
606
|
|
-// billTaskService.updateByReFullIn(billId, userInfoDTO.getCode());
|
|
645
|
+ // billTaskService.updateByReFullIn(billId, userInfoDTO.getCode());
|
607
|
646
|
break;
|
608
|
647
|
}
|
609
|
648
|
default:
|
|
@@ -622,7 +661,9 @@ public class BillLogicImpl implements BillLogic {
|
622
|
661
|
}
|
623
|
662
|
}
|
624
|
663
|
|
625
|
|
- private ValidationResultDTO validationBySubmitFlow(ProcessDetailPO processDetail, BillDataContext billDataValue, String userCode) {
|
|
664
|
+ private ValidationResultDTO validationBySubmitFlow(
|
|
665
|
+ ProcessDetailPO processDetail, BillDataContext billDataValue, String userCode
|
|
666
|
+ ) {
|
626
|
667
|
final BillValidationLogic validationService = getValidationService(processDetail.getId());
|
627
|
668
|
return validataionWithResult(billDataValue, userCode, validationService);
|
628
|
669
|
}
|
|
@@ -635,15 +676,18 @@ public class BillLogicImpl implements BillLogic {
|
635
|
676
|
* @return 审批单
|
636
|
677
|
*/
|
637
|
678
|
@Override
|
638
|
|
- public BillItemVO sendProcess(long billId, long processId,
|
639
|
|
- String nextApprover) {
|
|
679
|
+ public BillItemVO sendProcess(
|
|
680
|
+ long billId, long processId, String nextApprover
|
|
681
|
+ ) {
|
640
|
682
|
final ToaBillEntity bill = billService.getById(billId);
|
641
|
683
|
if (bill == null) {
|
642
|
684
|
throw new RbException(BillCode.BILL_NOT_FOUND);
|
643
|
685
|
}
|
644
|
686
|
// 去掉草稿箱的判断,通过具体执行函数来判断
|
645
|
687
|
|
646
|
|
- final BillDataJsonEntity billDataJson = billDataJsonService.getOne(Wrappers.lambdaQuery(BillDataJsonEntity.class).eq(BillDataJsonEntity::getBillId, billId));
|
|
688
|
+ final BillDataJsonEntity billDataJson = billDataJsonService.getOne(
|
|
689
|
+ Wrappers.lambdaQuery(BillDataJsonEntity.class)
|
|
690
|
+ .eq(BillDataJsonEntity::getBillId, billId));
|
647
|
691
|
final String formData = billDataJson.getFormData();
|
648
|
692
|
return this.startFlow(processId, billId, formData, nextApprover, StrUtil.EMPTY);
|
649
|
693
|
}
|
|
@@ -674,7 +718,8 @@ public class BillLogicImpl implements BillLogic {
|
674
|
718
|
eventBus.post(billAgreeEvent);
|
675
|
719
|
case APPROVAL: {
|
676
|
720
|
final Optional<BillTaskEntity> taskOpt;
|
677
|
|
- taskOpt = billBpmnLogic.findTaskBybillAndEmployeeAndTaskId(billId, taskId, userCode);
|
|
721
|
+ taskOpt =
|
|
722
|
+ billBpmnLogic.findTaskBybillAndEmployeeAndTaskId(billId, taskId, userCode);
|
678
|
723
|
if (taskOpt.isPresent()) {
|
679
|
724
|
BillTaskEntity billTask = taskOpt.get();
|
680
|
725
|
billTask.setOpinion(opinion);
|
|
@@ -692,14 +737,21 @@ public class BillLogicImpl implements BillLogic {
|
692
|
737
|
final boolean goFlag = agreeIsGoOn(billTask);
|
693
|
738
|
flowMsgLogic.sendMsg(Lists.newArrayList(billTask));
|
694
|
739
|
if (goFlag) {
|
695
|
|
- this.billTaskService.agreeTask(billTask, userCode, actionParam);
|
696
|
|
- this.billItemLogic.updateByFormDataByBill(billId, actionParam.getFormData());
|
|
740
|
+ this.billTaskService.agreeTask(billTask, userCode,
|
|
741
|
+ actionParam);
|
|
742
|
+ this.billItemLogic.updateByFormDataByBill(billId,
|
|
743
|
+ actionParam.getFormData());
|
697
|
744
|
//删除待审批的信息
|
698
|
|
- this.billTaskService.deleteApproval(billTask.getBillId(), billTask.getTaskId(), BillTaskStatus.APPROVAL.getStatus());
|
699
|
|
- this.billBpmnLogic.complete(bill, taskId, opinion, userCode, nextApprover, actionParam.getFormData(), billTask.getTaskNodeKey(), billTask.getTaskId());
|
|
745
|
+ this.billTaskService.deleteApproval(billTask.getBillId(),
|
|
746
|
+ billTask.getTaskId(),
|
|
747
|
+ BillTaskStatus.APPROVAL.getStatus());
|
|
748
|
+ this.billBpmnLogic.complete(bill, taskId, opinion, userCode,
|
|
749
|
+ nextApprover, actionParam.getFormData(),
|
|
750
|
+ billTask.getTaskNodeKey(), billTask.getTaskId());
|
700
|
751
|
|
701
|
752
|
} else {
|
702
|
|
- this.billTaskService.agreeTask(billTask, userCode, actionParam);
|
|
753
|
+ this.billTaskService.agreeTask(billTask, userCode,
|
|
754
|
+ actionParam);
|
703
|
755
|
}
|
704
|
756
|
break;
|
705
|
757
|
case AGREE:
|
|
@@ -713,12 +765,17 @@ public class BillLogicImpl implements BillLogic {
|
713
|
765
|
switch (billTaskStatus) {
|
714
|
766
|
case APPROVAL:
|
715
|
767
|
//加签处理,需要把当前审批人在当前节点的所有加签任务都审批通过
|
716
|
|
- List<BillTaskEntity> billTaskEntities = billTaskService.findEndorseByUserAndTaskId(billId, taskId, userCode);
|
|
768
|
+ List<BillTaskEntity> billTaskEntities =
|
|
769
|
+ billTaskService.findEndorseByUserAndTaskId(billId,
|
|
770
|
+ taskId, userCode);
|
717
|
771
|
List<BillTaskEntity> updates = Lists.newArrayList();
|
718
|
772
|
List<BillTaskEntity> inserts = Lists.newArrayList();
|
719
|
773
|
for (BillTaskEntity billTaskEntity : billTaskEntities) {
|
720
|
|
- final BillTaskEntity newBillTask = BeanUtil.sourceToTarget(billTask, BillTaskEntity.class);
|
721
|
|
- billTaskEntity.setNodeStatus(BillTaskStatus.AGREE.getStatus());
|
|
774
|
+ final BillTaskEntity newBillTask =
|
|
775
|
+ BeanUtil.sourceToTarget(billTask,
|
|
776
|
+ BillTaskEntity.class);
|
|
777
|
+ billTaskEntity.setNodeStatus(
|
|
778
|
+ BillTaskStatus.AGREE.getStatus());
|
722
|
779
|
billTaskEntity.setDateline(DateTimeUtil.unixTime());
|
723
|
780
|
billTaskEntity.setUpdateTime(LocalDateTime.now());
|
724
|
781
|
billTaskEntity.setOpinion(actionParam.getOpinion());
|
|
@@ -787,15 +844,16 @@ public class BillLogicImpl implements BillLogic {
|
787
|
844
|
final int status = MoreObjects.firstNonNull(bill.getStatus(), 0);
|
788
|
845
|
BillStatus billStatus = BillStatus.valueTo(status);
|
789
|
846
|
switch (billStatus) {
|
790
|
|
-// case REFUSE:
|
791
|
|
-// //当前审批单是拒绝状态才会走这里
|
792
|
|
-// BillRefuseEvent billAgreeEvent = new BillRefuseEvent();
|
793
|
|
-// billAgreeEvent.setBillId(billId);
|
794
|
|
-// billAgreeEvent.setProcessId(bill.getProcessId());
|
795
|
|
-// eventBus.post(billAgreeEvent);
|
|
847
|
+ // case REFUSE:
|
|
848
|
+ // //当前审批单是拒绝状态才会走这里
|
|
849
|
+ // BillRefuseEvent billAgreeEvent = new BillRefuseEvent();
|
|
850
|
+ // billAgreeEvent.setBillId(billId);
|
|
851
|
+ // billAgreeEvent.setProcessId(bill.getProcessId());
|
|
852
|
+ // eventBus.post(billAgreeEvent);
|
796
|
853
|
case APPROVAL: {
|
797
|
854
|
final Optional<BillTaskEntity> taskOpt;
|
798
|
|
- taskOpt = billBpmnLogic.findTaskBybillAndEmployeeAndTaskId(billId, taskId, userCode);
|
|
855
|
+ taskOpt =
|
|
856
|
+ billBpmnLogic.findTaskBybillAndEmployeeAndTaskId(billId, taskId, userCode);
|
799
|
857
|
if (taskOpt.isPresent()) {
|
800
|
858
|
BillTaskEntity task = taskOpt.get();
|
801
|
859
|
final int taskNodeStatus = task.getNodeStatus();
|
|
@@ -805,10 +863,13 @@ public class BillLogicImpl implements BillLogic {
|
805
|
863
|
refuseApproval(taskId, opinion, bill, userCode, task);
|
806
|
864
|
// 更新提交的formdata
|
807
|
865
|
final String formData = actionParam.getFormData();
|
808
|
|
- if (!Strings.isNullOrEmpty(formData) && !org.apache.commons.lang3.StringUtils.equals("{}", formData)) {
|
|
866
|
+ if (!Strings.isNullOrEmpty(
|
|
867
|
+ formData) && !org.apache.commons.lang3.StringUtils.equals("{}",
|
|
868
|
+ formData)) {
|
809
|
869
|
this.billItemLogic.updateByFormDataByBill(billId, formData);
|
810
|
870
|
}
|
811
|
|
- billTaskService.deleteApproval(task.getBillId(), task.getTaskId(), BillTaskStatus.APPROVAL.getStatus());
|
|
871
|
+ billTaskService.deleteApproval(task.getBillId(), task.getTaskId(),
|
|
872
|
+ BillTaskStatus.APPROVAL.getStatus());
|
812
|
873
|
break;
|
813
|
874
|
case AGREE:
|
814
|
875
|
case REFUSE:
|
|
@@ -850,9 +911,11 @@ public class BillLogicImpl implements BillLogic {
|
850
|
911
|
final ToaBillEntity byId = billService.getById(billId);
|
851
|
912
|
billService.upldate(bill);
|
852
|
913
|
if (action.equals(BillAction.refuse.name())) {
|
853
|
|
- callBackLogic.callBack(byId.getProcessId(), billId, BillTaskStatus.REFUSE.getStatus());
|
|
914
|
+ callBackLogic.callBack(byId.getProcessId(), billId,
|
|
915
|
+ BillTaskStatus.REFUSE.getStatus());
|
854
|
916
|
} else {
|
855
|
|
- callBackLogic.callBack(byId.getProcessId(), billId, BillStatus.COMPLETE.getStatus());
|
|
917
|
+ callBackLogic.callBack(byId.getProcessId(), billId,
|
|
918
|
+ BillStatus.COMPLETE.getStatus());
|
856
|
919
|
}
|
857
|
920
|
}
|
858
|
921
|
};
|
|
@@ -872,15 +935,20 @@ public class BillLogicImpl implements BillLogic {
|
872
|
935
|
throw new RbException(BillCode.BILL_NOT_FOUND);
|
873
|
936
|
}
|
874
|
937
|
final List<BillApprovalHistoryPO> byBill = billTaskService.findByBill(bill);
|
875
|
|
- final Set<String> userCodes = byBill.stream().map(BillApprovalHistoryPO::getUserCode).collect(Collectors.toSet());
|
876
|
|
- final Set<String> userCodes1 = byBill.stream().map(BillApprovalHistoryPO::getSourceUserCode).collect(Collectors.toSet());
|
877
|
|
- final Set<String> userCodes2 = byBill.stream().map(BillApprovalHistoryPO::getTargetUserCode).collect(Collectors.toSet());
|
|
938
|
+ final Set<String> userCodes =
|
|
939
|
+ byBill.stream().map(BillApprovalHistoryPO::getUserCode).collect(Collectors.toSet());
|
|
940
|
+ final Set<String> userCodes1 = byBill.stream()
|
|
941
|
+ .map(BillApprovalHistoryPO::getSourceUserCode)
|
|
942
|
+ .collect(Collectors.toSet());
|
|
943
|
+ final Set<String> userCodes2 = byBill.stream()
|
|
944
|
+ .map(BillApprovalHistoryPO::getTargetUserCode)
|
|
945
|
+ .collect(Collectors.toSet());
|
878
|
946
|
userCodes.addAll(userCodes1);
|
879
|
947
|
userCodes.addAll(userCodes2);
|
880
|
948
|
final List<UserInfoDTO> userInfoDTOS = userCenterlogic.getUserByCodes(userCodes);
|
881
|
949
|
if (CollectionUtil.isNotEmpty(userInfoDTOS)) {
|
882
|
|
- final Map<String, String> codeNameMap =
|
883
|
|
- userInfoDTOS.stream().collect(Collectors.toMap(UserInfoDTO::getCode, UserInfoDTO::getNickname));
|
|
950
|
+ final Map<String, String> codeNameMap = userInfoDTOS.stream()
|
|
951
|
+ .collect(Collectors.toMap(UserInfoDTO::getCode, UserInfoDTO::getNickname));
|
884
|
952
|
for (BillApprovalHistoryPO billApprovalHistoryPO : byBill) {
|
885
|
953
|
final String userCode = billApprovalHistoryPO.getUserCode();
|
886
|
954
|
final String name = codeNameMap.get(userCode);
|
|
@@ -893,19 +961,21 @@ public class BillLogicImpl implements BillLogic {
|
893
|
961
|
if (!Strings.isNullOrEmpty(targetUserCode)) {
|
894
|
962
|
billApprovalHistoryPO.setTargetUserName(codeNameMap.get(targetUserCode));
|
895
|
963
|
}
|
896
|
|
- if (billApprovalHistoryPO.getTaskType().compareTo(BillTaskType.SKIP.getValue()) == 0) {
|
|
964
|
+ if (billApprovalHistoryPO.getTaskType()
|
|
965
|
+ .compareTo(BillTaskType.SKIP.getValue()) == 0) {
|
897
|
966
|
billApprovalHistoryPO.setUserName(Const.SKIP_OPTION);
|
898
|
967
|
}
|
899
|
968
|
}
|
900
|
969
|
}
|
901
|
|
- final List<BillApprovalHistoryPO> result =
|
902
|
|
- byBill.stream().sorted(Comparator.comparing(BillApprovalHistoryPO::getSort, (x, y) -> {
|
|
970
|
+ final List<BillApprovalHistoryPO> result = byBill.stream()
|
|
971
|
+ .sorted(Comparator.comparing(BillApprovalHistoryPO::getSort, (x, y) -> {
|
903
|
972
|
if (x <= y) {
|
904
|
973
|
return -1;
|
905
|
974
|
} else {
|
906
|
975
|
return 1;
|
907
|
976
|
}
|
908
|
|
- })).collect(Collectors.toList());
|
|
977
|
+ }))
|
|
978
|
+ .collect(Collectors.toList());
|
909
|
979
|
return billBasicConvert.billApprovalHistoryPOToVO(result);
|
910
|
980
|
}
|
911
|
981
|
|
|
@@ -932,7 +1002,9 @@ public class BillLogicImpl implements BillLogic {
|
932
|
1002
|
billBpmnLogic.recall(bill, taskId, opinion, userCode);
|
933
|
1003
|
}
|
934
|
1004
|
|
935
|
|
- private void refuseApproval(String taskId, String opinion, ToaBillEntity bill, String userCode, BillTaskEntity task) {
|
|
1005
|
+ private void refuseApproval(
|
|
1006
|
+ String taskId, String opinion, ToaBillEntity bill, String userCode, BillTaskEntity task
|
|
1007
|
+ ) {
|
936
|
1008
|
final Optional<ProcessNodeExtendEntity> nodeExtendOpt;
|
937
|
1009
|
final Long processId = bill.getProcessId();
|
938
|
1010
|
final String taskNodeKey = task.getTaskNodeKey();
|
|
@@ -955,14 +1027,14 @@ public class BillLogicImpl implements BillLogic {
|
955
|
1027
|
task.setOpinion(opinion);
|
956
|
1028
|
task.setDateline(dateline);
|
957
|
1029
|
task.setAction(BillAction.refuse.name());
|
958
|
|
-// bill.setStatus(BillStatus.REFUSE.getStatus());
|
959
|
|
-// bill.setUpdateTime(LocalDateTime.now());
|
|
1030
|
+ // bill.setStatus(BillStatus.REFUSE.getStatus());
|
|
1031
|
+ // bill.setUpdateTime(LocalDateTime.now());
|
960
|
1032
|
//推送消息
|
961
|
1033
|
List<BillTaskEntity> sends = Lists.newArrayList();
|
962
|
1034
|
sends.add(task);
|
963
|
1035
|
flowMsgLogic.sendMsg(sends);
|
964
|
1036
|
billTaskService.updateById(task);
|
965
|
|
-// billService.updateById(bill);
|
|
1037
|
+ // billService.updateById(bill);
|
966
|
1038
|
billReadRecordService.deleteByBillAndEmployeeId(bill.getId(), userCode);
|
967
|
1039
|
billBpmnLogic.refuse(bill, taskId, opinion, userCode);
|
968
|
1040
|
break;
|
|
@@ -980,7 +1052,8 @@ public class BillLogicImpl implements BillLogic {
|
980
|
1052
|
final String taskId = billTask.getTaskId();
|
981
|
1053
|
final Long billId = billTask.getBillId();
|
982
|
1054
|
final Long approverId = billTask.getNodeApproverId();
|
983
|
|
- final ProcessNodeApproverEntity nodeApprover = nodeApproverService.getByIdExludDel(approverId);
|
|
1055
|
+ final ProcessNodeApproverEntity nodeApprover =
|
|
1056
|
+ nodeApproverService.getByIdExludDel(approverId);
|
984
|
1057
|
if (Objects.isNull(nodeApprover)) {
|
985
|
1058
|
//默认全部审批通过才能往下走
|
986
|
1059
|
final int percentage = 100;
|
|
@@ -988,7 +1061,8 @@ public class BillLogicImpl implements BillLogic {
|
988
|
1061
|
int total = billTaskService.findTotalCount(billId, taskId, billTask.getTaskType());
|
989
|
1062
|
final BigDecimal val1 = BigDecimal.valueOf(countActive + 1);
|
990
|
1063
|
final BigDecimal val2 = BigDecimal.valueOf(total);
|
991
|
|
- final BigDecimal val3 = val1.divide(val2, 4, BigDecimal.ROUND_DOWN).multiply(BigDecimal.valueOf(100));
|
|
1064
|
+ final BigDecimal val3 =
|
|
1065
|
+ val1.divide(val2, 4, BigDecimal.ROUND_DOWN).multiply(BigDecimal.valueOf(100));
|
992
|
1066
|
final BigDecimal val4 = BigDecimal.valueOf(percentage);
|
993
|
1067
|
return val3.compareTo(val4) >= 0 ? true : false;
|
994
|
1068
|
}
|
|
@@ -1011,7 +1085,8 @@ public class BillLogicImpl implements BillLogic {
|
1011
|
1085
|
int total = billTaskService.findTotalCount(billId, taskId, billTask.getTaskType());
|
1012
|
1086
|
final BigDecimal val1 = BigDecimal.valueOf(countActive + 1);
|
1013
|
1087
|
final BigDecimal val2 = BigDecimal.valueOf(total);
|
1014
|
|
- final BigDecimal val3 = val1.divide(val2, 4, BigDecimal.ROUND_DOWN).multiply(BigDecimal.valueOf(100));
|
|
1088
|
+ final BigDecimal val3 =
|
|
1089
|
+ val1.divide(val2, 4, BigDecimal.ROUND_DOWN).multiply(BigDecimal.valueOf(100));
|
1015
|
1090
|
final BigDecimal val4 = BigDecimal.valueOf(percentage);
|
1016
|
1091
|
return val3.compareTo(val4) >= 0 ? true : false;
|
1017
|
1092
|
}
|
|
@@ -1025,7 +1100,8 @@ public class BillLogicImpl implements BillLogic {
|
1025
|
1100
|
final Set<String> userCodes =
|
1026
|
1101
|
billDatas.stream().map(BillItemPO::getSender).collect(Collectors.toSet());
|
1027
|
1102
|
final List<UserInfoDTO> userInfoDTOS = userCenterlogic.getUserByCodes(userCodes);
|
1028
|
|
- final Map<String, String> codeNameMap = userInfoDTOS.stream().collect(Collectors.toMap(UserInfoDTO::getCode, a -> a.getNickname()));
|
|
1103
|
+ final Map<String, String> codeNameMap = userInfoDTOS.stream()
|
|
1104
|
+ .collect(Collectors.toMap(UserInfoDTO::getCode, a -> a.getNickname()));
|
1029
|
1105
|
if (CollectionUtil.isNotEmpty(userInfoDTOS)) {
|
1030
|
1106
|
for (BillItemPO billData : billDatas) {
|
1031
|
1107
|
final String sender = billData.getSender();
|
|
@@ -1045,7 +1121,10 @@ public class BillLogicImpl implements BillLogic {
|
1045
|
1121
|
return resultPage;
|
1046
|
1122
|
}
|
1047
|
1123
|
|
1048
|
|
- private ToaBillEntity createBill(ProcessDetailPO processDetail, BillStatus billStatus, BillDataContext billDataValue, UserInfoDTO userInfoDTO) {
|
|
1124
|
+ private ToaBillEntity createBill(
|
|
1125
|
+ ProcessDetailPO processDetail, BillStatus billStatus, BillDataContext billDataValue,
|
|
1126
|
+ UserInfoDTO userInfoDTO
|
|
1127
|
+ ) {
|
1049
|
1128
|
ToaBillEntity bill = new ToaBillEntity();
|
1050
|
1129
|
bill.setId(billDataValue.getId());
|
1051
|
1130
|
bill.setProcessId(processDetail.getId());
|
|
@@ -1075,7 +1154,7 @@ public class BillLogicImpl implements BillLogic {
|
1075
|
1154
|
final String username = userInfoDTO.getNickname();
|
1076
|
1155
|
// 生成默认流水号
|
1077
|
1156
|
final String billCode = serialNumberLogic.dayPolling("bill_default_sn", 6);
|
1078
|
|
-// String codeText = StrUtil.format("{}-{}-{}-{}", processName, username, day, billCode);
|
|
1157
|
+ // String codeText = StrUtil.format("{}-{}-{}-{}", processName, username, day, billCode);
|
1079
|
1158
|
String codeText = StrUtil.format("{}", billCode);
|
1080
|
1159
|
bill.setCode(codeText);
|
1081
|
1160
|
} else {
|
|
@@ -1095,7 +1174,9 @@ public class BillLogicImpl implements BillLogic {
|
1095
|
1174
|
* @return 解析后的表单数据
|
1096
|
1175
|
*/
|
1097
|
1176
|
@Override
|
1098
|
|
- public BillDataContext resolveFormData(long billId, ProcessDetailPO processDetail, Map<String, Object> formDataMap) {
|
|
1177
|
+ public BillDataContext resolveFormData(
|
|
1178
|
+ long billId, ProcessDetailPO processDetail, Map<String, Object> formDataMap
|
|
1179
|
+ ) {
|
1099
|
1180
|
|
1100
|
1181
|
long processId = processDetail.getId();
|
1101
|
1182
|
|
|
@@ -1135,7 +1216,8 @@ public class BillLogicImpl implements BillLogic {
|
1135
|
1216
|
switch (formXtype) {
|
1136
|
1217
|
case triggerselect: {
|
1137
|
1218
|
final Pair<List<BillAssociatedVO>, List<BillBizDataEntity>> selectVal;
|
1138
|
|
- selectVal = billItemLogic.formTriggerselectValue(formDataMap, formFieldVO, newBillId);
|
|
1219
|
+ selectVal = billItemLogic.formTriggerselectValue(formDataMap, formFieldVO,
|
|
1220
|
+ newBillId);
|
1139
|
1221
|
associateds.addAll(selectVal.getKey());
|
1140
|
1222
|
bizDataList.addAll(selectVal.getValue());
|
1141
|
1223
|
break;
|
|
@@ -1176,8 +1258,10 @@ public class BillLogicImpl implements BillLogic {
|
1176
|
1258
|
continue;
|
1177
|
1259
|
}
|
1178
|
1260
|
|
1179
|
|
- final Triple<Boolean, List<BillAssociatedVO>, List<BillBizDataEntity>> detailItemTriple;
|
1180
|
|
- detailItemTriple = billItemLogic.detailFormFileds(newBillId, detailgroupDatas, detailFields);
|
|
1261
|
+ final Triple<Boolean, List<BillAssociatedVO>, List<BillBizDataEntity>>
|
|
1262
|
+ detailItemTriple;
|
|
1263
|
+ detailItemTriple = billItemLogic.detailFormFileds(newBillId, detailgroupDatas,
|
|
1264
|
+ detailFields);
|
1181
|
1265
|
final Boolean attachment = detailItemTriple.getLeft();
|
1182
|
1266
|
if (attachment) {
|
1183
|
1267
|
dataValueBuilder.attachment(true);
|
|
@@ -1215,8 +1299,11 @@ public class BillLogicImpl implements BillLogic {
|
1215
|
1299
|
final long billId = actionParam.getBillId();
|
1216
|
1300
|
final String userCode = actionParam.getUserCode();
|
1217
|
1301
|
|
1218
|
|
- List<BillTaskEntity> billTaskEntities = billTaskService.findApprovingByBillAndTaskId(billId, taskId);
|
1219
|
|
- final Set<String> collect = billTaskEntities.stream().map(BillTaskEntity::getUserCode).collect(Collectors.toSet());
|
|
1302
|
+ List<BillTaskEntity> billTaskEntities =
|
|
1303
|
+ billTaskService.findApprovingByBillAndTaskId(billId, taskId);
|
|
1304
|
+ final Set<String> collect = billTaskEntities.stream()
|
|
1305
|
+ .map(BillTaskEntity::getUserCode)
|
|
1306
|
+ .collect(Collectors.toSet());
|
1220
|
1307
|
if (collect.contains(actionParam.getEndorseApprover())) {
|
1221
|
1308
|
throw new RbException(ENDORSE_CANNOT_IN_NODE);
|
1222
|
1309
|
}
|
|
@@ -1233,7 +1320,8 @@ public class BillLogicImpl implements BillLogic {
|
1233
|
1320
|
case APPROVAL:
|
1234
|
1321
|
// 更新提交的formdata
|
1235
|
1322
|
final String formData = actionParam.getFormData();
|
1236
|
|
- if (!Strings.isNullOrEmpty(formData) && !org.apache.commons.lang3.StringUtils.equals("{}", formData)) {
|
|
1323
|
+ if (!Strings.isNullOrEmpty(
|
|
1324
|
+ formData) && !org.apache.commons.lang3.StringUtils.equals("{}", formData)) {
|
1237
|
1325
|
this.billItemLogic.updateByFormDataByBill(billId, formData);
|
1238
|
1326
|
}
|
1239
|
1327
|
break;
|
|
@@ -1287,7 +1375,8 @@ public class BillLogicImpl implements BillLogic {
|
1287
|
1375
|
case APPROVAL:
|
1288
|
1376
|
// 更新提交的formdata
|
1289
|
1377
|
final String formData = actionParam.getFormData();
|
1290
|
|
- if (!Strings.isNullOrEmpty(formData) && !org.apache.commons.lang3.StringUtils.equals("{}", formData)) {
|
|
1378
|
+ if (!Strings.isNullOrEmpty(
|
|
1379
|
+ formData) && !org.apache.commons.lang3.StringUtils.equals("{}", formData)) {
|
1291
|
1380
|
this.billItemLogic.updateByFormDataByBill(billId, formData);
|
1292
|
1381
|
}
|
1293
|
1382
|
break;
|
|
@@ -1304,29 +1393,37 @@ public class BillLogicImpl implements BillLogic {
|
1304
|
1393
|
task.setOpinion(opinion);
|
1305
|
1394
|
task.setDateline(DateTimeUtil.unixTime());
|
1306
|
1395
|
billTaskService.upldate(task);
|
1307
|
|
- final BillTaskEntity targetTask = billTaskService.getOne(Wrappers.lambdaQuery(BillTaskEntity.class)
|
1308
|
|
- .eq(BillTaskEntity::getId, targetTaskId));
|
|
1396
|
+ final BillTaskEntity targetTask = billTaskService.getOne(
|
|
1397
|
+ Wrappers.lambdaQuery(BillTaskEntity.class).eq(BillTaskEntity::getId, targetTaskId));
|
1309
|
1398
|
if (Objects.isNull(targetTask)) {
|
1310
|
1399
|
throw new RbException(TARGET_TASK_NULL);
|
1311
|
1400
|
}
|
1312
|
1401
|
final String taskNodeKey = targetTask.getTaskNodeKey();
|
1313
|
|
- final ProcessNodeExtendEntity extendEntity = nodeExtendService
|
1314
|
|
- .getOne(Wrappers.lambdaQuery(ProcessNodeExtendEntity.class)
|
|
1402
|
+ final ProcessNodeExtendEntity extendEntity = nodeExtendService.getOne(
|
|
1403
|
+ Wrappers.lambdaQuery(ProcessNodeExtendEntity.class)
|
1315
|
1404
|
.eq(ProcessNodeExtendEntity::getProcessId, byId.getProcessId())
|
1316
|
1405
|
.eq(ProcessNodeExtendEntity::getNodeId, taskNodeKey));
|
1317
|
1406
|
List<BillTaskEntity> sends = Lists.newArrayList();
|
|
1407
|
+ //退回需要删除当前节点审批中的数据
|
|
1408
|
+ billTaskService.remove(Wrappers.lambdaQuery(BillTaskEntity.class)
|
|
1409
|
+ .eq(BillTaskEntity::getBillId, billId)
|
|
1410
|
+ .eq(BillTaskEntity::getTaskNodeKey, task.getTaskNodeKey()).ne(BillTaskEntity::getId,task.getId()));
|
1318
|
1411
|
if (!extendEntity.getLinkType().equals(NodeLinkType.create.name())) {
|
1319
|
|
- billBpmnLogic.returnToTargetTask(task, targetTask, userCode, opinion, actionParam.getNextApprover());
|
|
1412
|
+ billBpmnLogic.returnToTargetTask(task, targetTask, userCode, opinion,
|
|
1413
|
+ actionParam.getNextApprover());
|
1320
|
1414
|
} else {
|
1321
|
1415
|
/**
|
1322
|
1416
|
*表示是退回到发起节点需要进行操作需要找到当前审批的最新的创建节点,然后找到任务taskId和用户然后重新创建一个节点任务
|
1323
|
1417
|
*/
|
1324
|
|
- billService.update(Wrappers.lambdaUpdate(ToaBillEntity.class).set(ToaBillEntity::getStatus, BillStatus.REPULSE.getStatus()).eq(ToaBillEntity::getId, billId));
|
|
1418
|
+ billService.update(Wrappers.lambdaUpdate(ToaBillEntity.class)
|
|
1419
|
+ .set(ToaBillEntity::getStatus, BillStatus.REPULSE.getStatus())
|
|
1420
|
+ .eq(ToaBillEntity::getId, billId));
|
1325
|
1421
|
BillTaskEntity createTask = billTaskService.findCreateTaskByBill(billId);
|
1326
|
1422
|
if (Objects.isNull(createTask)) {
|
1327
|
1423
|
throw new RbException(StringPool.EMPTY, ProcessCode.PROCESS_ACTIVITI_ERROR);
|
1328
|
1424
|
}
|
1329
|
|
- final BillTaskEntity newBillTask = BeanUtil.sourceToTarget(createTask, BillTaskEntity.class);
|
|
1425
|
+ final BillTaskEntity newBillTask =
|
|
1426
|
+ BeanUtil.sourceToTarget(createTask, BillTaskEntity.class);
|
1330
|
1427
|
newBillTask.setId(IdWorker.getId());
|
1331
|
1428
|
newBillTask.setSourceTaskId(task.getId());
|
1332
|
1429
|
newBillTask.setSourceUserCode(userCode);
|
|
@@ -1353,9 +1450,14 @@ public class BillLogicImpl implements BillLogic {
|
1353
|
1450
|
* @param turnUser 移交用户
|
1354
|
1451
|
*/
|
1355
|
1452
|
@Override
|
1356
|
|
- public void turnUser(long billId, String taskId, String turnUser, String userCode, String opinion) {
|
1357
|
|
- List<BillTaskEntity> billTaskEntities = billTaskService.findApprovingByBillAndTaskId(billId, taskId);
|
1358
|
|
- Set<String> collect = billTaskEntities.stream().map(BillTaskEntity::getUserCode).collect(Collectors.toSet());
|
|
1453
|
+ public void turnUser(
|
|
1454
|
+ long billId, String taskId, String turnUser, String userCode, String opinion
|
|
1455
|
+ ) {
|
|
1456
|
+ List<BillTaskEntity> billTaskEntities =
|
|
1457
|
+ billTaskService.findApprovingByBillAndTaskId(billId, taskId);
|
|
1458
|
+ Set<String> collect = billTaskEntities.stream()
|
|
1459
|
+ .map(BillTaskEntity::getUserCode)
|
|
1460
|
+ .collect(Collectors.toSet());
|
1359
|
1461
|
// 更新移交
|
1360
|
1462
|
final List<String> split = StrUtil.split(turnUser, ',');
|
1361
|
1463
|
final Set<String> hashSet = new HashSet(split);
|
|
@@ -1376,7 +1478,8 @@ public class BillLogicImpl implements BillLogic {
|
1376
|
1478
|
|
1377
|
1479
|
List<BillTaskEntity> insertLists = Lists.newArrayList();
|
1378
|
1480
|
for (String s : hashSet) {
|
1379
|
|
- final BillTaskEntity turnTask = BeanUtil.sourceToTarget(task, BillTaskEntity.class);
|
|
1481
|
+ final BillTaskEntity turnTask =
|
|
1482
|
+ BeanUtil.sourceToTarget(task, BillTaskEntity.class);
|
1380
|
1483
|
turnTask.setSourceTaskId(task.getId());
|
1381
|
1484
|
turnTask.setSourceUserCode(userCode);
|
1382
|
1485
|
turnTask.setTaskType(BillTaskType.TURN.getValue());
|
|
@@ -1412,9 +1515,11 @@ public class BillLogicImpl implements BillLogic {
|
1412
|
1515
|
@Override
|
1413
|
1516
|
public BillDetailVO<List<FormFieldVO>> createByApp(long processId) {
|
1414
|
1517
|
ProcessDetailDTO process = checkProcess(processId);
|
1415
|
|
- final List<FormFieldVO> fieldVOS = formBasicConvert.FormFieldPOToVO(formFieldService.findVoByProcessId(processId));
|
|
1518
|
+ final List<FormFieldVO> fieldVOS =
|
|
1519
|
+ formBasicConvert.FormFieldPOToVO(formFieldService.findVoByProcessId(processId));
|
1416
|
1520
|
List<BillOpinionVO> opinionVOS = Lists.newArrayList();
|
1417
|
|
- String firstNodeId = nodeExtendService.findTaskNodeIdByProcessAndLinkType(processId, NodeLinkType.create);
|
|
1521
|
+ String firstNodeId = nodeExtendService.findTaskNodeIdByProcessAndLinkType(processId,
|
|
1522
|
+ NodeLinkType.create);
|
1418
|
1523
|
// 获取授权信息
|
1419
|
1524
|
final List<FormPermissionVO> permissionVOS;
|
1420
|
1525
|
permissionVOS = billBpmnLogic.nodeFieldPermission(processId, firstNodeId);
|
|
@@ -1445,8 +1550,11 @@ public class BillLogicImpl implements BillLogic {
|
1445
|
1550
|
* @return 验证结果
|
1446
|
1551
|
*/
|
1447
|
1552
|
@Override
|
1448
|
|
- public ValidationResultDTO validation(long processId, long billId, String formDataJson, String userCode) {
|
1449
|
|
- final Map<String, Object> dataMap = JSON.parseObject(formDataJson, FastJsonType.MAP_OBJECT_TR);
|
|
1553
|
+ public ValidationResultDTO validation(
|
|
1554
|
+ long processId, long billId, String formDataJson, String userCode
|
|
1555
|
+ ) {
|
|
1556
|
+ final Map<String, Object> dataMap =
|
|
1557
|
+ JSON.parseObject(formDataJson, FastJsonType.MAP_OBJECT_TR);
|
1450
|
1558
|
final BillDataContext billDataValue;
|
1451
|
1559
|
final ProcessDetailPO processDetail = this.processService.findDetailById(processId);
|
1452
|
1560
|
billDataValue = this.resolveFormDataByValidation(billId, processDetail, dataMap);
|
|
@@ -1464,19 +1572,24 @@ public class BillLogicImpl implements BillLogic {
|
1464
|
1572
|
*/
|
1465
|
1573
|
@Override
|
1466
|
1574
|
public List<String> getNodeCondition(long processId, long billId, String taskId) {
|
1467
|
|
- final List<BillTaskEntity> list = billTaskService.list(Wrappers.lambdaQuery(BillTaskEntity.class)
|
1468
|
|
- .eq(BillTaskEntity::getBillId, billId).eq(BillTaskEntity::getTaskId, taskId));
|
1469
|
|
- final Set<String> nodeKeys = list.stream().map(BillTaskEntity::getTaskNodeKey).collect(Collectors.toSet());
|
|
1575
|
+ final List<BillTaskEntity> list = billTaskService.list(
|
|
1576
|
+ Wrappers.lambdaQuery(BillTaskEntity.class)
|
|
1577
|
+ .eq(BillTaskEntity::getBillId, billId)
|
|
1578
|
+ .eq(BillTaskEntity::getTaskId, taskId));
|
|
1579
|
+ final Set<String> nodeKeys =
|
|
1580
|
+ list.stream().map(BillTaskEntity::getTaskNodeKey).collect(Collectors.toSet());
|
1470
|
1581
|
if (CollectionUtil.isEmpty(nodeKeys)) {
|
1471
|
1582
|
return Collections.emptyList();
|
1472
|
1583
|
}
|
1473
|
|
- final List<ProcessNodeApproverEntity> list1 = nodeApproverService
|
1474
|
|
- .list(Wrappers.lambdaQuery(ProcessNodeApproverEntity.class)
|
|
1584
|
+ final List<ProcessNodeApproverEntity> list1 = nodeApproverService.list(
|
|
1585
|
+ Wrappers.lambdaQuery(ProcessNodeApproverEntity.class)
|
1475
|
1586
|
.eq(ProcessNodeApproverEntity::getProcessId, processId)
|
1476
|
1587
|
.in(ProcessNodeApproverEntity::getNodeId, nodeKeys));
|
1477
|
|
- final List<String> params =
|
1478
|
|
- list1.stream().filter(a -> !Strings.isNullOrEmpty(a.getExpress()) && a.getExpress().indexOf("implication") != -1)
|
1479
|
|
- .map(ProcessNodeApproverEntity::getExpressParams).collect(Collectors.toList());
|
|
1588
|
+ final List<String> params = list1.stream()
|
|
1589
|
+ .filter(a -> !Strings.isNullOrEmpty(a.getExpress()) && a.getExpress()
|
|
1590
|
+ .indexOf("implication") != -1)
|
|
1591
|
+ .map(ProcessNodeApproverEntity::getExpressParams)
|
|
1592
|
+ .collect(Collectors.toList());
|
1480
|
1593
|
List<String> result = Lists.newArrayList();
|
1481
|
1594
|
for (String param : params) {
|
1482
|
1595
|
final JSONObject jsonObject = JSON.parseObject(param);
|
|
@@ -1500,23 +1613,26 @@ public class BillLogicImpl implements BillLogic {
|
1500
|
1613
|
*/
|
1501
|
1614
|
@Override
|
1502
|
1615
|
public String findTodoSize() {
|
1503
|
|
- List<Integer> statusList = Lists.newArrayList(
|
1504
|
|
- BillStatus.APPROVAL.getStatus(), BillStatus.REFUSE.getStatus()
|
1505
|
|
- );
|
|
1616
|
+ List<Integer> statusList =
|
|
1617
|
+ Lists.newArrayList(BillStatus.APPROVAL.getStatus(), BillStatus.REFUSE.getStatus());
|
1506
|
1618
|
final String userCode = loginUserHolder.getUserCode();
|
1507
|
1619
|
final String todoSize = this.billService.findTodoSizeByStatus(userCode, statusList);
|
1508
|
1620
|
return todoSize;
|
1509
|
1621
|
}
|
1510
|
1622
|
|
1511
|
1623
|
@Override
|
1512
|
|
- public Pair<List<BillItemVO>, Long> findAllByQuery(Integer pageNo, Integer pageSize, DraftBillQuery query) {
|
|
1624
|
+ public Pair<List<BillItemVO>, Long> findAllByQuery(
|
|
1625
|
+ Integer pageNo, Integer pageSize, DraftBillQuery query
|
|
1626
|
+ ) {
|
1513
|
1627
|
Page page = new Page(pageNo, pageSize);
|
1514
|
1628
|
final List<BillItemPO> billDatas = this.billService.findAllByQuery(page, query);
|
1515
|
1629
|
final Page<BillItemVO> billItemVOPage = toItemVOList(page, billDatas, null);
|
1516
|
1630
|
return Pair.of(billItemVOPage.getRecords(), billItemVOPage.getTotal());
|
1517
|
1631
|
}
|
1518
|
1632
|
|
1519
|
|
- private ValidationResultDTO validataionWithResult(BillDataContext billDataValue, String userCode, BillValidationLogic validationService) {
|
|
1633
|
+ private ValidationResultDTO validataionWithResult(
|
|
1634
|
+ BillDataContext billDataValue, String userCode, BillValidationLogic validationService
|
|
1635
|
+ ) {
|
1520
|
1636
|
|
1521
|
1637
|
if (null != validationService) {
|
1522
|
1638
|
return validationService.validation(billDataValue, userCode);
|
|
@@ -1539,9 +1655,7 @@ public class BillLogicImpl implements BillLogic {
|
1539
|
1655
|
|
1540
|
1656
|
@Transactional(readOnly = true, rollbackFor = Exception.class)
|
1541
|
1657
|
public BillDataContext resolveFormDataByValidation(
|
1542
|
|
- long billId,
|
1543
|
|
- ProcessDetailPO processDetail,
|
1544
|
|
- Map<String, Object> formDataMap
|
|
1658
|
+ long billId, ProcessDetailPO processDetail, Map<String, Object> formDataMap
|
1545
|
1659
|
) {
|
1546
|
1660
|
long processId = processDetail.getId();
|
1547
|
1661
|
|
|
@@ -1613,8 +1727,10 @@ public class BillLogicImpl implements BillLogic {
|
1613
|
1727
|
continue;
|
1614
|
1728
|
}
|
1615
|
1729
|
|
1616
|
|
- final Triple<Boolean, List<BillAssociatedVO>, List<BillBizDataEntity>> detailItemTriple;
|
1617
|
|
- detailItemTriple = billItemLogic.detailFormFileds(newBillId, detailgroupDatas, detailFields);
|
|
1730
|
+ final Triple<Boolean, List<BillAssociatedVO>, List<BillBizDataEntity>>
|
|
1731
|
+ detailItemTriple;
|
|
1732
|
+ detailItemTriple = billItemLogic.detailFormFileds(newBillId, detailgroupDatas,
|
|
1733
|
+ detailFields);
|
1618
|
1734
|
final Boolean attachment = detailItemTriple.getLeft();
|
1619
|
1735
|
if (attachment) {
|
1620
|
1736
|
dataValueBuilder.attachment(true);
|
|
@@ -1638,11 +1754,13 @@ public class BillLogicImpl implements BillLogic {
|
1638
|
1754
|
private List<BillOpinionVO> billOpinions(ToaBillEntity bill) {
|
1639
|
1755
|
long processId = MoreObjects.firstNonNull(bill.getProcessId(), 0L);
|
1640
|
1756
|
final List<BillOpinionVO> opinionVOS = Lists.newArrayList();
|
1641
|
|
- final List<ProcessNodeExtendEntity> taskNodes = nodeExtendService.findTaskNodeByProcess(processId);
|
|
1757
|
+ final List<ProcessNodeExtendEntity> taskNodes =
|
|
1758
|
+ nodeExtendService.findTaskNodeByProcess(processId);
|
1642
|
1759
|
if (CollectionUtil.isNotEmpty(taskNodes)) {
|
1643
|
1760
|
for (ProcessNodeExtendEntity taskNode : taskNodes) {
|
1644
|
1761
|
final String linkType = taskNode.getLinkType();
|
1645
|
|
- if (org.apache.commons.lang3.StringUtils.equals(linkType, NodeLinkType.approvl.name())) {
|
|
1762
|
+ if (org.apache.commons.lang3.StringUtils.equals(linkType,
|
|
1763
|
+ NodeLinkType.approvl.name())) {
|
1646
|
1764
|
BillOpinionVO billOpinionVO = new BillOpinionVO();
|
1647
|
1765
|
billOpinionVO.setTitle(taskNode.getNodeName());
|
1648
|
1766
|
opinionVOS.add(billOpinionVO);
|
|
@@ -1652,11 +1770,15 @@ public class BillLogicImpl implements BillLogic {
|
1652
|
1770
|
return opinionVOS;
|
1653
|
1771
|
}
|
1654
|
1772
|
|
1655
|
|
- private <T> BillDetailVO.BillDetailVOBuilder<T> billDetailBuilder(BillDataJsonEntity billDataJson, ToaBillEntity bill) {
|
|
1773
|
+ private <T> BillDetailVO.BillDetailVOBuilder<T> billDetailBuilder(
|
|
1774
|
+ BillDataJsonEntity billDataJson, ToaBillEntity bill
|
|
1775
|
+ ) {
|
1656
|
1776
|
return billDetailBuilder(billDataJson, bill, StringPool.EMPTY);
|
1657
|
1777
|
}
|
1658
|
1778
|
|
1659
|
|
- private <T> BillDetailVO.BillDetailVOBuilder<T> billDetailBuilder(BillDataJsonEntity billDataJson, ToaBillEntity bill, String page) {
|
|
1779
|
+ private <T> BillDetailVO.BillDetailVOBuilder<T> billDetailBuilder(
|
|
1780
|
+ BillDataJsonEntity billDataJson, ToaBillEntity bill, String page
|
|
1781
|
+ ) {
|
1660
|
1782
|
long billId = bill.getId();
|
1661
|
1783
|
long processId = bill.getProcessId();
|
1662
|
1784
|
final String userCode = loginUserHolder.getUserCode();
|
|
@@ -1710,8 +1832,9 @@ public class BillLogicImpl implements BillLogic {
|
1710
|
1832
|
for (FormPermissionVO permission : permissions) {
|
1711
|
1833
|
permission.setEdit(false);
|
1712
|
1834
|
}
|
1713
|
|
- } else if (!Strings.isNullOrEmpty(page)
|
1714
|
|
- && org.apache.commons.lang3.StringUtils.equalsAny(page, "cc", "approved")) {
|
|
1835
|
+ } else if (!Strings.isNullOrEmpty(
|
|
1836
|
+ page) && org.apache.commons.lang3.StringUtils.equalsAny(page, "cc",
|
|
1837
|
+ "approved")) {
|
1715
|
1838
|
// 来自我发起的列表和抄送我的列表,这个时候,所有的按钮权限应该都是不可编辑的
|
1716
|
1839
|
for (FormPermissionVO permission : permissions) {
|
1717
|
1840
|
permission.setEdit(false);
|
|
@@ -1722,7 +1845,8 @@ public class BillLogicImpl implements BillLogic {
|
1722
|
1845
|
}
|
1723
|
1846
|
case REFUSE_FILL_IN:
|
1724
|
1847
|
permissions = billBpmnLogic.findPermissionByProcessStartNode(processId);
|
1725
|
|
- if (CollectionUtil.isNotEmpty(permissions) && billStatus == BillStatus.COMPLETE) {
|
|
1848
|
+ if (CollectionUtil.isNotEmpty(
|
|
1849
|
+ permissions) && billStatus == BillStatus.COMPLETE) {
|
1726
|
1850
|
for (FormPermissionVO permission : permissions) {
|
1727
|
1851
|
permission.setEdit(false);
|
1728
|
1852
|
}
|
|
@@ -1742,7 +1866,8 @@ public class BillLogicImpl implements BillLogic {
|
1742
|
1866
|
}
|
1743
|
1867
|
}
|
1744
|
1868
|
}
|
1745
|
|
- Map<String, Object> formData = JSON.parseObject(billDataJson.getFormData(), FastJsonType.MAP_OBJECT_TR);
|
|
1869
|
+ Map<String, Object> formData =
|
|
1870
|
+ JSON.parseObject(billDataJson.getFormData(), FastJsonType.MAP_OBJECT_TR);
|
1746
|
1871
|
String title = StringPool.EMPTY;
|
1747
|
1872
|
if (!Strings.isNullOrEmpty(bill.getTitle())) {
|
1748
|
1873
|
title = bill.getTitle();
|
|
@@ -1759,7 +1884,9 @@ public class BillLogicImpl implements BillLogic {
|
1759
|
1884
|
* 需要对按钮进行过滤
|
1760
|
1885
|
*/
|
1761
|
1886
|
List<String> newBtns = billBtnLogic.filterByNode(billTask, btns);
|
1762
|
|
- detailBuilder.title(title).formData(formData).processId(processId)
|
|
1887
|
+ detailBuilder.title(title)
|
|
1888
|
+ .formData(formData)
|
|
1889
|
+ .processId(processId)
|
1763
|
1890
|
.billId(billId)
|
1764
|
1891
|
.permission(permissions)
|
1765
|
1892
|
.btns(newBtns);
|
|
@@ -1791,10 +1918,13 @@ public class BillLogicImpl implements BillLogic {
|
1791
|
1918
|
* @param title 审批标题
|
1792
|
1919
|
* @return 封装后的表单字段信息
|
1793
|
1920
|
*/
|
1794
|
|
- private Map<String, Object> bizFormData(ProcessDetailDTO process, UserInfoDTO userInfoDTO, String title) {
|
|
1921
|
+ private Map<String, Object> bizFormData(
|
|
1922
|
+ ProcessDetailDTO process, UserInfoDTO userInfoDTO, String title
|
|
1923
|
+ ) {
|
1795
|
1924
|
final long processId = process.getId();
|
1796
|
1925
|
final long processCodeId = Objects.isNull(process.getCodeId()) ? 0 : process.getCodeId();
|
1797
|
|
- final List<FormFieldEntity> bizFields = this.formFieldService.findBizFiled(processId, FormXtype.biz);
|
|
1926
|
+ final List<FormFieldEntity> bizFields =
|
|
1927
|
+ this.formFieldService.findBizFiled(processId, FormXtype.biz);
|
1798
|
1928
|
if (CollectionUtil.isEmpty(bizFields)) {
|
1799
|
1929
|
return Collections.emptyMap();
|
1800
|
1930
|
}
|
|
@@ -1824,7 +1954,8 @@ public class BillLogicImpl implements BillLogic {
|
1824
|
1954
|
if (!Objects.isNull(userInfoDTO)) {
|
1825
|
1955
|
final List<UserOrgDTO> orgs = userInfoDTO.getOrgs();
|
1826
|
1956
|
if (CollectionUtil.isNotEmpty(orgs)) {
|
1827
|
|
- final List<String> orgNames = orgs.stream().map(UserOrgDTO::getOrgName)
|
|
1957
|
+ final List<String> orgNames = orgs.stream()
|
|
1958
|
+ .map(UserOrgDTO::getOrgName)
|
1828
|
1959
|
.collect(Collectors.toList());
|
1829
|
1960
|
organizationName = StrUtil.join(",", orgNames);
|
1830
|
1961
|
}
|
|
@@ -1846,23 +1977,28 @@ public class BillLogicImpl implements BillLogic {
|
1846
|
1977
|
|
1847
|
1978
|
@Override
|
1848
|
1979
|
public List<ProcessTypeVO> findTodoCateSize() {
|
1849
|
|
- LambdaQueryWrapper<ProcessTypeEntity> wrapper = Wrappers.lambdaQuery(ProcessTypeEntity.class);
|
|
1980
|
+ LambdaQueryWrapper<ProcessTypeEntity> wrapper =
|
|
1981
|
+ Wrappers.lambdaQuery(ProcessTypeEntity.class);
|
1850
|
1982
|
|
1851
|
1983
|
List<ProcessTypeEntity> processTypes = this.processTypeService.list(wrapper);
|
1852
|
1984
|
if (CollectionUtil.isNotEmpty(processTypes)) {
|
1853
|
1985
|
int processTypeSize = processTypes.size();
|
1854
|
1986
|
List<ProcessTypeVO> types = Lists.newArrayListWithCapacity(processTypeSize);
|
1855
|
|
- List<Integer> statusList = Lists.newArrayList(new Integer[]{BillStatus.APPROVAL.getStatus(), BillStatus.REFUSE.getStatus()});
|
|
1987
|
+ List<Integer> statusList = Lists.newArrayList(
|
|
1988
|
+ new Integer[]{BillStatus.APPROVAL.getStatus(), BillStatus.REFUSE.getStatus()});
|
1856
|
1989
|
String userCode = this.loginUserHolder.getUserCode();
|
1857
|
|
- List<ProcessGridPO> todoCateSize = this.billService.findTodoCateSize(userCode, statusList);
|
|
1990
|
+ List<ProcessGridPO> todoCateSize =
|
|
1991
|
+ this.billService.findTodoCateSize(userCode, statusList);
|
1858
|
1992
|
List<ProcessVO> processVOS = this.processBasicConvert.processGridPOToVO(todoCateSize);
|
1859
|
|
- Map<Long, List<ProcessVO>> collect = (Map)processVOS.stream().collect(Collectors.groupingBy(ProcessVO::getTypeId));
|
|
1993
|
+ Map<Long, List<ProcessVO>> collect =
|
|
1994
|
+ (Map) processVOS.stream().collect(Collectors.groupingBy(ProcessVO::getTypeId));
|
1860
|
1995
|
|
1861
|
1996
|
ProcessTypeVO processTypeVO;
|
1862
|
|
- for(Iterator var10 = processTypes.iterator(); var10.hasNext(); types.add(processTypeVO)) {
|
1863
|
|
- ProcessTypeEntity processType = (ProcessTypeEntity)var10.next();
|
|
1997
|
+ for (Iterator var10 = processTypes.iterator(); var10.hasNext(); types.add(
|
|
1998
|
+ processTypeVO)) {
|
|
1999
|
+ ProcessTypeEntity processType = (ProcessTypeEntity) var10.next();
|
1864
|
2000
|
Long id = processType.getId();
|
1865
|
|
- List<ProcessVO> processVOS1 = (List)collect.get(id);
|
|
2001
|
+ List<ProcessVO> processVOS1 = (List) collect.get(id);
|
1866
|
2002
|
processTypeVO = new ProcessTypeVO();
|
1867
|
2003
|
processTypeVO.setName(processType.getName());
|
1868
|
2004
|
processTypeVO.setId(processType.getId());
|