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

This commit is contained in:
lizhixian 2025-02-18 14:13:49 +08:00
parent 1f6f00164a
commit 23ed5b780f
3 changed files with 6 additions and 14 deletions

View File

@ -41,9 +41,4 @@ public class BpmProcessInstanceCreateReqDTO {
*/
private Map<String, List<Long>> startUserSelectAssignees;
/**
* 活动节点列表 createProcessInstance弃用时可移除
*/
private List<String> nodeIds;
}

View File

@ -21,7 +21,4 @@ public class BpmProcessInstanceCreateReqVO {
@Schema(description = "发起人自选审批人 Map", example = "{taskKey1: [1, 2]}")
private Map<String, List<Long>> startUserSelectAssignees;
@Schema(description = "活动节点列表", requiredMode = Schema.RequiredMode.REQUIRED)
private List<String> nodeIds;
}

View File

@ -612,7 +612,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
.getProcessDefinition(createReqVO.getProcessDefinitionId());
// 发起流程
return createProcessInstance0(userId, definition, createReqVO.getVariables(), null,
createReqVO.getStartUserSelectAssignees(), createReqVO.getNodeIds());
createReqVO.getStartUserSelectAssignees());
}
@Override
@ -624,13 +624,13 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
// 发起流程
return createProcessInstance0(userId, definition, createReqDTO.getVariables(),
createReqDTO.getBusinessKey(),
createReqDTO.getStartUserSelectAssignees(),createReqDTO.getNodeIds());
createReqDTO.getStartUserSelectAssignees());
});
}
private String createProcessInstance0(Long userId, ProcessDefinition definition,
Map<String, Object> variables, String businessKey,
Map<String, List<Long>> startUserSelectAssignees, List<String> nodeIds) {
Map<String, List<Long>> startUserSelectAssignees) {
// 1.1 校验流程定义
if (definition == null) {
throw exception(PROCESS_DEFINITION_NOT_EXISTS);
@ -648,7 +648,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
throw exception(PROCESS_INSTANCE_START_USER_CAN_START);
}
// 1.3 校验发起人自选审批人
validateStartUserSelectAssignees(definition, startUserSelectAssignees, nodeIds);
validateStartUserSelectAssignees(definition, startUserSelectAssignees);
// 2. 创建流程实例
if (variables == null) {
@ -694,7 +694,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
}
private void validateStartUserSelectAssignees(ProcessDefinition definition,
Map<String, List<Long>> startUserSelectAssignees, List<String> nodeIds) {
Map<String, List<Long>> startUserSelectAssignees) {
// 1. 获得发起人自选审批人的 UserTask/ServiceTask 列表
BpmnModel bpmnModel = processDefinitionService.getProcessDefinitionBpmnModel(definition.getId());
List<Task> tasks = BpmTaskCandidateStartUserSelectStrategy.getStartUserSelectTaskList(bpmnModel);
@ -703,7 +703,7 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
}
// 2. 流程发起时要先获取当前流程的预测走向节点发起时只校验预测的节点发起人自选审批人的审批人和抄送人是否都配置了
tasks.stream().filter(task -> nodeIds == null || nodeIds.contains(task.getId())).forEach(task -> {
tasks.forEach(task -> {
List<Long> assignees = startUserSelectAssignees != null ? startUserSelectAssignees.get(task.getId()) : null;
if (CollUtil.isEmpty(assignees)) {
throw exception(PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_CONFIG, task.getName());