工作流实战_08_flowable 流程实例的启动
生活随笔
收集整理的這篇文章主要介紹了
工作流实战_08_flowable 流程实例的启动
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
| 代碼分支 | flowable-base |
| 視頻講解地址 | https://space.bilibili.com/485524575/channel/detail?cid=94579 |
| 0000001 | test |
| 0000002 | test |
| 0000003 | test |
| 0000004 | test |
文章目錄
- 1. 演示
1. 演示
### 2. 代碼
public ReturnVo<ProcessInstance> startProcessInstanceByKey(StartProcessInstanceVo params) {ReturnVo<ProcessInstance> returnVo = new ReturnVo<>(ReturnCode.SUCCESS, "啟動成功");if (StringUtils.isNotBlank(params.getProcessDefinitionKey())&& StringUtils.isNotBlank(params.getBusinessKey())&& StringUtils.isNotBlank(params.getSystemSn())) {ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionKey(params.getProcessDefinitionKey()).latestVersion().singleResult();if (processDefinition != null && processDefinition.isSuspended()) {returnVo = new ReturnVo<>(ReturnCode.FAIL, "此流程已經掛起,請聯系系統管理員!");return returnVo;}/*** 1、設置變量* 1.1、設置提交人字段為空字符串讓其自動跳過* 1.2、設置可以自動跳過* 1.3、匯報線的參數設置*///1.1、設置提交人字段為空字符串讓其自動跳過params.getVariables().put(FlowConstant.FLOW_SUBMITTER_VAR, "");//1.2、設置可以自動跳過params.getVariables().put(FlowConstant.FLOWABLE_SKIP_EXPRESSION_ENABLED, true);// TODO 1.3、匯報線的參數設置//2、當我們流程創建人和發起人String creator = params.getCreator();if (StringUtils.isBlank(creator)) {creator = params.getCurrentUserCode();params.setCreator(creator);}//3.啟動流程identityService.setAuthenticatedUserId(creator);ProcessInstance processInstance = runtimeService.createProcessInstanceBuilder().processDefinitionKey(params.getProcessDefinitionKey().trim()).name(params.getFormName().trim()).businessKey(params.getBusinessKey().trim()).variables(params.getVariables()).tenantId(params.getSystemSn().trim()).start();returnVo.setData(processInstance);//4.添加審批記錄this.addComment(params.getCurrentUserCode(), processInstance.getProcessInstanceId(),CommentTypeEnum.TJ.toString(), params.getFormName() + "提交");//5.TODO 推送消息數據} else {returnVo = new ReturnVo<>(ReturnCode.FAIL, "請填寫 這三個字段 ProcessDefinitionKey,BusinessKey,SystemSn");}return returnVo;}總結
以上是生活随笔為你收集整理的工作流实战_08_flowable 流程实例的启动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: (vue基础试炼_02)使用vue.js
- 下一篇: Centos7 查看/关闭/启动防火墙