flowable 并行节点跳转以及驳回

bpmn流程图
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.flowable.org/processdef">
  <process id="并行网关测试" name="并行网关测试" isExecutable="true">
    <documentation>并行网关测试</documentation>
    <startEvent id="startEvent1"></startEvent>
    <parallelGateway id="sid-934D0488-F46A-4677-AFB5-A0E8939BBD54"></parallelGateway>
    <sequenceFlow id="sid-B9DD9A1B-5875-4A1F-B477-120D1FA46373" sourceRef="startEvent1" targetRef="sid-934D0488-F46A-4677-AFB5-A0E8939BBD54"></sequenceFlow>
    <userTask id="sid-71C4C1CE-19C3-48E6-BFDC-BD1CE66C771C" name="上面执行" flowable:assignee="parallel1">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sid-628D71FF-241A-4CB2-8E10-841CD42C24A3" sourceRef="sid-934D0488-F46A-4677-AFB5-A0E8939BBD54" targetRef="sid-71C4C1CE-19C3-48E6-BFDC-BD1CE66C771C"></sequenceFlow>
    <userTask id="sid-39F5686C-74BC-4082-ACAE-5F0158ED4E0F" name="下面执行" flowable:assignee="parallel3">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sid-C4C03EBE-DEC7-4C7F-8D8B-30DEB3AA39F1" sourceRef="sid-934D0488-F46A-4677-AFB5-A0E8939BBD54" targetRef="sid-39F5686C-74BC-4082-ACAE-5F0158ED4E0F"></sequenceFlow>
    <userTask id="sid-26229EF7-76C7-414A-85A4-72A921B0B564" name="中间执行" flowable:assignee="parallel2">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sid-FCA1C78B-F942-4FDF-A2BA-783075C5D49C" sourceRef="sid-934D0488-F46A-4677-AFB5-A0E8939BBD54" targetRef="sid-26229EF7-76C7-414A-85A4-72A921B0B564"></sequenceFlow>
    <parallelGateway id="sid-D8824EB1-E469-4168-B145-8B6CA2369EDF"></parallelGateway>
    <sequenceFlow id="sid-A9679258-83A8-4280-9095-9B8D087DFDB6" sourceRef="sid-26229EF7-76C7-414A-85A4-72A921B0B564" targetRef="sid-D8824EB1-E469-4168-B145-8B6CA2369EDF"></sequenceFlow>
    <sequenceFlow id="sid-F3825EA4-CB1E-48CA-85F3-8BB26629B35E" sourceRef="sid-71C4C1CE-19C3-48E6-BFDC-BD1CE66C771C" targetRef="sid-D8824EB1-E469-4168-B145-8B6CA2369EDF"></sequenceFlow>
    <sequenceFlow id="sid-A4EE0A75-5C17-4C30-B9E9-BCED512A0118" sourceRef="sid-39F5686C-74BC-4082-ACAE-5F0158ED4E0F" targetRef="sid-D8824EB1-E469-4168-B145-8B6CA2369EDF"></sequenceFlow>
    <userTask id="sid-94DEBBD9-DA1C-41E7-B6D1-3D3DBB11AFF4" name="合并后最终执行" flowable:assignee="merge">
      <extensionElements>
        <modeler:initiator-can-complete xmlns:modeler="http://flowable.org/modeler"><![CDATA[false]]></modeler:initiator-can-complete>
      </extensionElements>
    </userTask>
    <sequenceFlow id="sid-76BBA6E1-1912-458F-B6D3-C464523F5275" sourceRef="sid-D8824EB1-E469-4168-B145-8B6CA2369EDF" targetRef="sid-94DEBBD9-DA1C-41E7-B6D1-3D3DBB11AFF4"></sequenceFlow>
    <endEvent id="sid-93737579-F476-4C20-92B0-5C3C7C2C52B8"></endEvent>
    <sequenceFlow id="sid-107081D9-0A63-46C4-8061-4FDA90DCBCBE" sourceRef="sid-94DEBBD9-DA1C-41E7-B6D1-3D3DBB11AFF4" targetRef="sid-93737579-F476-4C20-92B0-5C3C7C2C52B8"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_并行网关测试">
    <bpmndi:BPMNPlane bpmnElement="并行网关测试" id="BPMNPlane_并行网关测试">
      <bpmndi:BPMNShape bpmnElement="startEvent1" id="BPMNShape_startEvent1">
        <omgdc:Bounds height="30.0" width="30.0" x="100.0" y="163.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-934D0488-F46A-4677-AFB5-A0E8939BBD54" id="BPMNShape_sid-934D0488-F46A-4677-AFB5-A0E8939BBD54">
        <omgdc:Bounds height="40.0" width="40.0" x="180.0" y="158.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-71C4C1CE-19C3-48E6-BFDC-BD1CE66C771C" id="BPMNShape_sid-71C4C1CE-19C3-48E6-BFDC-BD1CE66C771C">
        <omgdc:Bounds height="80.0" width="100.0" x="265.0" y="15.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-39F5686C-74BC-4082-ACAE-5F0158ED4E0F" id="BPMNShape_sid-39F5686C-74BC-4082-ACAE-5F0158ED4E0F">
        <omgdc:Bounds height="80.0" width="100.0" x="265.0" y="255.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-26229EF7-76C7-414A-85A4-72A921B0B564" id="BPMNShape_sid-26229EF7-76C7-414A-85A4-72A921B0B564">
        <omgdc:Bounds height="80.0" width="100.0" x="265.0" y="138.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-D8824EB1-E469-4168-B145-8B6CA2369EDF" id="BPMNShape_sid-D8824EB1-E469-4168-B145-8B6CA2369EDF">
        <omgdc:Bounds height="40.0" width="40.0" x="480.0" y="162.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-94DEBBD9-DA1C-41E7-B6D1-3D3DBB11AFF4" id="BPMNShape_sid-94DEBBD9-DA1C-41E7-B6D1-3D3DBB11AFF4">
        <omgdc:Bounds height="80.0" width="100.0" x="565.0" y="142.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="sid-93737579-F476-4C20-92B0-5C3C7C2C52B8" id="BPMNShape_sid-93737579-F476-4C20-92B0-5C3C7C2C52B8">
        <omgdc:Bounds height="28.0" width="28.0" x="710.0" y="168.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sid-B9DD9A1B-5875-4A1F-B477-120D1FA46373" id="BPMNEdge_sid-B9DD9A1B-5875-4A1F-B477-120D1FA46373">
        <omgdi:waypoint x="129.94999691950494" y="178.0"></omgdi:waypoint>
        <omgdi:waypoint x="180.0" y="178.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-FCA1C78B-F942-4FDF-A2BA-783075C5D49C" id="BPMNEdge_sid-FCA1C78B-F942-4FDF-A2BA-783075C5D49C">
        <omgdi:waypoint x="219.52473707273558" y="178.41666666666666"></omgdi:waypoint>
        <omgdi:waypoint x="264.99999999999386" y="178.21812227074238"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-107081D9-0A63-46C4-8061-4FDA90DCBCBE" id="BPMNEdge_sid-107081D9-0A63-46C4-8061-4FDA90DCBCBE">
        <omgdi:waypoint x="664.949999999934" y="182.0"></omgdi:waypoint>
        <omgdi:waypoint x="710.0" y="182.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-A9679258-83A8-4280-9095-9B8D087DFDB6" id="BPMNEdge_sid-A9679258-83A8-4280-9095-9B8D087DFDB6">
        <omgdi:waypoint x="364.94999999999936" y="179.08"></omgdi:waypoint>
        <omgdi:waypoint x="480.38048651507063" y="181.57671957671957"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-C4C03EBE-DEC7-4C7F-8D8B-30DEB3AA39F1" id="BPMNEdge_sid-C4C03EBE-DEC7-4C7F-8D8B-30DEB3AA39F1">
        <omgdi:waypoint x="200.49999999999997" y="197.44187392795882"></omgdi:waypoint>
        <omgdi:waypoint x="200.5" y="295.0"></omgdi:waypoint>
        <omgdi:waypoint x="264.99999999989944" y="295.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-628D71FF-241A-4CB2-8E10-841CD42C24A3" id="BPMNEdge_sid-628D71FF-241A-4CB2-8E10-841CD42C24A3">
        <omgdi:waypoint x="200.5" y="158.5"></omgdi:waypoint>
        <omgdi:waypoint x="200.5" y="55.0"></omgdi:waypoint>
        <omgdi:waypoint x="265.0" y="55.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-A4EE0A75-5C17-4C30-B9E9-BCED512A0118" id="BPMNEdge_sid-A4EE0A75-5C17-4C30-B9E9-BCED512A0118">
        <omgdi:waypoint x="364.95" y="264.4594594594595"></omgdi:waypoint>
        <omgdi:waypoint x="487.5838926174497" y="189.56493288590607"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-76BBA6E1-1912-458F-B6D3-C464523F5275" id="BPMNEdge_sid-76BBA6E1-1912-458F-B6D3-C464523F5275">
        <omgdi:waypoint x="519.5247370727428" y="182.41666666666666"></omgdi:waypoint>
        <omgdi:waypoint x="565.0" y="182.21812227074238"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="sid-F3825EA4-CB1E-48CA-85F3-8BB26629B35E" id="BPMNEdge_sid-F3825EA4-CB1E-48CA-85F3-8BB26629B35E">
        <omgdi:waypoint x="364.95000000000005" y="89.29000000000002"></omgdi:waypoint>
        <omgdi:waypoint x="488.13232938160843" y="173.85897435897436"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>






