mirror of
https://github.com/YunaiV/ruoyi-vue-pro.git
synced 2025-10-27 11:46:05 +08:00
fix:【BPM 工作流】bpmn subProcess 存在 userTask NPE 的问题
This commit is contained in:
@ -18,10 +18,7 @@ import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|||||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.flowable.bpmn.model.BpmnModel;
|
import org.flowable.bpmn.model.*;
|
||||||
import org.flowable.bpmn.model.CallActivity;
|
|
||||||
import org.flowable.bpmn.model.FlowElement;
|
|
||||||
import org.flowable.bpmn.model.UserTask;
|
|
||||||
import org.flowable.engine.delegate.DelegateExecution;
|
import org.flowable.engine.delegate.DelegateExecution;
|
||||||
import org.flowable.engine.runtime.ProcessInstance;
|
import org.flowable.engine.runtime.ProcessInstance;
|
||||||
|
|
||||||
@ -132,7 +129,7 @@ public class BpmTaskCandidateInvoker {
|
|||||||
Long startUserId, String processDefinitionId, Map<String, Object> processVariables) {
|
Long startUserId, String processDefinitionId, Map<String, Object> processVariables) {
|
||||||
// 如果是 CallActivity 子流程,不进行计算候选人
|
// 如果是 CallActivity 子流程,不进行计算候选人
|
||||||
FlowElement flowElement = BpmnModelUtils.getFlowElementById(bpmnModel, activityId);
|
FlowElement flowElement = BpmnModelUtils.getFlowElementById(bpmnModel, activityId);
|
||||||
if (flowElement instanceof CallActivity) {
|
if (flowElement instanceof CallActivity || flowElement instanceof SubProcess) {
|
||||||
return new HashSet<>();
|
return new HashSet<>();
|
||||||
}
|
}
|
||||||
// 审批类型非人工审核时,不进行计算候选人。原因是:后续会自动通过、不通过
|
// 审批类型非人工审核时,不进行计算候选人。原因是:后续会自动通过、不通过
|
||||||
|
|||||||
@ -478,7 +478,11 @@ public class BpmnModelUtils {
|
|||||||
*/
|
*/
|
||||||
public static FlowElement getFlowElementById(BpmnModel model, String flowElementId) {
|
public static FlowElement getFlowElementById(BpmnModel model, String flowElementId) {
|
||||||
Process process = model.getMainProcess();
|
Process process = model.getMainProcess();
|
||||||
return process.getFlowElement(flowElementId);
|
FlowElement flowElement = process.getFlowElement(flowElementId);
|
||||||
|
if (flowElement != null) {
|
||||||
|
return flowElement;
|
||||||
|
}
|
||||||
|
return model.getFlowElement(flowElementId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1379,7 +1379,7 @@ public class BpmTaskServiceImpl implements BpmTaskService {
|
|||||||
PROCESS_INSTANCE_VARIABLE_SKIP_START_USER_NODE, String.class));
|
PROCESS_INSTANCE_VARIABLE_SKIP_START_USER_NODE, String.class));
|
||||||
if (userTaskElement.getId().equals(START_USER_NODE_ID)
|
if (userTaskElement.getId().equals(START_USER_NODE_ID)
|
||||||
&& (skipStartUserNodeFlag == null // 目的:一般是“主流程”,发起人节点,自动通过审核
|
&& (skipStartUserNodeFlag == null // 目的:一般是“主流程”,发起人节点,自动通过审核
|
||||||
|| Boolean.TRUE.equals(skipStartUserNodeFlag)) // 目的:一般是“子流程”,发起人节点,按配置自动通过审核
|
|| BooleanUtil.isTrue(skipStartUserNodeFlag)) // 目的:一般是“子流程”,发起人节点,按配置自动通过审核
|
||||||
&& ObjUtil.notEqual(returnTaskFlag, Boolean.TRUE)) {
|
&& ObjUtil.notEqual(returnTaskFlag, Boolean.TRUE)) {
|
||||||
getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId())
|
getSelf().approveTask(Long.valueOf(task.getAssignee()), new BpmTaskApproveReqVO().setId(task.getId())
|
||||||
.setReason(BpmReasonEnum.ASSIGN_START_USER_APPROVE_WHEN_SKIP_START_USER_NODE.getReason()));
|
.setReason(BpmReasonEnum.ASSIGN_START_USER_APPROVE_WHEN_SKIP_START_USER_NODE.getReason()));
|
||||||
|
|||||||
Reference in New Issue
Block a user