Commit 23ed5b780f88ecc171ca7388e75330cf0488d8e3

Authored by lizhixian
1 parent 1f6f0016

fix: 移除节点参数,预测节点审批人是否配置在后端逻辑中实现

yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/task/dto/BpmProcessInstanceCreateReqDTO.java
... ... @@ -41,9 +41,4 @@ public class BpmProcessInstanceCreateReqDTO {
41 41 */
42 42 private Map<String, List<Long>> startUserSelectAssignees;
43 43  
44   - /**
45   - * 活动节点列表 createProcessInstance弃用时可移除
46   - */
47   - private List<String> nodeIds;
48   -
49 44 }
... ...
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceCreateReqVO.java
... ... @@ -21,7 +21,4 @@ public class BpmProcessInstanceCreateReqVO {
21 21 @Schema(description = "发起人自选审批人 Map", example = "{taskKey1: [1, 2]}")
22 22 private Map<String, List<Long>> startUserSelectAssignees;
23 23  
24   - @Schema(description = "活动节点列表", requiredMode = Schema.RequiredMode.REQUIRED)
25   - private List<String> nodeIds;
26   -
27 24 }
... ...
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java
... ... @@ -612,7 +612,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
612 612 .getProcessDefinition(createReqVO.getProcessDefinitionId());
613 613 // 发起流程
614 614 return createProcessInstance0(userId, definition, createReqVO.getVariables(), null,
615   - createReqVO.getStartUserSelectAssignees(), createReqVO.getNodeIds());
  615 + createReqVO.getStartUserSelectAssignees());
616 616 }
617 617  
618 618 @Override
... ... @@ -624,13 +624,13 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
624 624 // 发起流程
625 625 return createProcessInstance0(userId, definition, createReqDTO.getVariables(),
626 626 createReqDTO.getBusinessKey(),
627   - createReqDTO.getStartUserSelectAssignees(),createReqDTO.getNodeIds());
  627 + createReqDTO.getStartUserSelectAssignees());
628 628 });
629 629 }
630 630  
631 631 private String createProcessInstance0(Long userId, ProcessDefinition definition,
632 632 Map<String, Object> variables, String businessKey,
633   - Map<String, List<Long>> startUserSelectAssignees, List<String> nodeIds) {
  633 + Map<String, List<Long>> startUserSelectAssignees) {
634 634 // 1.1 校验流程定义
635 635 if (definition == null) {
636 636 throw exception(PROCESS_DEFINITION_NOT_EXISTS);
... ... @@ -648,7 +648,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
648 648 throw exception(PROCESS_INSTANCE_START_USER_CAN_START);
649 649 }
650 650 // 1.3 校验发起人自选审批人
651   - validateStartUserSelectAssignees(definition, startUserSelectAssignees, nodeIds);
  651 + validateStartUserSelectAssignees(definition, startUserSelectAssignees);
652 652  
653 653 // 2. 创建流程实例
654 654 if (variables == null) {
... ... @@ -694,7 +694,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
694 694 }
695 695  
696 696 private void validateStartUserSelectAssignees(ProcessDefinition definition,
697   - Map<String, List<Long>> startUserSelectAssignees, List<String> nodeIds) {
  697 + Map<String, List<Long>> startUserSelectAssignees) {
698 698 // 1. 获得发起人自选审批人的 UserTask/ServiceTask 列表
699 699 BpmnModel bpmnModel = processDefinitionService.getProcessDefinitionBpmnModel(definition.getId());
700 700 List<Task> tasks = BpmTaskCandidateStartUserSelectStrategy.getStartUserSelectTaskList(bpmnModel);
... ... @@ -703,7 +703,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
703 703 }
704 704  
705 705 // 2. 流程发起时要先获取当前流程的预测走向节点,发起时只校验预测的节点发起人自选审批人的审批人和抄送人是否都配置了
706   - tasks.stream().filter(task -> nodeIds == null || nodeIds.contains(task.getId())).forEach(task -> {
  706 + tasks.forEach(task -> {
707 707 List<Long> assignees = startUserSelectAssignees != null ? startUserSelectAssignees.get(task.getId()) : null;
708 708 if (CollUtil.isEmpty(assignees)) {
709 709 throw exception(PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG, task.getName());
... ...