From b0fe72d73513022e4ce7d9cfecc3813dd5e932a5 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 12 Jun 2024 20:23:16 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E3=80=91BPM=EF=BC=9A=E4=BC=9A=E7=AD=BE=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E7=9A=84=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java | 1 + .../core/custom/delegate/MultiInstanceServiceTaskDelegate.java | 2 ++ .../core/custom/expression/CompleteByRejectCountExpression.java | 2 ++ .../yudao/module/bpm/service/task/BpmTaskServiceImpl.java | 1 + 4 files changed, 6 insertions(+) diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java index f226ce2c35..38193175ea 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/simple/BpmSimpleModelNodeVO.java @@ -49,6 +49,7 @@ public class BpmSimpleModelNodeVO { */ @JsonIgnore private String attachNodeId; + // Map formPermissions; 表单权限;仅发起、审批、抄送节点会使用 // Integer approveMethod; 审批方式;仅审批节点会使用 // TODO @jason 后面和前端一起调整一下 diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/custom/delegate/MultiInstanceServiceTaskDelegate.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/custom/delegate/MultiInstanceServiceTaskDelegate.java index 958c0b14e4..9c24828355 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/custom/delegate/MultiInstanceServiceTaskDelegate.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/custom/delegate/MultiInstanceServiceTaskDelegate.java @@ -30,6 +30,8 @@ public class MultiInstanceServiceTaskDelegate implements JavaDelegate { // 获取会签任务是否被拒绝 Boolean userTaskRejected = execution.getVariable(String.format("%s_reject", attachUserTaskId), Boolean.class); // 如果会签任务被拒绝, 终止流程 + // TODO @jason:【重要】需要测试下,如果基于 createChangeActivityStateBuilder()、changeState 到结束节点,实现审批不通过; + // 注意:需要考虑 bpmn 的高亮问题;(不过这个,未来可能会废弃掉!) if (BooleanUtil.isTrue(userTaskRejected)) { processInstanceService.updateProcessInstanceReject(execution.getProcessInstanceId(), BpmCommentTypeEnum.REJECT.formatComment("会签任务拒绝人数满足条件")); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/custom/expression/CompleteByRejectCountExpression.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/custom/expression/CompleteByRejectCountExpression.java index 7208c96b75..14328a39db 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/custom/expression/CompleteByRejectCountExpression.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/framework/flowable/core/custom/expression/CompleteByRejectCountExpression.java @@ -42,6 +42,7 @@ public class CompleteByRejectCountExpression { Integer approveMethod = NumberUtils.parseInt(BpmnModelUtils.parseExtensionElement(flowElement, USER_TASK_APPROVE_METHOD)); Assert.notNull(approveMethod, "审批方式不能空"); // 计算拒绝的人数 + // TODO @jason:CollUtil.filter().size();貌似可以更简洁 Integer rejectCount = CollectionUtils.getSumValue(execution.getExecutions(), item -> Objects.equals(BpmTaskStatusEnum.REJECT.getStatus(), item.getVariableLocal(BpmConstants.TASK_VARIABLE_STATUS, Integer.class)) ? 1 : 0, Integer::sum, 0); @@ -81,4 +82,5 @@ public class CompleteByRejectCountExpression { log.error("[completionCondition] 按拒绝人数计算会签的完成条件的审批方式[{}],配置有误", approveMethod); throw exception(GlobalErrorCodeConstants.ERROR_CONFIGURATION); } + } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java index 13e696f6a6..5caaaf3de5 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java @@ -353,6 +353,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { return; } else if (userTaskRejectHandlerType == BpmUserTaskRejectHandlerType.FINISH_PROCESS_BY_REJECT_NUMBER) { // 3.3 按拒绝人数终止流程 + // TODO @jason:建议抛出系统异常。类似 throw new IllegalStateException() if (!flowElement.hasMultiInstanceLoopCharacteristics()) { log.error("[rejectTask] 用户任务拒绝处理类型配置错误, 按拒绝人数终止流程只能用于会签任务"); throw exception(GlobalErrorCodeConstants.ERROR_CONFIGURATION);