equenceFlow 

流程定义文件leave-formkey.bpmn20.xml:

[html] 
<?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: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" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="OFFICE">    <process id="leave-formkey" name="病事假申请">      <documentation>请假流程演示</documentation>      <startEvent id="startevent1" name="Start" activiti:initiator="applyUserId"></startEvent>      <userTask id="deptLeaderAudit" name="部门领导审批" activiti:assignee="${applyUserId}" activiti:formKey="leaveHandle.form"></userTask>      <exclusiveGateway id="exclusivegateway5" name="Exclusive Gateway"></exclusiveGateway>      <userTask id="modifyApply" name="调整申请" activiti:assignee="${applyUserId}" activiti:formKey="leaveApplyAgain.form"></userTask>      <userTask id="hrAudit" name="人事审批" activiti:assignee="${applyUserId}" activiti:formKey="leaveHandle.form"></userTask>      <exclusiveGateway id="exclusivegateway6" name="Exclusive Gateway"></exclusiveGateway>      <userTask id="reportBack" name="销假" activiti:assignee="${applyUserId}" activiti:formKey="leaveHandle.form"></userTask>      <endEvent id="endevent1" name="End"></endEvent>      <exclusiveGateway id="exclusivegateway7" name="Exclusive Gateway"></exclusiveGateway>      <sequenceFlow id="flow2" name="" sourceRef="startevent1" targetRef="deptLeaderAudit"></sequenceFlow>      <sequenceFlow id="flow3" name="" sourceRef="deptLeaderAudit" targetRef="exclusivegateway5"></sequenceFlow>      <sequenceFlow id="flow4" name="不同意" sourceRef="exclusivegateway5" targetRef="modifyApply">        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${deptLeaderPass == 'false'}]]></conditionExpression>      </sequenceFlow>      <sequenceFlow id="flow5" name="同意" sourceRef="exclusivegateway5" targetRef="hrAudit">        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${deptLeaderPass == 'true'}]]></conditionExpression>      </sequenceFlow>      <sequenceFlow id="flow6" name="" sourceRef="hrAudit" targetRef="exclusivegateway6"></sequenceFlow>      <sequenceFlow id="flow7" name="同意" sourceRef="exclusivegateway6" targetRef="reportBack">        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${hrPass == 'true'}]]></conditionExpression>      </sequenceFlow>      <sequenceFlow id="flow8" name="" sourceRef="reportBack" targetRef="endevent1"></sequenceFlow>      <sequenceFlow id="flow9" name="不同意" sourceRef="exclusivegateway6" targetRef="modifyApply">        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${hrPass == 'false'}]]></conditionExpression>      </sequenceFlow>      <sequenceFlow id="flow10" name="重新申请" sourceRef="exclusivegateway7" targetRef="deptLeaderAudit">        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${reApply == 'true'}]]></conditionExpression>      </sequenceFlow>      <sequenceFlow id="flow11" name="" sourceRef="modifyApply" targetRef="exclusivegateway7"></sequenceFlow>      <sequenceFlow id="flow12" name="结束流程" sourceRef="exclusivegateway7" targetRef="endevent1">        <conditionExpression xsi:type="tFormalExpression"><![CDATA[${reApply == 'false'}]]></conditionExpression>      </sequenceFlow>    </process>    <bpmndi:BPMNDiagram id="BPMNDiagram_leave-formkey">      <bpmndi:BPMNPlane bpmnElement="leave-formkey" id="BPMNPlane_leave-formkey">        <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">          <omgdc:Bounds height="35" width="35" x="10" y="90"></omgdc:Bounds>        </bpmndi:BPMNShape>        <bpmndi:BPMNShape bpmnElement="deptLeaderAudit" id="BPMNShape_deptLeaderAudit">          <omgdc:Bounds height="55" width="105" x="90" y="80"></omgdc:Bounds>        </bpmndi:BPMNShape>        <bpmndi:BPMNShape bpmnElement="exclusivegateway5" id="BPMNShape_exclusivegateway5">          <omgdc:Bounds height="40" width="40" x="250" y="87"></omgdc:Bounds>        </bpmndi:BPMNShape>        <bpmndi:BPMNShape bpmnElement="modifyApply" id="BPMNShape_modifyApply">          <omgdc:Bounds height="55" width="105" x="218" y="190"></omgdc:Bounds>        </bpmndi:BPMNShape>        <bpmndi:BPMNShape bpmnElement="hrAudit" id="BPMNShape_hrAudit">          <omgdc:Bounds height="55" width="105" x="358" y="80"></omgdc:Bounds>        </bpmndi:BPMNShape>        <bpmndi:BPMNShape bpmnElement="exclusivegateway6" id="BPMNShape_exclusivegateway6">          <omgdc:Bounds height="40" width="40" x="495" y="87"></omgdc:Bounds>        </bpmndi:BPMNShape>        <bpmndi:BPMNShape bpmnElement="reportBack" id="BPMNShape_reportBack">          <omgdc:Bounds height="55" width="105" x="590" y="80"></omgdc:Bounds>        </bpmndi:BPMNShape>        <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">          <omgdc:Bounds height="35" width="35" x="625" y="283"></omgdc:Bounds>        </bpmndi:BPMNShape>        <bpmndi:BPMNShape bpmnElement="exclusivegateway7" id="BPMNShape_exclusivegateway7">          <omgdc:Bounds height="40" width="40" x="250" y="280"></omgdc:Bounds>        </bpmndi:BPMNShape>        <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">          <omgdi:waypoint x="45" y="107"></omgdi:waypoint>          <omgdi:waypoint x="90" y="107"></omgdi:waypoint>        </bpmndi:BPMNEdge>        <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">          <omgdi:waypoint x="195" y="107"></omgdi:waypoint>          <omgdi:waypoint x="250" y="107"></omgdi:waypoint>        </bpmndi:BPMNEdge>        <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">          <omgdi:waypoint x="270" y="127"></omgdi:waypoint>          <omgdi:waypoint x="270" y="190"></omgdi:waypoint>          <bpmndi:BPMNLabel>            <omgdc:Bounds height="11" width="100" x="10" y="0"></omgdc:Bounds>          </bpmndi:BPMNLabel>        </bpmndi:BPMNEdge>        <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">          <omgdi:waypoint x="290" y="107"></omgdi:waypoint>          <omgdi:waypoint x="358" y="107"></omgdi:waypoint>          <bpmndi:BPMNLabel>            <omgdc:Bounds height="11" width="100" x="-24" y="-17"></omgdc:Bounds>          </bpmndi:BPMNLabel>        </bpmndi:BPMNEdge>        <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">          <omgdi:waypoint x="463" y="107"></omgdi:waypoint>          <omgdi:waypoint x="495" y="107"></omgdi:waypoint>        </bpmndi:BPMNEdge>        <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">          <omgdi:waypoint x="535" y="107"></omgdi:waypoint>          <omgdi:waypoint x="590" y="107"></omgdi:waypoint>          <bpmndi:BPMNLabel>            <omgdc:Bounds height="11" width="100" x="-22" y="-17"></omgdc:Bounds>          </bpmndi:BPMNLabel>        </bpmndi:BPMNEdge>        <bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">          <omgdi:waypoint x="642" y="135"></omgdi:waypoint>          <omgdi:waypoint x="642" y="283"></omgdi:waypoint>        </bpmndi:BPMNEdge>        <bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">          <omgdi:waypoint x="515" y="127"></omgdi:waypoint>          <omgdi:waypoint x="514" y="217"></omgdi:waypoint>          <omgdi:waypoint x="323" y="217"></omgdi:waypoint>          <bpmndi:BPMNLabel>            <omgdc:Bounds height="11" width="100" x="10" y="0"></omgdc:Bounds>          </bpmndi:BPMNLabel>        </bpmndi:BPMNEdge>        <bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">          <omgdi:waypoint x="250" y="300"></omgdi:waypoint>          <omgdi:waypoint x="142" y="299"></omgdi:waypoint>          <omgdi:waypoint x="142" y="135"></omgdi:waypoint>          <bpmndi:BPMNLabel>            <omgdc:Bounds height="11" width="100" x="10" y="0"></omgdc:Bounds>          </bpmndi:BPMNLabel>        </bpmndi:BPMNEdge>        <bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">          <omgdi:waypoint x="270" y="245"></omgdi:waypoint>          <omgdi:waypoint x="270" y="280"></omgdi:waypoint>        </bpmndi:BPMNEdge>        <bpmndi:BPMNEdge bpmnElement="flow12" id="BPMNEdge_flow12">          <omgdi:waypoint x="290" y="300"></omgdi:waypoint>          <omgdi:waypoint x="625" y="300"></omgdi:waypoint>          <bpmndi:BPMNLabel>            <omgdc:Bounds height="11" width="100" x="10" y="0"></omgdc:Bounds>          </bpmndi:BPMNLabel>        </bpmndi:BPMNEdge>      </bpmndi:BPMNPlane>    </bpmndi:BPMNDiagram>  </definitions> ============================================================================

