一:示例
Deployment deploy = repositoryService.createDeployment()
.name("会签流程")
.addClasspathResource("processes/CounterSignProcess.bpmn")
.deploy();
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("CounterSignProcess");
Map<String, Object> variables = new HashMap<>();
variables.put("list", Arrays.asList("huihui", "monday"));
System.err.println(processInstance.getId());
Task task = taskService.createTaskQuery()
.processInstanceId(processInstance.getId())
.singleResult();
taskService.complete(task.getId(), variables);
二:加签
String activityId = "CounterSign";
String processInstanceId = "40005";
Map<String, Object> executionVariables = new HashMap<>();
executionVariables.put("item", "baby");
runtimeService.addMultiInstanceExecution(activityId, processInstanceId, executionVariables);
三:减签
Task task = taskService.createTaskQuery().taskId("40028").singleResult();
String executionId = task.getExecutionId();
runtimeService.deleteMultiInstanceExecution(executionId, false);
act_ru_task 删除一条数据40028。
act_ru_execution 删除了一条40022, 增加了一条45001(不知道为什么要增加)。
减签(二)
Task task = taskService.createTaskQuery().taskId("42505").singleResult();
String executionId = task.getExecutionId();
runtimeService.deleteMultiInstanceExecution(executionId, false);
同样是删除了45001新增了47501。
减签(三)
act_ru_execution: 40023删除,保留了47501,并且新增了50001。
Task task = taskService.createTaskQuery().taskId("40034").singleResult();
String executionId = task.getExecutionId();
// executionIsCompleted : defines if the deleted execution should be marked as completed on the parent multi-instance execution
runtimeService.deleteMultiInstanceExecution(executionId, true);
ACT_HI_TASKINST 中的delete_reason_值为Delete MI execution。