flowable 实现多实例-会签-动态配置人员 参考demo
会签 即多人执行当前任务 设置判断数 通过 例如:设置了是半数通过即可通过当前节点 如果当前是4人那就是2人即通过 如果是6人那就是三人即通过 如果是5人 即三人通过 看各位的判断值是如何书写 这个值是根据各位需求改变的
以下是xml
<?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="living" name="MoreLiving" isExecutable="true"><documentation>测试flowable多实例</documentation><startEvent id="Start"></startEvent><userTask id="UserTask1" name="U1" flowable:assignee="${assignee}"><multiInstanceLoopCharacteristics isSequential="false" flowable:collection="assigneeList" flowable:elementVariable="assignee"><loopCardinality>4</loopCardinality><completionCondition>${nrOfCompletedInstances/nrOfInstances >= 0.50}</completionCondition></multiInstanceLoopCharacteristics></userTask><userTask id="UserTask2" name="U2"></userTask><endEvent id="End"></endEvent><sequenceFlow id="S-U1" sourceRef="Start" targetRef="UserTask1"></sequenceFlow><sequenceFlow id="U1-U2" sourceRef="UserTask1" targetRef="UserTask2"></sequenceFlow><sequenceFlow id="U2-E" sourceRef="UserTask2" targetRef="End"></sequenceFlow></process><bpmndi:BPMNDiagram id="BPMNDiagram_living"><bpmndi:BPMNPlane bpmnElement="living" id="BPMNPlane_living"><bpmndi:BPMNShape bpmnElement="Start" id="BPMNShape_Start"><omgdc:Bounds height="30.0" width="30.0" x="100.0" y="163.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="UserTask1" id="BPMNShape_UserTask1"><omgdc:Bounds height="80.0" width="100.0" x="315.0" y="138.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="UserTask2" id="BPMNShape_UserTask2"><omgdc:Bounds height="80.0" width="100.0" x="570.0" y="138.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNShape bpmnElement="End" id="BPMNShape_End"><omgdc:Bounds height="28.0" width="28.0" x="810.0" y="164.0"></omgdc:Bounds></bpmndi:BPMNShape><bpmndi:BPMNEdge bpmnElement="S-U1" id="BPMNEdge_S-U1"><omgdi:waypoint x="129.94999970750393" y="178.0"></omgdi:waypoint><omgdi:waypoint x="314.99999999991076" y="178.0"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="U2-E" id="BPMNEdge_U2-E"><omgdi:waypoint x="669.9499999999294" y="178.0"></omgdi:waypoint><omgdi:waypoint x="810.0" y="178.0"></omgdi:waypoint></bpmndi:BPMNEdge><bpmndi:BPMNEdge bpmnElement="U1-U2" id="BPMNEdge_U1-U2"><omgdi:waypoint x="414.9499999999562" y="178.0"></omgdi:waypoint><omgdi:waypoint x="570.0" y="178.0"></omgdi:waypoint></bpmndi:BPMNEdge></bpmndi:BPMNPlane></bpmndi:BPMNDiagram>
</definitions>
${nrOfCompletedInstances/nrOfInstances >= 0.50}
>=0.50 即通过数是>=人员数的50%
flowable:collection=“assigneeList” ${assigneeList}即取的人员列表名称
以下是java代码
//主体流程的开始//创建数据库链接信息ProcessEngineConfiguration cfg = new StandaloneProcessEngineConfiguration().setJdbcUrl("jdbc:mysql://127.0.0.1:3306/自库名?characterEncoding=UTF-8").setJdbcUsername("账号").setJdbcPassword("密码").setJdbcDriver("com.mysql.jdbc.Driver").setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_FALSE);// 通过数据库链接信息 创建Flowable流程引擎 Create Flowable process engineProcessEngine processEngine = cfg.buildProcessEngine();// 获取Flowable服务 Get Flowable repositoryServiceRepositoryService repositoryService = processEngine.getRepositoryService();// 获取Flowable服务 Get Flowable runtimeServiceRuntimeService runtimeService = processEngine.getRuntimeService();// 获取taskService对象 Get the first taskTaskService taskService = processEngine.getTaskService();//获取fromserver对象 操作from表单的东西FormService formService = processEngine.getFormService();Deployment deploy = repositoryService.createDeployment().addClasspathResource("/MoreLiving.bpmn20.xml").deploy();System.out.println(deploy.getId());HashMap<String, Object> map = new HashMap<>();//定义的人员列表4人String[] v = { "shareniu1", "shareniu2", "shareniu3", "shareniu4" };map.put("per", "bbb");map.put("money", "1111");map.put("assigneeList", Arrays.asList(v));ProcessInstance pi = runtimeService.startProcessInstanceByKey("living",map);List<Task> list = taskService.createTaskQuery().processInstanceId(pi.getId()).list();System.out.println(list.size());int i=0;for (Task task : list) {i=i+1;System.out.println("==========================所有节点name is = "+task.getName());System.out.println("==========================所有节点id is = "+task.getId());System.out.println("============ i ="+i);//变相判断已经二人提交 之后人员不提交if (i<3) {System.out.println("================== 提交 节点 id is="+task.getId());taskService.complete(task.getId());}}//判断值为 50% 所以提交人达到2人 会签节点即可通过Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();System.out.println("====================================================================================");//验证是否已通过System.out.println("===================task id is="+task.getId());System.out.println("===================task name is="+task.getName());
我的判断值为 50% 所以提交人达到2人 会签节点即可通过
flowable 实现多实例-会签-动态配置人员 参考demo相关推荐
- 全网最全面工作流引擎Flowable完整教程之多实例会签
Flowable完整教程之多实例会签 前言 1.BladeX流程设计器 1.1.BladeX工作流设计 1.2.parallel多实例流程设计 1.3. BladeX多实例任务节点参数设置 2.部署测 ...
- 如果要用thinkphp框架_php需要改哪些配置,thinkPHP框架动态配置用法实例分析
本文实例讲述了thinkPHP框架动态配置用法.分享给大家供大家参考,具体如下: 最近在用@ThinkPHP 做系统的时候,要用到一个功能,就要动态的将系统的配置参数保存到Config文件中.以往,我 ...
- ENSP配置 实例九 动态Nat配置
ENSP配置 实例九 动态Nat配置 sy [Huawei]sy R1 [R1]int g0/0/0 [R1-GigabitEthernet0/0/0]ip add 192.168.1.254 24 ...
- ConfigBus:Twitter的动态配置实践
动态配置能够在不重新启动应用程序的情况下更改正在运行的系统的行为和功能.理想的动态配置系统使服务开发人员和管理员能够方便地查看和更新配置,并高效可靠地向应用程序提供配置更新.它使组织能够快速.大胆地迭 ...
- 取代ZooKeeper,Twitter 的动态配置实践
作者 | Twitter Engineering Blog 译者 | 谢丽 ConfigBus 是 Twitter 的动态配置系统,包括存储配置的数据库.将配置分发到 Twitter 数据中心中的机器 ...
- Spring Boot 整合 Quartz 实现 Java 定时任务的动态配置
点击上方蓝色"方志朋",选择"设为星标" 回复"666"获取独家整理的学习资料! 首先说下这次主题,动态配置.没接触过定时任务的同学可以先看 ...
- 分布式动态配置后浪推前浪 -- Nacos
???? 前言 Nacos 是阿里巴巴的开源的项目,全称 Naming Configuration Service ,专注于服务发现和配置管理领域. Nacos 致力于帮助您发现.配置和管理微服务.N ...
- NGINX发布支持动态配置的开源Web服务器
\ 看新闻很累?看技术新闻更累?试试下载InfoQ手机客户端,每天上下班路上听新闻,有趣还有料! \ \\ NGINX最近发布了NGINX Unit 1.0版.NGINX Unit是一种开源的Web和 ...
- Quartz 在 Spring 中如何动态配置时间
在项目中有一个需求,需要灵活配置调度任务时间,并能自由启动或停止调度. 有关调度的实现我就第一就想到了Quartz这个开源调度组件,因为很多项目使用过,Spring结合Quartz静态配置调度任务时间 ...
最新文章
- Cookie与Web Storage的区别
- JBoss AS 8中的Java EE 7和EJB 3.2支持
- 【渝粤题库】广东开放大学 基础写作 形成性考核
- e记法 python 底数_备战python二级
- 1.3Python快速入门
- 高性能自旋锁 MCS Spinlock 的设计与实现(来自IBM)
- java 短地址_URL短地址压缩算法 微博短地址原理解析(再转与Java实现) | 学步园
- 终于搞定了cxgrid的多行表头(转终于搞定了cxgrid的多行表头 )
- 初识UNIX操作系统
- 在线医疗和教育,正在争抢未来!
- 主成分分析在生命科学研究中的应用
- C# 中文简体中文繁体转换_ChineseConverter
- python ocr识别 沪牌_7月沪牌拍后分析:毫秒之间,锁定中标
- Syzmlw 蜗居大结局
- 洛谷 P3110 [USACO14DEC]驮运Piggy Back spfa
- IC验证面试必考-跨时钟域
- python 期货现货差价监测_数字货币期货现货差价监控
- Shader小技巧-翻转uv
- Python数据可视化——pyecharts学习笔记
- N9K配置Vxlan