5.流程启动前传入后续节点办理人;

//下面name2和name3是前台传过来的第二个和第三个节点的办理人

Map<String, Object> variables = new HashMap<String, Object>();        variables.put("leaveId", leaveId);        variables.put("name2", "XXX");//(前台传过来的第二个节点的办理人)        variables.put("name3", "YYY");//(前台传过来的第三个节点的办理人)        // 启动流程        pi = runtimeService.startProcessInstanceByKey("activitiemployeeProcess", variables);

在第一个节点指定第二个节点的监听

public class MyTaksListener2 implements TaskListener {    public void notify(DelegateTask delegateTask) {        Map<String, Object> variables=delegateTask.getVariables();       variables.get("name2");(前台传过来的第二个节点的办理人)        //拆分variables        List<String> assigneeList = new ArrayList<String>();         assigneeList.add("wangba");        delegateTask.setVariable("publicityList",assigneeList);    }}

在第三个节点指定本节点的办理人监听

public class MyTaksListener3 implements TaskListener {    public void notify(DelegateTask delegateTask) {        Map<String, Object> variables=delegateTask.getVariables();        System.out.println(variables);        variables.get("name3");//        String result=(String) variables.get("name3");(前台传过来的第三个节点的办理人)        String[] empLoyees = {"szx"};        delegateTask.addCandidateUsers(Arrays.asList(empLoyees));    }}

============================================================================

6、节点设置多个监听

在同一节点设置两个监听,一个是设置本节点的监听,指定办理人;另一个是设置下一个节点的监听,指定会签人。

设置本节点的监听,指定办理人

public class MyTaksListener3 implements TaskListener {    public void notify(DelegateTask delegateTask) {        Map<String, Object> variables=delegateTask.getVariables();        System.out.println(variables);        String result=(String) variables.get("name3");                String[] empLoyees = {"szx"};        delegateTask.addCandidateUsers(Arrays.asList(empLoyees));    }}

设置下一个节点的监听,指定会签人

public class MyTaksListener4 implements TaskListener {    public void notify(DelegateTask delegateTask) {        Map<String, Object> variables=delegateTask.getVariables();        String result=(String)variables.get("name2");                List<String> assigneeList = new ArrayList<String>();         assigneeList.add("ss");        delegateTask.setVariable("publicityList",assigneeList);    }}

至此,项目中遇到的各(奇)种(葩)问题迎刃而解。“中国式”工作流有时确实很让人头疼,但也体现了中国程序猿的强大。希望看到这里的你也能从中得到启发,尽早解决您在项目当中遇到的问题。

activiti 工作流会签 / 多人审批时若一人通过即可相关推荐

