项目地址 | https://gitee.com/lwj/flowable.git |
---|
代码分支 | flowable-base |
视频讲解地址 | https://space.bilibili.com/485524575/channel/detail?cid=94579 |
用户名 | 密码 |
---|
0000001 | test |
0000002 | test |
0000003 | test |
0000004 | test |
1. 演示
2. 代码分享
public ReturnVo<String> stopProcessInstanceById(EndVo endVo) {ReturnVo<String> returnVo = null;ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(endVo.getProcessInstanceId()).singleResult();if (processInstance != null) {//1、添加审批记录this.addComment(endVo.getUserCode(), endVo.getProcessInstanceId(), CommentTypeEnum.LCZZ.toString(),endVo.getMessage());List<EndEvent> endNodes = flowableBpmnModelService.findEndFlowElement(processInstance.getProcessDefinitionId());String endId = endNodes.get(0).getId();String processInstanceId = endVo.getProcessInstanceId();//2、执行终止List<Execution> executions = runtimeService.createExecutionQuery().parentId(processInstanceId).list();List<String> executionIds = new ArrayList<>();executions.forEach(execution -> executionIds.add(execution.getId()));this.moveExecutionsToSingleActivityId(executionIds, endId);returnVo = new ReturnVo<>(ReturnCode.SUCCESS, "终止成功");}else {returnVo = new ReturnVo<>(ReturnCode.FAIL, "不存在运行的流程实例,请确认!");}return returnVo;}