当前位置:网站首页>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

ByteDance technical Interviewer: what kind of candidate do I want to pick most

Fdog series (III): use Tencent cloud SMS interface to send SMS, write database, deploy to server, web finale.

7-4 harmonic average

~74 JD top navigation bar exercise

Data config problem: the reference to entity 'useunicode' must end with ';' delimiter.

Detailed explanation of FLV format

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

~76 sprite map

~68 Icon Font introduction
随机推荐
LeetCode 1562. Find the latest group of size M
How to generate six digit verification code
"One year after graduation, I won ACL best paper"
LeetCode 1560. The sector with the most passes on the circular track
7-12 inventory code base
ByteDance open source Gan model compression framework, saving up to 97.8% of computing power - iccv 2021
逻辑运算指令
Li Kou leetcode 280 weekly match
Train 100 pictures for 1 hour, and the style of the photos changes at will. There is a demo at the end of the article | siggraph 2021
ByteDance new programmer's growth secret: those glittering treasures mentors
Jedis
LeetCode 1557. The minimum number of points that can reach all points
~71 abbreviation attribute of font
面试集锦库
README. txt
When it comes to Google i/o, this is how ByteDance is applied to flutter
100张图训练1小时,照片风格随意变,文末有Demo试玩|SIGGRAPH 2021
I'm "fixing movies" in ByteDance
redux使用说明
「博士毕业一年,我拿下 ACL Best Paper」