Commit e548d4454ebcd3e5c8ab80e25088a0121a4a0ec1
1 parent
6317a4f3
fix: 优化代码逻辑
Showing
1 changed file
with
3 additions
and
13 deletions
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,8 +62,7 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU | ||
| 62 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | 62 | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| 63 | import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; | 63 | import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; |
| 64 | import static cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_RETURN_FLAG; | 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 | * 流程任务实例 Service 实现类 | 68 | * 流程任务实例 Service 实现类 |
| @@ -1197,17 +1196,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { | @@ -1197,17 +1196,8 @@ public class BpmTaskServiceImpl implements BpmTaskService { | ||
| 1197 | log.error("[processTaskAssigned][taskId({}) 没有找到流程模型({})]", task.getId(), task.getProcessDefinitionId()); | 1196 | log.error("[processTaskAssigned][taskId({}) 没有找到流程模型({})]", task.getId(), task.getProcessDefinitionId()); |
| 1198 | return; | 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 | if (sameAssigneeQuery.taskDefinitionKeys(sourceTaskIds).count() > 0) { | 1201 | if (sameAssigneeQuery.taskDefinitionKeys(sourceTaskIds).count() > 0) { |
| 1212 | getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId()) | 1202 | getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId()) |
| 1213 | .setReason(BpmAutoApproveType.APPROVE_SEQUENT.getName())); | 1203 | .setReason(BpmAutoApproveType.APPROVE_SEQUENT.getName())); |