当前位置: 首页 > news >正文

基于jeecg-boot的flowable流程自定义业务退回撤回或驳回到发起人后的再次流程提交

更多nbcio-boot功能请看演示系统

gitee源代码地址

后端代码: https://gitee.com/nbacheng/nbcio-boot

前端代码:https://gitee.com/nbacheng/nbcio-vue.git

在线演示(包括H5) : http://122.227.135.243:9888
 

     主要用户有些需求,需要自定义业务退回或撤回或驳回到发起人后能再次进行流程的提交,所以今天就解决这个问题。

    1、前端

      前端主要提供一个可以让用户进行选择再次提交的方法,同时检测是否是退回或撤回或驳回到发起人的节点

  

<style lang="less">
</style>
<template><span><a-button :type="btnType" @click="applySubmit()">{{text}}</a-button><a-modal :z-index="100" :title="firstInitiatorTitle" @cancel="firstInitiatorOpen = false" :visible.sync="firstInitiatorOpen":width="'50%'" append-to-body><a-descriptions bordered layout="vertical"><a-descriptions-item :span="3"><a-badge status="processing" text="选择提醒" /></a-descriptions-item><a-descriptions-item label="重新发起新流程按钮" labelStyle="{ color: '#fff', fontWeight: 'bold', fontSize='18px'}"> 重新发起新流程会删除之前发起的任务,重新开始.</a-descriptions-item><a-descriptions-item label="继续发起老流程按钮"> 继续发起流程就在原来流程基础上继续流转.</a-descriptions-item></a-descriptions>   <span slot="footer" class="dialog-footer"><el-button type="primary" @click="StartByDataId(true)">重新发起新流程</el-button><el-button type="primary" @click="StartByDataId(false)">继续发起老流程</el-button><el-button @click="firstInitiatorOpen = false">取 消</el-button></span></a-modal></span>
</template><script>import {definitionStartByDataId,isFirstInitiator,deleteActivityAndJoin} from "@views/flowable/api/definition";export default {name: 'ActApplyBtn',components: {},props: {btnType: {type: String,default: 'link',required: false},/**/dataId: {type: String,default: '',required: true},serviceName: {type: String,default: '',required: true},variables: {type: Object,default: {},},text: {type: String,default: '提交申请',required: false}},data() {return {modalVisible: false,submitLoading: false,form: {},firstInitiatorOpen: false,firstInitiatorTitle: '',};},created() {},watch: {},methods: {StartByDataId(isNewFlow) {if(isNewFlow) {this.submitLoading = true;deleteActivityAndJoin(this.dataId,this.variables).then(res => {if (res.success && res.result) { //若删除成功var params = Object.assign({dataId: this.dataId}, this.variables);definitionStartByDataId(this.dataId, this.serviceName, params).then(res => {if (res.success) {this.firstInitiatorOpen = false;this.$message.success(res.message);this.$emit('success');} else {this.$message.error(res.message);}})}}).finally(() => (this.submitLoading = false));}     else {//继续原有流程流转,跳到流程处理界面上console.log("this.variables",this.variables);this.$router.push({ path: '/flowable/task/record/index',query: {procInsId: this.variables.processInstanceId,deployId: this.variables.deployId,taskId: this.variables.taskId,businessKey: this.dataId,nodeType: "",category: "zdyyw",finished: true}})}},applySubmit() {if (this.dataId && this.dataId.length < 1) {this.error = '必须传入参数dataId';this.$message.error(this.error);return;}if (this.serviceName && this.serviceName.length < 1) {this.error = '必须传入参数serviceName';this.$message.error(this.error);return;} else {this.error = '';}//对于自定义业务,判断是否是驳回或退回的第一个发起人节点this.submitLoading = true;isFirstInitiator(this.dataId, this.variables).then(res => {if (res.success && res.result) { //若是,弹出窗口选择重新发起新流程还是继续老流程this.firstInitiatorTitle = "根据自己需要进行选择"this.firstInitiatorOpen = true;}else {this.submitLoading = true;var params = Object.assign({dataId: this.dataId}, this.variables);definitionStartByDataId(this.dataId, this.serviceName, params).then(res => {if (res.success) {this.$message.success(res.message);this.$emit('success');} else {this.$message.error(res.message);}}).finally(() => (this.submitLoading = false));}}).finally(() => (this.submitLoading = false));}}};
</script>

效果如下:

2、后端代码

   

 /*** 判断当前节点是否是第一个发起人节点(目前只针对自定义业务的驳回、撤回和退回操作)** @param processInstanceId, actStatusType*/@Overridepublic boolean isFirstInitiator(String processInstanceId, String actStatusType) {if(StringUtils.equalsAnyIgnoreCase(actStatusType, ActStatus.reject) ||StringUtils.equalsAnyIgnoreCase(actStatusType, ActStatus.recall) ||StringUtils.equalsAnyIgnoreCase(actStatusType, ActStatus.retrun) ) {if(StringUtils.isNotEmpty(processInstanceId)) {//  获取当前任务Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).singleResult();BpmnModel bpmnModel = repositoryService.getBpmnModel(task.getProcessDefinitionId());//  获取当前活动节点FlowNode currentFlowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(task.getTaskDefinitionKey());// 输入连线List<SequenceFlow> inFlows = currentFlowNode.getIncomingFlows();for (SequenceFlow sequenceFlow : inFlows) {FlowElement sourceFlowElement = sequenceFlow.getSourceFlowElement();// 如果上个节点为开始节点if (sourceFlowElement instanceof StartEvent) {log.info("当前节点为发起人节点,上个节点为开始节点:id=" + sourceFlowElement.getId() + ",name=" + sourceFlowElement.getName());return true;}}}}return false;	}

http://www.lryc.cn/news/165646.html

相关文章:

  • python如何学习
  • Centos7更新php7.2版本升级
  • 操作系统学习笔记---计算机系统概述
  • uniapp H5 navigateBack无法返回上一层级
  • Android性能优化之应用瘦身(APK瘦身)
  • C语言数组和指针笔试题(二)(一定要看)
  • uniapp——实现在线选座功能——技能提升
  • 领域驱动设计:微服务的各种边界
  • MySQL之数据类型
  • 词法作用域改变词法作用域
  • 关于C++的隐藏 (hidden),重载(overload),重写(override)小结。
  • 算法通关村18关 | 透析回溯的模板
  • 【论文阅读】Untargeted Backdoor Attack Against Object Detection(针对目标检测的无目标后门攻击)
  • 分库分表---理论
  • [golang 流媒体在线直播系统] 2.搭建基于golang的流媒体服务器实现拉流推流,以及Html客户端拉取hls类型的流
  • 9月12日作业
  • React框架下如何集成H.265网页流媒体视频播放器EasyPlayer.js?
  • 《向量数据库》——向量数据库的使用场景有哪些?
  • Java 中 List 集合取补集
  • 我的个人网站——宏夏Coding上线啦
  • 【机器视觉】喇叭的外圆以及金属内圆的同心度视觉检测--康耐德智能
  • STM32WB55开发(2)----修改蓝牙地址
  • 【1++的C++进阶】之C++11(二)
  • 【VS2022】调试
  • python:使用RESTful API(flask)调用python程序传递参数,实现Web端调用python程序
  • 贪心算法(Greedy Algorithm)
  • 论文阅读 - Outlier detection in social networks leveraging community structure
  • 【操作系统】进程控制
  • Linux命令200例:expr一个用于进行数值表达式求值的工具
  • 当你的公司突然开始大量的裁员,被留下的你,真的准备好面对以后了吗?