概念
包含网关是一种工作流中的路由节点,它能够同时激活所有符合条件的路径 ,并在汇聚点等待所有被激活的路径执行完成后,才继续向下流转。
以下案例在线体验,ruoyiflow
需求描述
公司全体员工都需要进行"常规项检查"和"抽血化验",而管理层领导额外需要进行"附加项检查"。
流程设计
1.用小扳手将网关类型设置为包含网关
2.分别设计三条流出路径,其中两条是默认路线,即常规检查和抽血化验, 一条是领导专属的附加检查
3.设置服务任务的属性, 这里我们设置为一个测试的方法
4.流程实际运行的结果 
bpmn文件
xml
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
<bpmn:process id="Process_9988" name="体检流程" isExecutable="true">
<bpmn:startEvent id="Event_0pygc7d">
<bpmn:outgoing>Flow_06uhglv</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_06uhglv" sourceRef="Event_0pygc7d" targetRef="Activity_1oi7a6w" />
<bpmn:userTask id="Activity_1oi7a6w" name="体检流程" camunda:assignee="${startUser}">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="userType" label="员工类型" type="long" />
</camunda:formData>
</bpmn:extensionElements>
<bpmn:incoming>Flow_06uhglv</bpmn:incoming>
<bpmn:outgoing>Flow_1cfkc1x</bpmn:outgoing>
</bpmn:userTask>
<bpmn:sequenceFlow id="Flow_1cfkc1x" sourceRef="Activity_1oi7a6w" targetRef="Gateway_082pcsr" />
<bpmn:inclusiveGateway id="Gateway_082pcsr">
<bpmn:incoming>Flow_1cfkc1x</bpmn:incoming>
<bpmn:outgoing>Flow_12o75yq</bpmn:outgoing>
<bpmn:outgoing>Flow_17y2qrg</bpmn:outgoing>
<bpmn:outgoing>Flow_0whi5cb</bpmn:outgoing>
</bpmn:inclusiveGateway>
<bpmn:sequenceFlow id="Flow_12o75yq" sourceRef="Gateway_082pcsr" targetRef="Activity_0tg7rc8" />
<bpmn:serviceTask id="Activity_0tg7rc8" name="常规项检查" camunda:delegateExpression="${includeApproveTask}">
<bpmn:incoming>Flow_12o75yq</bpmn:incoming>
<bpmn:outgoing>Flow_1gpmmkv</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_1gpmmkv" sourceRef="Activity_0tg7rc8" targetRef="Gateway_1vlogqd" />
<bpmn:inclusiveGateway id="Gateway_1vlogqd">
<bpmn:incoming>Flow_1gpmmkv</bpmn:incoming>
<bpmn:incoming>Flow_06kg33d</bpmn:incoming>
<bpmn:incoming>Flow_12i1kyq</bpmn:incoming>
<bpmn:outgoing>Flow_0s2cs7t</bpmn:outgoing>
</bpmn:inclusiveGateway>
<bpmn:endEvent id="Event_0klslb1">
<bpmn:incoming>Flow_0s2cs7t</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_0s2cs7t" sourceRef="Gateway_1vlogqd" targetRef="Event_0klslb1" />
<bpmn:sequenceFlow id="Flow_17y2qrg" name="领导专属" sourceRef="Gateway_082pcsr" targetRef="Activity_0z4j3c2">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${userType==2}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Activity_0z4j3c2" name="附加检查" camunda:delegateExpression="${includeApproveTask}">
<bpmn:incoming>Flow_17y2qrg</bpmn:incoming>
<bpmn:outgoing>Flow_06kg33d</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_06kg33d" sourceRef="Activity_0z4j3c2" targetRef="Gateway_1vlogqd" />
<bpmn:sequenceFlow id="Flow_0whi5cb" sourceRef="Gateway_082pcsr" targetRef="Activity_1udv0ib" />
<bpmn:sequenceFlow id="Flow_12i1kyq" sourceRef="Activity_1udv0ib" targetRef="Gateway_1vlogqd" />
<bpmn:serviceTask id="Activity_1udv0ib" name="抽血化验" camunda:delegateExpression="${includeApproveTask}">
<bpmn:incoming>Flow_0whi5cb</bpmn:incoming>
<bpmn:outgoing>Flow_12i1kyq</bpmn:outgoing>
</bpmn:serviceTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_9988">
<bpmndi:BPMNShape id="Event_0pygc7d_di" bpmnElement="Event_0pygc7d">
<dc:Bounds x="272" y="232" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0dmv1pk_di" bpmnElement="Activity_1oi7a6w">
<dc:Bounds x="360" y="210" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_1f5mkme_di" bpmnElement="Gateway_082pcsr">
<dc:Bounds x="515" y="225" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1xhstnt_di" bpmnElement="Activity_0tg7rc8">
<dc:Bounds x="660" y="70" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_18xqnd7_di" bpmnElement="Gateway_1vlogqd">
<dc:Bounds x="845" y="225" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0klslb1_di" bpmnElement="Event_0klslb1">
<dc:Bounds x="962" y="232" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0mi86gy_di" bpmnElement="Activity_0z4j3c2">
<dc:Bounds x="660" y="340" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_14rh5fv_di" bpmnElement="Activity_1udv0ib">
<dc:Bounds x="660" y="210" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_06uhglv_di" bpmnElement="Flow_06uhglv">
<di:waypoint x="308" y="250" />
<di:waypoint x="360" y="250" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1cfkc1x_di" bpmnElement="Flow_1cfkc1x">
<di:waypoint x="460" y="250" />
<di:waypoint x="515" y="250" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_12o75yq_di" bpmnElement="Flow_12o75yq">
<di:waypoint x="540" y="225" />
<di:waypoint x="540" y="110" />
<di:waypoint x="660" y="110" />
<bpmndi:BPMNLabel>
<dc:Bounds x="558" y="180" width="44" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1gpmmkv_di" bpmnElement="Flow_1gpmmkv">
<di:waypoint x="760" y="110" />
<di:waypoint x="870" y="110" />
<di:waypoint x="870" y="225" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0s2cs7t_di" bpmnElement="Flow_0s2cs7t">
<di:waypoint x="895" y="250" />
<di:waypoint x="962" y="250" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_17y2qrg_di" bpmnElement="Flow_17y2qrg">
<di:waypoint x="540" y="275" />
<di:waypoint x="540" y="380" />
<di:waypoint x="660" y="380" />
<bpmndi:BPMNLabel>
<dc:Bounds x="571" y="353" width="44" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_06kg33d_di" bpmnElement="Flow_06kg33d">
<di:waypoint x="760" y="380" />
<di:waypoint x="870" y="380" />
<di:waypoint x="870" y="275" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0whi5cb_di" bpmnElement="Flow_0whi5cb">
<di:waypoint x="565" y="250" />
<di:waypoint x="660" y="250" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_12i1kyq_di" bpmnElement="Flow_12i1kyq">
<di:waypoint x="760" y="250" />
<di:waypoint x="845" y="250" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
在线体验,ruoyiflow