From 6317a4f3610171c38bfc9251736450d37e3489f3 Mon Sep 17 00:00:00 2001 From: LesanOuO <1960681385@qq.com> Date: Wed, 22 Jan 2025 09:52:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E8=87=AA=E5=8A=A8=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/bpm/enums/definition/BpmAutoApproveType.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmAutoApproveType.java b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmAutoApproveType.java index add4529ad3..c224bf5f3c 100644 --- a/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmAutoApproveType.java +++ b/yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/enums/definition/BpmAutoApproveType.java @@ -15,10 +15,9 @@ import java.util.Arrays; @AllArgsConstructor public enum BpmAutoApproveType implements IntArrayValuable { - // TODO @lesan:0、1、/2 会不会好理解一点哈。 - NONE(1, "不自动通过"), - APPROVE_ALL(2, "仅审批一次,后续重复的审批节点均自动通过"), - APPROVE_SEQUENT(3, "仅针对连续审批的节点自动通过"); + NONE(0, "不自动通过"), + APPROVE_ALL(1, "仅审批一次,后续重复的审批节点均自动通过"), + APPROVE_SEQUENT(2, "仅针对连续审批的节点自动通过"); public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmAutoApproveType::getType).toArray(); From e548d4454ebcd3e5c8ab80e25088a0121a4a0ec1 Mon Sep 17 00:00:00 2001 From: LesanOuO <1960681385@qq.com> Date: Wed, 22 Jan 2025 10:08:58 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bpm/service/task/BpmTaskServiceImpl.java | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) 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 ce1e029e3a..1bcb7ad8b9 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 @@ -62,8 +62,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG; -import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseReasonRequire; -import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseSignEnable; +import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.*; /** * 流程任务实例 Service 实现类 @@ -1197,17 +1196,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { log.error("[processTaskAssigned][taskId({}) 没有找到流程模型({})]", task.getId(), task.getProcessDefinitionId()); return; } - // TODO @lesan:这里的逻辑,要不在 BpmnModelUtils 抽个方法???尽量收敛 - FlowNode taskElement = (FlowNode) BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey()); - List incomingFlows = taskElement.getIncomingFlows(); - List sourceTaskIds = new ArrayList<>(); - // TODO @lesan:这种 CollUtil.isnotempty 简化 - if (incomingFlows != null && !incomingFlows.isEmpty()) { - // TODO @lesan:这种,idea 一般会告警,可以处理掉哈。一切警告,皆是错误 - incomingFlows.forEach(flow -> { - sourceTaskIds.add(flow.getSourceRef()); - }); - } + List sourceTaskIds = getElementIncomingFlows(getFlowElementById(bpmnModel, task.getTaskDefinitionKey())) + .stream().map(SequenceFlow::getSourceRef).toList(); if (sameAssigneeQuery.taskDefinitionKeys(sourceTaskIds).count() > 0) { getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId()) .setReason(BpmAutoApproveType.APPROVE_SEQUENT.getName()));