当前位置:网站首页>Activiti目录(五)驳回、重新发起、取消流程
Activiti目录(五)驳回、重新发起、取消流程
2022-07-06 09:30:00 【爱机车的程序猿】
目录
一、审核人驳回流程
| 思路 | |
|---|---|
| 根据流程实例ID和当前用户ID查询流程任务是否存在 | |
| 1.根据当前人员设置驳回节点状态 | |
| 存在 | 2.驳回节点状态退回审核任务到发起人 |
| – | – |
| 不存在 | 返回不成功状态码 |
/** * 驳回申请 * @param userId 用户ID * @param processInstanceId 流程实例ID * @return */
public Task rejectTest(String userId,String processInstanceId) {
// 查询当前审批节点
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).taskInvolvedUser(userId).singleResult();
if(null != task){
// 设置流程参数
Map<String, Object> args = new HashMap<>();
String assignee = task.getName();
args.put("applyState", Constants.EPIDEMIC_APPLY_STATE_BH);// 驳回状态
args.put("applyExamine", assignee);// 驳回任务节点
// 完成审批任务
taskService.complete(task.getId(), args);
}
// 返回修改后业务信息
return task;
}
二、重新发起流程
| 思路 | |
|---|---|
| 根据流程实例ID和当前用户ID查询流程任务是否存在 | |
| 1.根据当前人员设置重新申请节点状态 | |
| 存在 | 2.获取驳回人员信息 |
| 3.通过节点状态、驳回人员信息重新申请回到审核人员继续审核 | |
| – | – |
| 1.返回审核节点状态 | |
| 不存在 | 2.用原有业务逻辑进行重新申请 |
/** * * 重新申请 * @param userId 用户Id * @param processInstanceId 流程实例Id * @return 状态值 */
public String backProcessTest(String userId,String processInstanceId){
//设置流程参数:审批ID
Map<String, Object> args = new HashMap<>();
String applyExamine = runtimeService.getVariable(processInstanceId, "applyExamine")+""; //查看variable常量表
args.put("applyState", "6");
args.put("applyExamine", applyExamine);
//查询当前审批节点
Task task = taskService.createTaskQuery().processInstanceId(processInstanceId).taskAssignee(userId).singleResult();
//完成审批任务
if(null != task) {
taskService.complete(task.getId(), args);
return applyExamine;
}
return "";
}
三、取消流程
| 思路 | |
|---|---|
| 根据流程实例ID获取流程实例是否还在执行 | |
| 1.获取审核节点状态(是否审核中还是审核通过) | |
| 存在 | 2.根据审核节点状态判断中途取消、审核通过取消 |
| 3.结束流程实例 | |
| – | – |
| 1.返回审核节点状态 | |
| 不存在 | 2.业务代码处理流程业务表 |
/** * 取消申请 * @param userId 用户ID * @param processInstanceId 流程实例Id * @return 状态值 */
public Integer withdrawTest(String userId,String processInstanceId){
// 流程实例是否在执行
Execution execution = runtimeService.createExecutionQuery().parentId(processInstanceId).singleResult();
//查看variable常量表
int applyState = Integer.parseInt(runtimeService.getVariable(processInstanceId, "applyState")+"");
// 判断中途、审核通过撤销
applyState = applyState < 3 ? Constants.EPIDEMIC_APPLY_STATE_ZTCX : Constants.EPIDEMIC_APPLY_STATE_CX;
if(!Objects.isNull(execution)){
//学生取消,结束流程
runtimeService.deleteProcessInstance(execution.getProcessInstanceId(), "学生"+userId+"取消申请");
}
return applyState;
}
三、实例代码
审核人员查询代办任务:


审核人员驳回流程:


流程退回到发起人


重新发起申请

驳回人员查看代办


取消流程申请
查询代办任务:
取消流程:
取消人员查询任务时没有流程信息了
工作流程画图、部署、启动流程、查询代办/已办/已通过、审核、驳回、重新发起、取消申请讲解工作流的重要性
彩蛋:
1.整合Bpmnjs画图工具。
2.任务到达节点标红并显示图片。即将期待
边栏推荐
- Erlang installation
- LeetCode 1561. The maximum number of coins you can get
- LeetCode 1545. Find the k-th bit in the nth binary string
- After the subscript is used to assign a value to the string type, the cout output variable is empty.
- 这群程序员中的「广告狂人」,把抖音广告做成了AR游戏
- 字节跳动技术新人培训全记录:校招萌新成长指南
- LeetCode 1584. Minimum cost of connecting all points
- ~Introduction to form 80
- Shell_ 02_ Text three swordsman
- 7-4 harmonic average
猜你喜欢

README. txt

Shell_ 00_ First meeting shell

Some instructions on whether to call destructor when QT window closes and application stops

Shell_ 05_ operator

Shell_ 03_ environment variable

谢邀,人在工区,刚交代码,在下字节跳动实习生

When it comes to Google i/o, this is how ByteDance is applied to flutter

8086 CPU 内部结构

Basic principles of video compression coding and audio compression coding

Simply try the new amp model of deepfacelab (deepfake)
随机推荐
Shell_ 04_ Shell script
7-7 ring the stupid bell
How to configure hosts when setting up Eureka
LeetCode 1561. The maximum number of coins you can get
Two weeks' experience of intermediate software designer in the crash soft exam
was unable to send heartbeat
Simple records of business system migration from Oracle to opengauss database
Shell_ 03_ environment variable
Continue and break jump out of multiple loops
After the subscript is used to assign a value to the string type, the cout output variable is empty.
~81 long table
I'm "fixing movies" in ByteDance
Gridhome, a static site generator that novices must know
[unsolved]7-14 calculation diagram
冯诺依曼体系结构
README. txt
(multiple methods, need to continue to see) 7-11 go deep into the tiger's Den
姚班智班齐上阵,竞赛高手聚一堂,这是什么神仙编程大赛?
LeetCode 1640. Can I connect to form an array
LeetCode 1550. There are three consecutive arrays of odd numbers