由于群里有些朋友对这个flowable还不是很熟悉,师傅(小学生05101)制作一个开源的项目源码,一共大家学习和交流,希望对有帮助,少走弯路 如果有不懂的问题可以入群:633168411 里面都是一些热心肠的人。
项目地址 | https://gitee.com/lwj/flowable.git |
---|
代码分支 | flowable-base |
视频讲解地址 | https://www.bilibili.com/video/av78129693/ |
用户名 | 密码 |
---|
0000001 | test |
0000002 | test |
0000003 | test |
0000004 | test |
1. 演示
2. 代码分享
public ReturnVo<String> revokeProcess(RevokeVo revokeVo) {ReturnVo<String> returnVo = new ReturnVo<>(ReturnCode.FAIL, "撤回失败!");if (StringUtils.isNotBlank(revokeVo.getProcessInstanceId())) {ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(revokeVo.getProcessInstanceId()).singleResult();if (processInstance != null) {//1.添加撤回意见this.addComment(revokeVo.getUserCode(), revokeVo.getProcessInstanceId(), CommentTypeEnum.CH.toString(), revokeVo.getMessage());//2.设置提交人runtimeService.setVariable(revokeVo.getProcessInstanceId(), FlowConstant.FLOW_SUBMITTER_VAR, processInstance.getStartUserId());//3.执行撤回Activity disActivity = flowableBpmnModelService.findActivityByName(processInstance.getProcessDefinitionId(), FlowConstant.FLOW_SUBMITTER);//4.删除运行和历史的节点信息this.deleteActivity(disActivity.getId(), revokeVo.getProcessInstanceId());//5.执行跳转List<Execution> executions = runtimeService.createExecutionQuery().parentId(revokeVo.getProcessInstanceId()).list();List<String> executionIds = new ArrayList<>();executions.forEach(execution -> executionIds.add(execution.getId()));this.moveExecutionsToSingleActivityId(executionIds, disActivity.getId());returnVo = new ReturnVo<>(ReturnCode.SUCCESS, "撤回成功!");}} else {returnVo = new ReturnVo<>(ReturnCode.FAIL, "流程实例id不能为空!");}return returnVo;}