当前位置:网站首页>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.任务到达节点标红并显示图片。即将期待
边栏推荐
猜你喜欢
逻辑运算指令
~Introduction to form 80
Which is more important for programming, practice or theory [there are some things recently, I don't have time to write an article, so I'll post an article on hydrology, and I'll fill in later]
Fdog series (VI): use QT to communicate between the client and the client through the server (less information, recommended Collection)
Shell_ 01_ data processing
Full record of ByteDance technology newcomer training: a guide to the new growth of school recruitment
Simple records of business system migration from Oracle to opengauss database
Mp4 format details
Simply try the new amp model of deepfacelab (deepfake)
~68 Icon Font introduction
随机推荐
Many papers on ByteDance have been selected into CVPR 2021, and the selected dry goods are here
~78 radial gradient
Simply try the new amp model of deepfacelab (deepfake)
LeetCode 1637. The widest vertical area between two points without any point
「博士毕业一年,我拿下 ACL Best Paper」
koa中间件
~82 style of table
[unsolved] 7-15 shout mountain
7-6 sum of combinatorial numbers
LeetCode 1638. Count the number of substrings with only one character difference
Native JS realizes the functions of all selection and inverse selection -- Feng Hao's blog
~76 sprite map
亮相Google I/O,字节跳动是这样应用Flutter的
~83 form introduction
Li Kou leetcode 280 weekly match
Thank you for your invitation. I'm in the work area. I just handed in the code. I'm an intern in the next ByteDance
汇编语言段定义
LeetCode 1551. Minimum operand to make all elements in the array equal
~74 JD top navigation bar exercise
Usage of insert() in vector