public boolean checkIsSetNextUser(String taskId){ boolean isSetNextUser = false; Task task = taskService.createTaskQuery().taskId(taskId).singleResult(); String nodeId = task.getTaskDefinitionKey(); //用户任务集合 List<UserTask> userTasks = new ArrayList<>(); String processDefinitionId = task.getProcessDefinitionId(); BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId); List<Process> processes = bpmnModel.getProcesses(); Process process = processes.get(0); Collection<FlowElement> flowElements = process.getFlowElements(); //用户任务节点id List<String> usertaskNodelIdList = new ArrayList<>(); //放置endEvent的nodeId AtomicReference<String> endEventId = new AtomicReference<>(""); //将网关信息与用户任务进行分类存储(放于JVM堆中) flowElements.forEach(flowElement -> { if (flowElement instanceof UserTask) { usertaskNodelIdList.add(flowElement.getId()); userTasks.add((UserTask) flowElement); } if (flowElement instanceof EndEvent) { endEventId.set(flowElement.getId()); } }); //变量所有的UserTask节点 for (UserTask userTask : userTasks) { //获取UserTask节点的出线 List<SequenceFlow> outgoingFlows = userTask.getOutgoingFlows(); for (SequenceFlow outgoingFlow : outgoingFlows) { String sourceRef = outgoingFlow.getSourceRef(); String targetRef = outgoingFlow.getTargetRef(); //固定出线的(sourceRef) if (nodeId.equals(sourceRef)) { nodeId = targetRef; if (targetRef.equals(endEventId.get())){ isSetNextUser = true; } } } } return isSetNextUser; }