Activiti请假demo

本博客介绍了使用Activiti实现的请假流程示例,包括流程设计图、 Exclusive Gateway的判断条件以及具体的业务逻辑代码。详细测试步骤和输出结果展示了流程的执行过程。
摘要由CSDN通过智能技术生成

相关代码参考GitHub:https://github.com/q850963704/activiti-demo.git

本例子以请假流程为例,流程设计图如下图所示:
在这里插入图片描述

具体判断条件参考xml文件,Exclusive Gateway的判断条件为 day<=2 和 day>2,经理审批和总经理审批判断条件均为 flag=true 和 flag=false

leave.bpmn内容如下:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.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" xmlns:tns="http://www.activiti.org/test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.w3.org/1999/XPath" id="m1561702890882" name="" targetNamespace="http://www.activiti.org/test" typeLanguage="http://www.w3.org/2001/XMLSchema">
  <process id="leave" isClosed="false" isExecutable="true" name="请假流程图" processType="None">
    <documentation id="leave_D_1"><![CDATA[请假流程图]]></documentation>
    <startEvent id="startevent1" name="Start"/>
    <endEvent id="endevent1" name="End"/>
    <userTask activiti:assignee="employee" activiti:exclusive="true" id="usertask1" name="员工请假"/>
    <userTask activiti:candidateGroups="manager" activiti:exclusive="true" id="usertask2" name="经理审批"/>
    <userTask activiti:candidateGroups="boss" activiti:exclusive="true" id="usertask3" name="总经理审批"/>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"/>
    <sequenceFlow id="flow2" name="${flag == true}" sourceRef="usertask2" targetRef="endevent1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${flag == true}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow3" name="${flag == true}" sourceRef="usertask3" targetRef="endevent1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${flag == true}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow4" name="${flag == false}" sourceRef="usertask2" targetRef="usertask1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${flag == false}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow5" name="${flag == false}" sourceRef="usertask3" targetRef="usertask1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${flag == false}]]></conditionExpression>
    </sequenceFlow>
    <exclusiveGateway gatewayDirection="Unspecified" id="exclusivegateway1" name="Exclusive Gateway"/>
    <sequenceFlow id="flow6" sourceRef="usertask1" targetRef="exclusivegateway1"/>
    <sequenceFlow id="flow7" name="${day &lt;= 2}" sourceRef="exclusivegateway1" targetRef="usertask2">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${day <= 2}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow8" name="${day &gt; 2}" sourceRef="exclusivegateway1" targetRef="usertask3">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${day > 2}]]></conditionExpression>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram documentation="background=#3C3F41;count=1;horizontalcount=1;orientation=0;width=842.4;height=1195.2;imageableWidth=832.4;imageableHeight=1185.2;imageableX=5.0;imageableY=5.0" id="Diagram-_1" name="New Diagram">
    <bpmndi:BPMNPlane bpmnElement="leave">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="Shape-startevent1">
        <omgdc:Bounds height="3
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值