首页 > 其他分享 >基于jeecgboot的flowable流程增加节点自动跳过功能

基于jeecgboot的flowable流程增加节点自动跳过功能

时间:2023-02-28 11:37:06浏览次数:38  
标签:org flowable 流程 FlowComment jeecgboot import 跳过


为了满足有时候需要在某个节点没有人员处理的时候需要自动跳过,所以增加了这个功能。

一、FlowComment意见里增加一个类型8,跳过流程

/**
* 流程意见类型
*
*/
public enum FlowComment { /**
* 说明
*/
NORMAL("1", "正常意见"),
REBACK("2", "退回意见"),
REJECT("3", "驳回意见"),
DELEGATE("4", "委派意见"),
ASSIGN("5", "转办意见"),
STOP("6", "终止流程"),
RECALL("7","撤回意见"),
SKIP("8","跳过流程");


二、写一个流程自动跳过的任务监听器,当然可以根据自己需要的逻辑进行编写

 下面的逻辑是任务处理人为空的时候自动跳过

package com.nbcio.modules.flowable.listener;

import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.TaskService;
import org.flowable.engine.delegate.TaskListener;

import org.flowable.task.service.delegate.DelegateTask;
import org.jeecg.common.util.SpringContextUtils;

import com.nbcio.modules.flowable.common.enums.FlowComment;

/**
* 自动跳过流程任务监听
* @author nbacheng
* @date 2023-02-18
*/

public class AutoSkipTaskListener implements TaskListener{

private TaskService taskService = SpringContextUtils.getBean(TaskService.class);

@Override
public void notify(DelegateTask delegateTask) {
String processInstanceId = delegateTask.getProcessInstanceId();
String taskId = delegateTask.getId();
// 流程实例为空则结束
if(StringUtils.isBlank(processInstanceId) && StringUtils.isBlank(taskId)){
return;
}
if(StringUtils.isBlank(delegateTask.getAssignee())){
// 添加处理意见
taskService.addComment(taskId, processInstanceId,FlowComment.SKIP.getType(), FlowComment.SKIP.getRemark() + ":审批人为空字段跳过");
// 自动审批通过
taskService.complete(taskId);
}

}

}

三、前端处理

显示意见的地方增加下面代码

<el-tag type="warning" v-if="commentitem.type === '8'"> {{commentitem.comment}}</el-tag>  <!--跳过信息-->

四、需要跳过的节点增加任务监听器,如下图所示

基于jeecgboot的flowable流程增加节点自动跳过功能_监听器

 同时设置对应的这个节点审批人为空

五、效果图

基于jeecgboot的flowable流程增加节点自动跳过功能_监听器_02

 

标签:org,flowable,流程,FlowComment,jeecgboot,import,跳过
From: https://blog.51cto.com/u_15070324/6090610

相关文章