Pre Merge pull request !174 from 今晚打老虎/master-jdk17
commit
fbc8c29ce3
|
@ -51,10 +51,14 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand
|
|||
ProcessInstance processInstance = processInstanceService.getProcessInstance(execution.getProcessInstanceId());
|
||||
Assert.notNull(processInstance, "流程实例({})不能为空", execution.getProcessInstanceId());
|
||||
Map<String, List<Long>> startUserSelectAssignees = FlowableUtils.getStartUserSelectAssignees(processInstance);
|
||||
Assert.notNull(startUserSelectAssignees, "流程实例({}) 的发起人自选审批人不能为空",
|
||||
execution.getProcessInstanceId());
|
||||
if (startUserSelectAssignees == null) {
|
||||
return Sets.newLinkedHashSet();
|
||||
}
|
||||
// 获得审批人
|
||||
List<Long> assignees = startUserSelectAssignees.get(execution.getCurrentActivityId());
|
||||
if (CollUtil.isEmpty(assignees)){
|
||||
return Sets.newLinkedHashSet();
|
||||
}
|
||||
return new LinkedHashSet<>(assignees);
|
||||
}
|
||||
|
||||
|
@ -70,6 +74,9 @@ public class BpmTaskCandidateStartUserSelectStrategy extends AbstractBpmTaskCand
|
|||
}
|
||||
// 获得审批人
|
||||
List<Long> assignees = startUserSelectAssignees.get(activityId);
|
||||
if (CollUtil.isEmpty(assignees)){
|
||||
return Sets.newLinkedHashSet();
|
||||
}
|
||||
return new LinkedHashSet<>(assignees);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum;
|
|||
import cn.iocoder.yudao.module.bpm.enums.task.BpmReasonEnum;
|
||||
import cn.iocoder.yudao.module.bpm.enums.task.BpmTaskStatusEnum;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.BpmTaskCandidateInvoker;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.candidate.strategy.dept.BpmTaskCandidateStartUserSelectStrategy;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnModelConstants;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.enums.BpmnVariableConstants;
|
||||
import cn.iocoder.yudao.module.bpm.framework.flowable.core.event.BpmProcessInstanceEventPublisher;
|
||||
|
@ -642,8 +641,6 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
|||
if (!processDefinitionService.canUserStartProcessDefinition(processDefinitionInfo, userId)) {
|
||||
throw exception(PROCESS_INSTANCE_START_USER_CAN_START);
|
||||
}
|
||||
// 1.3 校验发起人自选审批人
|
||||
validateStartUserSelectAssignees(definition, startUserSelectAssignees);
|
||||
|
||||
// 2. 创建流程实例
|
||||
if (variables == null) {
|
||||
|
@ -688,29 +685,6 @@ public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService
|
|||
return instance.getId();
|
||||
}
|
||||
|
||||
private void validateStartUserSelectAssignees(ProcessDefinition definition,
|
||||
Map<String, List<Long>> startUserSelectAssignees) {
|
||||
// 1. 获得发起人自选审批人的 UserTask/ServiceTask 列表
|
||||
BpmnModel bpmnModel = processDefinitionService.getProcessDefinitionBpmnModel(definition.getId());
|
||||
List<Task> tasks = BpmTaskCandidateStartUserSelectStrategy.getStartUserSelectTaskList(bpmnModel);
|
||||
if (CollUtil.isEmpty(tasks)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 校验发起人自选审批人的审批人和抄送人是否都配置了
|
||||
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());
|
||||
}
|
||||
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(assignees);
|
||||
assignees.forEach(assignee -> {
|
||||
if (userMap.get(assignee) == null) {
|
||||
throw exception(PROCESS_INSTANCE_START_USER_SELECT_ASSIGNEES_NOT_EXISTS, task.getName(), assignee);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelProcessInstanceByStartUser(Long userId, @Valid BpmProcessInstanceCancelReqVO cancelReqVO) {
|
||||
|
|
Loading…
Reference in New Issue