flowable 多实例动态添加人

背景:

由于在日常情况下,我们的多实例要动态添加人员的场景,有没有这样的api呢?新的flowable有这样的功能。

具体实现

xml 


      
        assigneeList
        
        ${nrOfCompletedInstances/nrOfInstances >= 0.6 }
      
    

具体实现

List assigneeList = Arrays.asList("kermit", "gonzo", "mispiggy", "fozzie", "bubba");
String procId = runtimeService.startProcessInstanceByKey("miParallelUserTasksBasedOnCollection", CollectionUtil.singletonMap("assigneeList", assigneeList)).getId();
        
List tasks = taskService.createTaskQuery().orderByTaskAssignee().asc().list();
assertEquals(5, tasks.size());
assertEquals("bubba", tasks.get(0).getAssignee());
assertEquals("fozzie", tasks.get(1).getAssignee());
assertEquals("gonzo", tasks.get(2).getAssignee());
assertEquals("kermit", tasks.get(3).getAssignee());
assertEquals("mispiggy", tasks.get(4).getAssignee());
            
runtimeService.addMultiInstanceExecution("miTasks", procId, Collections.singletonMap("assignee", (Object) "johndoe"));
tasks = taskService.createTaskQuery().orderByTaskAssignee().asc().list();
assertEquals(6, tasks.size());

说明:

runtimeService.addMultiInstanceExecution(要加签的节点id,流程实例id, Collections.singletonMap("单个对象的别名", (Object) "对象值"));

 

转载于:https://www.cnblogs.com/liuwenjun/p/10315993.html

你可能感兴趣的:(flowable 多实例动态添加人)