feat: 审批时查询下一个节点的类型是否为自选审批人是否已选择了审批人,否则由前端传递

This commit is contained in:
smallNorthLee 2025-02-24 22:56:18 +08:00
parent 45a72f4cd8
commit e11529375e
3 changed files with 8 additions and 4 deletions

View File

@ -24,7 +24,7 @@ public class BpmTaskApproveReqVO {
@Schema(description = "变量实例(动态表单)", requiredMode = Schema.RequiredMode.REQUIRED)
private Map<String, Object> variables;
@Schema(description = "节点审批人", example = "[1,2]")
private List<Long> assignees;
@Schema(description = "发起人自选审批人 Map", example = "{taskKey1: [1, 2]}")
private Map<String, List<Long>> startUserSelectAssignees;
}

View File

@ -56,7 +56,7 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand
// 获得审批人如果不存在则直接返回空避免类型转换异常
List<Long> assignees = startUserSelectAssignees.get(execution.getCurrentActivityId());
if (CollUtil.isEmpty(assignees)){
return null;
return Sets.newLinkedHashSet();
}
return new LinkedHashSet<>(assignees);
}
@ -74,7 +74,7 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand
// 获得审批人如果不存在则直接返回空避免类型转换异常
List<Long> assignees = startUserSelectAssignees.get(activityId);
if (CollUtil.isEmpty(assignees)){
return null;
return Sets.newLinkedHashSet();
}
return new LinkedHashSet<>(assignees);
}

View File

@ -520,6 +520,10 @@ public class BpmTaskServiceImpl implements BpmTaskService {
if (CollUtil.isNotEmpty(reqVO.getVariables())) {
Map<String, Object> variables = FlowableUtils.filterTaskFormVariable(reqVO.getVariables());
// 修改表单的值需要存储到 ProcessInstance 变量
if (CollUtil.isNotEmpty(reqVO.getStartUserSelectAssignees())) {
variables.put(BpmnVariableConstants.PROCESS_INSTANCE_VARIABLE_START_USER_SELECT_ASSIGNEES,
reqVO.getStartUserSelectAssignees());
}
runtimeService.setVariables(task.getProcessInstanceId(), variables);
taskService.complete(task.getId(), variables, true);
} else {