可流动的流程回退到上一节点

  

做个简单记录,以后写文章详解

  
 <代码>//获取当前节点的activityId,即xml中每个标签的ID
  字符串currentActivityId=execution.getCurrentActivityId ();
  
  Listlist1=taskService.createTaskQuery () .processInstanceId (processInstance.getProcessInstanceId ()) .list ();//taskService.addComment (currentTask.getId (), execution.getProcessInstanceId (), body.get(“味精”).toString ());
  
  BpmnModel BpmnModel=repositoryService.getBpmnModel (execution.getProcessDefinitionId ());
  FlowNode FlowNode=(FlowNode) bpmnModel.getFlowElement (currentActivityId);
  SequenceFlow SequenceFlow=flowNode.getIncomingFlows () . get (0);//获取上一个节点的activityId
  字符串sourceRef=sequenceFlow.getSourceRef ();//流程回退到上一个节点,审批人继续审批
  runtimeService.createChangeActivityStateBuilder () .processInstanceId (processInstance.getProcessInstanceId ())
  .moveActivityIdTo (currentActivityId sourceRef) .changeState();  

可流动的流程回退到上一节点