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