Commit 808f23ec490e97a610bcd3b7ec1b721fcc237059
Committed by
Gitee
!1204 BPM:更多设置-自动去重
Merge pull request !1204 from Lesan/feature/bpm-自动去重
Showing
2 changed files
with
6 additions
and
17 deletions
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; |
| 15 | 15 | @AllArgsConstructor |
| 16 | 16 | public enum BpmAutoApproveType implements IntArrayValuable { |
| 17 | 17 | |
| 18 | - // TODO @lesan:0、1、/2 会不会好理解一点哈。 | |
| 19 | - NONE(1, "不自动通过"), | |
| 20 | - APPROVE_ALL(2, "仅审批一次,后续重复的审批节点均自动通过"), | |
| 21 | - APPROVE_SEQUENT(3, "仅针对连续审批的节点自动通过"); | |
| 18 | + NONE(0, "不自动通过"), | |
| 19 | + APPROVE_ALL(1, "仅审批一次,后续重复的审批节点均自动通过"), | |
| 20 | + APPROVE_SEQUENT(2, "仅针对连续审批的节点自动通过"); | |
| 22 | 21 | |
| 23 | 22 | public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BpmAutoApproveType::getType).toArray(); |
| 24 | 23 | ... | ... |
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 |
| 62 | 62 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| 63 | 63 | import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; |
| 64 | 64 | import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG; |
| 65 | -import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseReasonRequire; | |
| 66 | -import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.parseSignEnable; | |
| 65 | +import static cn.iocoder.yudao.module.bpm.framework.flowable.core.util.BpmnModelUtils.*; | |
| 67 | 66 | |
| 68 | 67 | /** |
| 69 | 68 | * 流程任务实例 Service 实现类 |
| ... | ... | @@ -1197,17 +1196,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { |
| 1197 | 1196 | log.error("[processTaskAssigned][taskId({}) 没有找到流程模型({})]", task.getId(), task.getProcessDefinitionId()); |
| 1198 | 1197 | return; |
| 1199 | 1198 | } |
| 1200 | - // TODO @lesan:这里的逻辑,要不在 BpmnModelUtils 抽个方法???尽量收敛 | |
| 1201 | - FlowNode taskElement = (FlowNode) BpmnModelUtils.getFlowElementById(bpmnModel, task.getTaskDefinitionKey()); | |
| 1202 | - List<SequenceFlow> incomingFlows = taskElement.getIncomingFlows(); | |
| 1203 | - List<String> sourceTaskIds = new ArrayList<>(); | |
| 1204 | - // TODO @lesan:这种 CollUtil.isnotempty 简化 | |
| 1205 | - if (incomingFlows != null && !incomingFlows.isEmpty()) { | |
| 1206 | - // TODO @lesan:这种,idea 一般会告警,可以处理掉哈。一切警告,皆是错误 | |
| 1207 | - incomingFlows.forEach(flow -> { | |
| 1208 | - sourceTaskIds.add(flow.getSourceRef()); | |
| 1209 | - }); | |
| 1210 | - } | |
| 1199 | + List<String> sourceTaskIds = getElementIncomingFlows(getFlowElementById(bpmnModel, task.getTaskDefinitionKey())) | |
| 1200 | + .stream().map(SequenceFlow::getSourceRef).toList(); | |
| 1211 | 1201 | if (sameAssigneeQuery.taskDefinitionKeys(sourceTaskIds).count() > 0) { |
| 1212 | 1202 | getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId()) |
| 1213 | 1203 | .setReason(BpmAutoApproveType.APPROVE_SEQUENT.getName())); | ... | ... |