本文主要是介绍基于若依的ruoyi-nbcio流程管理系统自定义业务流程出现多个时相应的流程选择问题(二),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
更多ruoyi-nbcio功能请看演示系统
gitee源代码地址
前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio
演示地址:RuoYi-Nbcio后台管理系统
更多nbcio-boot功能请看演示系统
gitee源代码地址
后端代码: https://gitee.com/nbacheng/nbcio-boot
前端代码:https://gitee.com/nbacheng/nbcio-vue.git
在线演示(包括H5) : http://122.227.135.243:9888
接上一节
5、选择相应的流程后进行处理
selectProcess(row) {this.selectFlowId = row.id;this.flowOpen = false;var params = Object.assign({dataId: this.dataId}, this.variables);startByDataId(this.dataId, this.selectFlowId, this.serviceName, params).then(res => {//console.log("startByDataId res",res);if (res.code == 200 ) {this.$message.success(res.msg);this.$emit('success');} else {this.$message.error(res.msg);}}).finally(() => (this.submitLoading = false));},
6、相应的后端启动流程也要做调整
/*** 根据流程dataId,serviceName启动流程实例,主要是自定义业务表单发起流程使用* add by nbacheng* @param dataId,serviceName* * @param variables* 流程变量* @return*/@Override@Transactional(rollbackFor = Exception.class)public R<Void> startProcessByDataId(String dataId, String selectFlowId, String serviceName, Map<String, Object> variables) {//提交审批的时候进行流程实例关联初始化if (StringUtils.isEmpty(selectFlowId)){return R.fail("未找到关联流程selectFlowId:"+selectFlowId);}WfCustomFormVo wfCustomFormvo = wfCustomFormService.queryById(Long.valueOf(selectFlowId));if(ObjectUtil.isEmpty(wfCustomFormvo)){return R.fail("未找到wfCustomFormvo:"+selectFlowId);}//优先考虑自定义业务表是否关联流程,再看通用的表单流程关联表ProcessDefinition processDefinition;String deployId = wfCustomFormvo.getDeployId(); //临时先用一个,实际要返回list前端进行选择if(StringUtils.isEmpty(deployId)) {WfDeployForm sysDeployForm = deployFormMapper.selectSysDeployFormByFormId("key_"+String.valueOf(wfCustomFormvo.getId()));if(sysDeployForm ==null){ return R.fail("自定义表单也没关联流程定义表,流程没定义关联自定义表单"+wfCustomFormvo.getId());}processDefinition = repositoryService.createProcessDefinitionQuery().parentDeploymentId(sysDeployForm.getDeployId()).latestVersion().singleResult();}else {processDefinition = repositoryService.createProcessDefinitionQuery().parentDeploymentId(deployId).latestVersion().singleResult();}try {LambdaQueryWrapper<WfMyBusiness> wfMyBusinessLambdaQueryWrapper = new LambdaQueryWrapper<>();wfMyBusinessLambdaQueryWrapper.eq(WfMyBusiness::getDataId, dataId);WfMyBusiness business = wfMyBusinessService.getOne(wfMyBusinessLambdaQueryWrapper);if (business==null || (business != null && business.getActStatus().equals(ActStatus.stop)) || (business != null && business.getActStatus().equals(ActStatus.recall))){if(processDefinition==null) {return R.fail("自定义表单也没关联流程定义表,流程没定义关联自定义表单"+wfCustomFormvo.getId());}boolean binit = wfCommonService.initActBusiness(wfCustomFormvo.getBusinessName(), dataId, serviceName, processDefinition.getKey(), processDefinition.getId(), wfCustomFormvo.getRouteName());if(!binit) {return R.fail("自定义表单也没关联流程定义表,流程没定义关联自定义表单"+wfCustomFormvo.getId());}WfMyBusiness businessnew = wfMyBusinessService.getOne(wfMyBusinessLambdaQueryWrapper);//流程实例关联初始化结束if (StrUtil.isNotBlank(businessnew.getProcessDefinitionId())){return this.startProcessByDefId(businessnew.getProcessDefinitionId(),variables);}return this.startProcessByDefKey(businessnew.getProcessDefinitionKey(),variables);}else {return R.fail("已经存在这个dataid实例,不要重复申请:"+dataId);}} catch (Exception e) {e.printStackTrace();throw new RuntimeException();} }
7、效果图
选择流程
这样选择不同的流程,实际走的也不一样了
这篇关于基于若依的ruoyi-nbcio流程管理系统自定义业务流程出现多个时相应的流程选择问题(二)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!