/**
 * 并行节点跳转  
 * 当前并行有几个节点就放入几个节点
 * @param processId      部署id
 * @param taskNames      当前节点任务key
 * @param targetNodeName 下一节点任务key
 */
public void taskJumpCmd(String processId, List<String> taskNames, String targetNodeName) {
    runtimeService.createChangeActivityStateBuilder()
            .processInstanceId(processId)
            .moveActivityIdsToSingleActivityId(taskNames, targetNodeName)
            .changeState();

}

/**
 * 并行节点驳回  
 * 当前并行有几个节点就放入几个节点
 * @param processId      部署id
 * @param taskNames      当前节点任务id
 * @param targetNodeName 下一节点任务id
 */
public void taskJumpCmd(String processId, String taskNames, List<String> targetNodeName) {
    runtimeService.createChangeActivityStateBuilder()
            .processInstanceId(processId)
            .moveSingleActivityIdToActivityIds(taskNames, targetNodeName)
            .changeState();

}
/**
 * 并行网关跳转
 * @param processId 流程id
 */
@GetMapping("parallelTaskJumpCmd/{processId}")
@ResponseBody
public void parallelTaskJumpCmd(@PathVariable("processId") String processId) {
    List<String> taskNames = new ArrayList<>();
    taskNames.add("sid-71C4C1CE-19C3-48E6-BFDC-BD1CE66C771C");
    taskNames.add("sid-39F5686C-74BC-4082-ACAE-5F0158ED4E0F");
    taskNames.add("sid-26229EF7-76C7-414A-85A4-72A921B0B564");
    flowableUtil.taskJumpCmd(processId, taskNames, "sid-94DEBBD9-DA1C-41E7-B6D1-3D3DBB11AFF4");
}

/**
 * 并行网关驳回
 * @param processId 流程id
 */
@GetMapping("rejectTaskJumpCmd/{processId}")
@ResponseBody
public void rejectTaskJumpCmd(@PathVariable("processId") String processId) {
    List<String> taskNames = new ArrayList<>();
    taskNames.add("sid-71C4C1CE-19C3-48E6-BFDC-BD1CE66C771C");
    taskNames.add("sid-39F5686C-74BC-4082-ACAE-5F0158ED4E0F");
    taskNames.add("sid-26229EF7-76C7-414A-85A4-72A921B0B564");
    flowableUtil.taskJumpCmd(processId,"sid-94DEBBD9-DA1C-41E7-B6D1-3D3DBB11AFF4" , taskNames);
}
 跳转之后代理人信息会丢失需要重新设置,可以在ACT_HI_TASKINST找到历史节点走向信息,找到跳转节点的代理人并设置。

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值