Commit be608b26e674ecaa0c79fc3ac239cb38fd1ba4f3
1 parent
c9690e14
review: 代码重构
Showing
1 changed file
with
4 additions
and
9 deletions
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/definition/BpmModelServiceImpl.java
| @@ -248,16 +248,11 @@ public class BpmModelServiceImpl implements BpmModelService { | @@ -248,16 +248,11 @@ public class BpmModelServiceImpl implements BpmModelService { | ||
| 248 | throw exception(MODEL_DEPLOY_FAIL_BPMN_USER_TASK_NAME_NOT_EXISTS, userTask.getId()); | 248 | throw exception(MODEL_DEPLOY_FAIL_BPMN_USER_TASK_NAME_NOT_EXISTS, userTask.getId()); |
| 249 | } | 249 | } |
| 250 | }); | 250 | }); |
| 251 | - // TODO @小北:是不是可以 UserTask firUserTask = CollUtil.get(userTasks, BpmModelTypeEnum.BPMN.getType().equals(type) ? 0 : 1);然后,最好判空。。。极端情况下,没 usertask ,哈哈哈哈。 | ||
| 252 | - // 3. 校验第一个用户任务节点的规则类型是否为“审批人自选” | ||
| 253 | - Map<Integer, UserTask> userTaskMap = new HashMap<>(); | ||
| 254 | - // BPMN 设计器,校验第一个用户任务节点 | ||
| 255 | - userTaskMap.put(BpmModelTypeEnum.BPMN.getType(), userTasks.get(0)); | ||
| 256 | - // SIMPLE 设计器,第一个节点固定为发起人所以校验第二个用户任务节点 | ||
| 257 | - userTaskMap.put(BpmModelTypeEnum.SIMPLE.getType(), userTasks.get(1)); | ||
| 258 | - Integer candidateStrategy = parseCandidateStrategy(userTaskMap.get(type)); | 251 | + // 3. 校验第一个用户任务节点的规则类型是否为“审批人自选”,BPMN 设计器,校验第一个用户任务节点,SIMPLE 设计器,第一个节点固定为发起人所以校验第二个用户任务节点 |
| 252 | + UserTask firUserTask = CollUtil.get(userTasks, BpmModelTypeEnum.BPMN.getType().equals(type) ? 0 : 1); | ||
| 253 | + Integer candidateStrategy = parseCandidateStrategy(firUserTask); | ||
| 259 | if (Objects.equals(candidateStrategy, BpmTaskCandidateStrategyEnum.APPROVE_USER_SELECT.getStrategy())) { | 254 | if (Objects.equals(candidateStrategy, BpmTaskCandidateStrategyEnum.APPROVE_USER_SELECT.getStrategy())) { |
| 260 | - throw exception(MODEL_DEPLOY_FAIL_FIRST_USER_TASK_CANDIDATE_STRATEGY_ERROR, userTaskMap.get(type).getName()); | 255 | + throw exception(MODEL_DEPLOY_FAIL_FIRST_USER_TASK_CANDIDATE_STRATEGY_ERROR, firUserTask.getName()); |
| 261 | } | 256 | } |
| 262 | } | 257 | } |
| 263 | 258 |