修改自动推进节点

This commit is contained in:
jinqiming 2021-07-22 17:59:22 +08:00
parent 889909031c
commit 7ff6f1f7bb
13 changed files with 57 additions and 29 deletions

View File

@ -0,0 +1,8 @@
/**
* Minified by jsDelivr using Terser v5.3.5.
* Original file: /npm/js-base64@3.6.0/base64.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):function(){const r=e.Base64,o=t();o.noConflict=()=>(e.Base64=r,o),e.Meteor&&(Base64=o),e.Base64=o}()}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this,(function(){"use strict";const e="3.6.0",t="function"==typeof atob,r="function"==typeof btoa,o="function"==typeof Buffer,n="function"==typeof TextDecoder?new TextDecoder:void 0,a="function"==typeof TextEncoder?new TextEncoder:void 0,f=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],i=(e=>{let t={};return e.forEach(((e,r)=>t[e]=r)),t})(f),c=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,u=String.fromCharCode.bind(String),s="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,t=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(t)),d=e=>e.replace(/[+\/]/g,(e=>"+"==e?"-":"_")).replace(/=+$/m,""),l=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),h=e=>{let t,r,o,n,a="";const i=e.length%3;for(let i=0;i<e.length;){if((r=e.charCodeAt(i++))>255||(o=e.charCodeAt(i++))>255||(n=e.charCodeAt(i++))>255)throw new TypeError("invalid character found");t=r<<16|o<<8|n,a+=f[t>>18&63]+f[t>>12&63]+f[t>>6&63]+f[63&t]}return i?a.slice(0,i-3)+"===".substring(i):a},p=r?e=>btoa(e):o?e=>Buffer.from(e,"binary").toString("base64"):h,y=o?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,o=e.length;r<o;r+=4096)t.push(u.apply(null,e.subarray(r,r+4096)));return p(t.join(""))},A=(e,t=!1)=>t?d(y(e)):y(e),b=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?u(192|t>>>6)+u(128|63&t):u(224|t>>>12&15)+u(128|t>>>6&63)+u(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return u(240|t>>>18&7)+u(128|t>>>12&63)+u(128|t>>>6&63)+u(128|63&t)},g=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,B=e=>e.replace(g,b),x=o?e=>Buffer.from(e,"utf8").toString("base64"):a?e=>y(a.encode(e)):e=>p(B(e)),C=(e,t=!1)=>t?d(x(e)):x(e),m=e=>C(e,!0),U=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,F=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return u(55296+(t>>>10))+u(56320+(1023&t));case 3:return u((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return u((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},w=e=>e.replace(U,F),S=e=>{if(e=e.replace(/\s+/g,""),!c.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r,o,n="";for(let a=0;a<e.length;)t=i[e.charAt(a++)]<<18|i[e.charAt(a++)]<<12|(r=i[e.charAt(a++)])<<6|(o=i[e.charAt(a++)]),n+=64===r?u(t>>16&255):64===o?u(t>>16&255,t>>8&255):u(t>>16&255,t>>8&255,255&t);return n},E=t?e=>atob(l(e)):o?e=>Buffer.from(e,"base64").toString("binary"):S,v=o?e=>s(Buffer.from(e,"base64")):e=>s(E(e),(e=>e.charCodeAt(0))),D=e=>v(z(e)),R=o?e=>Buffer.from(e,"base64").toString("utf8"):n?e=>n.decode(v(e)):e=>w(E(e)),z=e=>l(e.replace(/[-_]/g,(e=>"-"==e?"+":"/"))),T=e=>R(z(e)),Z=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),j=function(){const e=(e,t)=>Object.defineProperty(String.prototype,e,Z(t));e("fromBase64",(function(){return T(this)})),e("toBase64",(function(e){return C(this,e)})),e("toBase64URI",(function(){return C(this,!0)})),e("toBase64URL",(function(){return C(this,!0)})),e("toUint8Array",(function(){return D(this)}))},I=function(){const e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Z(t));e("toBase64",(function(e){return A(this,e)})),e("toBase64URI",(function(){return A(this,!0)})),e("toBase64URL",(function(){return A(this,!0)}))},O={version:e,VERSION:"3.6.0",atob:E,atobPolyfill:S,btoa:p,btoaPolyfill:h,fromBase64:T,toBase64:C,encode:C,encodeURI:m,encodeURL:m,utob:B,btou:w,decode:T,isValid:e=>{if("string"!=typeof e)return!1;const t=e.replace(/\s+/g,"").replace(/=+$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},fromUint8Array:A,toUint8Array:D,extendString:j,extendUint8Array:I,extendBuiltins:()=>{j(),I()},Base64:{}};return Object.keys(O).forEach((e=>O.Base64[e]=O[e])),O}));
//# sourceMappingURL=/sm/8bca8602e2256d240cef904e1c1df432ccfdd2a2a73f6911c60be79e526e3e1e.map

View File

@ -22,6 +22,7 @@
<a id="scroll-up" href="#" class="btn btn-sm display"><i class="fa fa-angle-double-up"></i></a>
<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>
<script th:src="@{/js/base64.min.js}"></script>
<!-- bootstrap-table 表格插件 -->
<script th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=20200727}"></script>
<script th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=20200727}"></script>

View File

@ -23,7 +23,7 @@
<body class="signin">
<div class="signinpanel">
<div class="row">
<h1>欢迎使用 <strong>DingFLow 后台管理系统</strong></h1>
<h1>欢迎使用 <strong>DingFlow 后台管理系统</strong></h1>
</div>
<div class="row">
<div class="col-sm-8">

View File

@ -114,7 +114,6 @@
}
console.log(data);
$.operate.saveTab("/flow/finishTask", data);
$.operate.saveTab("/flow/finishTask", data);
}
}

View File

@ -55,7 +55,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">附件:</label>
<div class="col-sm-8">
<input type="hidden" name="fileUrl" id="filekey" th:value="*{appFrom.fileUrl}">
<input type="hidden" name="fileUrl" id="filekey" th:value="*{fileUrl}">
<div class="form-control-static">
<a id="fileName"></a>
</div>

View File

@ -4,21 +4,11 @@ import java.awt.*;
/**
* @author qimingjin
* @Title:
* @Title: 流程定义常量类
* @Description:
* @date 2020/11/25 11:14
*/
public class FlowConstants {
/**************************************************************************************/
/**
* 流程定义key
*/
public static final String SNOW_OA_LEAVE = "snow_oa_leave";
/**************************************************************************************/
/**
*流程通过变量名称

View File

@ -1,9 +1,9 @@
package com.snow.flowable.common.skipTask;
import com.snow.flowable.domain.CompleteTaskDTO;
import org.flowable.task.api.Task;
import com.snow.flowable.service.FlowableService;
import com.snow.flowable.domain.FinishTaskDTO;
import com.snow.flowable.service.FlowableTaskService;
import lombok.extern.slf4j.Slf4j;
import org.flowable.task.api.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -20,13 +20,12 @@ import java.util.List;
public abstract class AbstractSkipTask {
@Autowired
private FlowableService flowableService;
private FlowableTaskService flowableTaskService;
public boolean execute(Task task) {
log.info("@@检查节点是否能自动处理。节点={}, taskId={}", task.getName(), task.getId());
if (canSkip(task)) {
log.info("自动跳过节点");
doSkip(task);
return true;
}
@ -38,13 +37,18 @@ public abstract class AbstractSkipTask {
private void doSkip(Task task) {
log.info("执行自动跳过节点");
CompleteTaskDTO taskParameter = getTaskParameter(task);
flowableService.completeTask(taskParameter);
log.info("@@执行自动跳过节点");
FinishTaskDTO taskParameter = getTaskParameter(task);
flowableTaskService.submitTask(taskParameter);
}
protected CompleteTaskDTO getTaskParameter(Task task){
CompleteTaskDTO completeTaskDTO=new CompleteTaskDTO();
/**
* 自动完成任务时需要传入的参数
* @param task 任务对象
* @return 封装的提交完成任务参数
*/
protected FinishTaskDTO getTaskParameter(Task task){
FinishTaskDTO completeTaskDTO=new FinishTaskDTO();
completeTaskDTO.setTaskId(task.getId());
completeTaskDTO.setIsPass(true);
completeTaskDTO.setComment("系统自动完成");
@ -54,5 +58,9 @@ public abstract class AbstractSkipTask {
protected abstract String getProcessDefinitionKey();
/**
* 需要跳过的任务节点
* @return 返回跳过的任务节点list
*/
protected abstract List<String> getTaskKeys();
}

View File

@ -12,8 +12,8 @@ import java.util.Map;
/**
* @author qimingjin
* @Title:
* @Description:
* @Title: 自动任务注册
* @Description: 项目启动时读取所有继承AbstractSkipTask抽象类的实现类按照配置规则注册到table,在TaskSkipService获取值
* @date 2021/1/11 10:11
*/
@Service

View File

@ -12,8 +12,8 @@ import java.util.List;
/**
* @author qimingjin
* @Title:
* @Description:
* @Title: 任务自动跳过服务
* @Description: 任务自动跳过服务
* @date 2021/1/11 10:24
*/
@Slf4j

View File

@ -1,5 +1,6 @@
package com.snow.flowable.listener.purchaseOrder;
import com.google.common.collect.Lists;
import com.snow.flowable.common.enums.FlowDefEnum;
import com.snow.flowable.common.skipTask.AbstractSkipTask;
import lombok.extern.slf4j.Slf4j;
@ -8,6 +9,12 @@ import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author qimingjin
* @Title: 自动跳过节点
* @Description:
* @date 2021/7/22 19:13
*/
@Service
@Slf4j
public class PurchaseAutoApprovalTask extends AbstractSkipTask {
@ -25,6 +32,6 @@ public class PurchaseAutoApprovalTask extends AbstractSkipTask {
@Override
protected List<String> getTaskKeys() {
return null;
return Lists.newArrayList("userTask3");
}
}

View File

@ -78,6 +78,7 @@ public interface FlowableService {
* @param startProcessDTO
* @return
*/
@Deprecated
ProcessInstance startProcessInstanceByKey(StartProcessDTO startProcessDTO);
/**

View File

@ -17,6 +17,7 @@ import com.snow.common.exception.BusinessException;
import com.snow.flowable.common.constants.FlowConstants;
import com.snow.flowable.common.enums.FlowDefEnum;
import com.snow.flowable.common.enums.FlowInstanceEnum;
import com.snow.flowable.common.skipTask.TaskSkipService;
import com.snow.flowable.config.ICustomProcessDiagramGenerator;
import com.snow.flowable.domain.*;
import com.snow.flowable.service.FlowableService;
@ -122,6 +123,9 @@ public class FlowableServiceImpl implements FlowableService {
@Resource
private FlowableTaskService flowableTaskService;
@Resource
private TaskSkipService taskSkipService;
@Override
public void saveModel(ActDeModel actDeModel) {
// 构建ModelEditorSource
@ -301,6 +305,8 @@ public class FlowableServiceImpl implements FlowableService {
}
//这个方法最终使用一个ThreadLocal类型的变量进行存储也就是与当前的线程绑定所以流程实例启动完毕之后需要设置为null防止多线程的时候出问题
identityService.setAuthenticatedUserId(null);
//自动推进任务
taskSkipService.autoSkip(processInstance.getProcessInstanceId());
return processInstance;
}
@ -316,6 +322,8 @@ public class FlowableServiceImpl implements FlowableService {
//这个方法最终使用一个ThreadLocal类型的变量进行存储也就是与当前的线程绑定所以流程实例启动完毕之后需要设置为null防止多线程的时候出问题
identityService.setAuthenticatedUserId(null);
//自动推进任务
taskSkipService.autoSkip(processInstance.getProcessInstanceId());
return processInstance;
}

View File

@ -5,6 +5,7 @@ import com.snow.common.core.page.PageModel;
import com.snow.common.exception.BusinessException;
import com.snow.common.utils.bean.MyBeanUtils;
import com.snow.flowable.common.constants.FlowConstants;
import com.snow.flowable.common.skipTask.TaskSkipService;
import com.snow.flowable.domain.*;
import com.snow.flowable.service.FlowableService;
import com.snow.flowable.service.FlowableTaskService;
@ -66,6 +67,9 @@ public class FlowableTaskServiceImpl implements FlowableTaskService {
@Autowired
private AppFormServiceImpl appFormService;
@Autowired
private TaskSkipService taskSkipService;
@Override
public PageModel<TaskVO> findTasksByUserId(String userId, TaskBaseDTO taskBaseDTO) {
//根据用户ID获取角色
@ -271,6 +275,8 @@ public class FlowableTaskServiceImpl implements FlowableTaskService {
taskService.claim(task.getId(),finishTaskDTO.getUserId());
taskService.complete(task.getId(),paramMap,true);
}
//推进自动推动的节点
taskSkipService.autoSkip(task.getProcessInstanceId());
}
@Override