  1. Activiti工作流会签与获取下一节点任务信息

    2018-03-29 问题描述:会签节点选择2个审核人只能看到一条代办任务. 解决办法: Sequential设置为false即可.(true 串行   false  并行) activiti 工作流 ...

  2. Activiti 工作流会签开发设计思路

    在流程业务管理中,任务是通常都是由一个人去处理的,而多个人同时处理一个任 务,这种任务我们称之为会签任务.这种业务需求也很常见,如一个请款单,领导审批环节中,就需要多个部门领导签字.在流程业务中,我们 ...

  3. activiti会签多人审批(通过以及驳回)

    一.需求 用户发起审批后,需要经过  总经理  以及  财务部长 两人同时审批.两人通过极为通过,一人拒绝即为拒绝.拒绝后用户修改重新审批或者放弃申请. 二.用到的东西 1 单一网关 2 用户任务(多 ...

  4. Activiti 工作流引擎 ~ 获取审批记录

    审批意见保存在ACT_HI_COMMENT表中 审批状态保存在ACT_HI_VARINST表中,为任务变量 public List<ApprovalEntity> getHistoryTa ...

  5. activiti工作流会签功能的实现

    需求:统计会签部门的审核情况然后决定下一步流程的走向: 逻辑实现: 1.设置一个变量signCount 如果同意,signCount+1 // 如果是会签流程List< Task > ta ...

  6. Activiti工作流开发笔记(二)-在线流程设计的使用说明

    在线流程设计 点击 [在线设计] 按钮,会打开 流程在线设计器 ,对流程的设计都将在该设计器上进行. 可以看到流程设计器由四部分组成: ①:基本操作工具栏 ②:节点.任务.事件类型列表 ③:流程设计画 ...

  7. activiti工作流,审批系统轻松落地,请假审批demo从流程绘制到审批结束实例

    前言 activiti工作流,企业erp.oa.hr.crm等审批系统轻松落地,请假审批demo从流程绘制到审批结束实例. 一.项目形式 springboot+vue+activiti集成了activ ...

  8. Activiti工作流之实现一个简单的流程审批

    该代码在上一篇博客的基础上开发. Activiti工作流入门 1.绘制bpmn流程图 在resources目录下新建一个diagram文件夹来存放我们绘制的bpmn流程图 由于我的IDEA中已经安装了 ...

  9. activiti 工作流设置并行审批_activity、jbpm5、snakerflow常用工作流审批流对比

    # 审批流调研 背景 由于目前产品研发组支持的产品项目越来越多, 同时几乎每个项目都会有导出审批,流程流转等需求,本着提高开发效率和组件化的目的,调研和开发通用的工作流组件,为后面的项目和新的需求提供 ...

最新文章

  1. Tungsten Replicator 多环境复制工具安装方法
  2. 已知三角形三点坐标求角度_2019高考数学:解三角形——正弦定理和余弦定理的解题技巧和模型...
  3. 使用SQL Server Analysis Services Tabular Model建立分析模型
  4. spring data jpa是什么?
  5. 【数据库系统】DBMS、DBS、DBA、DB的区别
  6. 飞鸽_飞鸽传书_飞鸽传书2010_飞鸽传书2010下载
  7. 2018阿里编程测验题:最短汉密尔顿回路
  8. Linux日志被删处理方法
  9. Linux下查看和停止所有java进程
  10. Vue源码解析:Vue实例
  11. jetson nano的USB转232 DB9串口线选购
  12. vue 加headers_(vue.js)axios interceptors 拦截器中添加headers 属性
  13. 基于pymupdf的PDF与图片互转
  14. Vin码识别功能实现
  15. 30行,金额转人民币大写的代码
  16. 信息二处的面上项目252项
  17. sfc /scannow命令如何能用虚拟光驱完成修复?(xp下的办法)
  18. 你的眼界决定了你的格局
  19. HDU2159.FATE-完全背包
  20. MP2451 使能脚电阻判断

热门文章

  1. JS TS 给函数注释的规范
  2. NVL和COALESCE的区别
  3. 嵌入式必看!全志T113-i+玄铁HiFi4核心板硬件说明资料分享
  4. 【安卓开发系列 -- APP】APP 开发基础技术整理
  5. Ubuntu18.04安装美化工具tweak 和 dash to dock
  6. 高阶数学的力量系列001:用L'Hospital法则证明一些等价无穷小
  7. 【前端之旅】HTML大总结
  8. 【codevs2833】奇怪的梦境 拓扑排序
  9. ORB-SLAM2的安装及试运行
  10. 2021年中国煤炭市场发展现状及市场发展走势分析[图]