/** * 获取任务节点 * * @param node 查询节点选择 * @param taskId 任务id */ public void nextFlowNode(String node, String taskId) { Task task = processEngine().getTaskService().createTaskQuery().taskId(taskId).singleResult(); ExecutionEntity ee = (ExecutionEntity) processEngine().getRuntimeService().createExecutionQuery() .executionId(task.getExecutionId()).singleResult(); // 当前审批节点 String crruentActivityId = ee.getActivityId(); BpmnModel bpmnModel = processEngine().getRepositoryService().getBpmnModel(task.getProcessDefinitionId()); FlowNode flowNode = (FlowNode) bpmnModel.getFlowElement(crruentActivityId); // 输出连线 List<SequenceFlow> outFlows = flowNode.getOutgoingFlows(); for (SequenceFlow sequenceFlow : outFlows) { //当前审批节点 if ("now".equals(node)) { FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement(); System.out.println("当前节点: id=" + sourceFlowElement.getId() + ",name=" + sourceFlowElement.getName()); } else if ("next".equals(node)) { // 下一个审批节点 FlowElement targetFlow = sequenceFlow.getTargetFlowElement(); if (targetFlow instanceof UserTask) { System.out.println("下一节点: id=" + targetFlow.getId() + ",name=" + targetFlow.getName()); } // 如果下个审批节点为结束节点 if (targetFlow instanceof EndEvent) { System.out.println("下一节点为结束节点:id=" + targetFlow.getId() + ",name=" + targetFlow.getName()); } } } }
flowable 获取当前以及下一任务节点
最新推荐文章于 2024-05-20 14:45:01 发布