当前位置:网站首页>Activiti目录(四)查询代办/已办、审核
Activiti目录(四)查询代办/已办、审核
2022-07-06 09:30:00 【爱机车的程序猿】
把Activiti打入你的脑袋,通过查询代办/已办、审核快速打入
目录
一、审核代办/已办
| 功能 | 思路 |
|---|---|
| 1.查询当前用户 | |
| 代办 | 2.根据当前用户ID获取待审核任务 |
| 3.返回待审核任务信息 | |
| – | – |
| 1.查询当前用户 | |
| 已办 | 2.根据当前用户ID获取历史审核任务 |
| 3.返回历史审核任务信息 |
/** * 审核列表 * TODO 1:查询用户及权限 * TODO 2:查询用户审核状态 * TODO 3:获取当前用户待办任务流程 * TODO 4:根据任务实例ID查询业务表信息 * TODO 5:返回业务信息 * @return */
public DataGridPojo ingProessList(String applyState,String userId) {
// 当前登录用户信息
// User user = (User) this.session.getAttribute("currentLoginUser");
// Long userId = Long.valueOf(user.getUserId());
// Object userIds1 = runtimeService.getVariable(task.getProcessInstanceId() + "", "userIds1"); //查看variable常量表
List Result = new ArrayList();
if(applyState.equals("待审核")){
// 查看当前用户待审核记录
List<Task> tasks = taskService.createTaskQuery().taskInvolvedUser(userId)
.orderByTaskCreateTime().desc()
.list();// 代办列表
Result = tasks;
}else if(applyState.equals("已审核") || applyState.equals("审核通过")){
// 已办审核记录
List<HistoricTaskInstance> histTaskList = historyService.createHistoricTaskInstanceQuery().taskInvolvedUser(userId)
.orderByHistoricTaskInstanceStartTime().desc()
.list();// 已办列表
// 审核过记录ssss
List<HistoricTaskInstance> histTaskApproveds = histTaskList.stream().filter(h -> "epidemicGroup".equals(h.getName()) && null != h.getEndTime()).collect(Collectors.toList());
Result = applyState.equals("已审核")
? histTaskList : histTaskApproveds;
}
DataGridPojo dataGridPojo = new DataGridPojo();
dataGridPojo.setRows(Result);
return dataGridPojo;
}
二、签收代办(审核)
| 思路 | |
|---|---|
| 根据流程实例ID和当前用户ID查询流程任务是否存在 | |
| 存在 | 1.根据当前人员设置审核节点状态 |
| 2.通过节点状态完成审核任务 | |
| – | – |
| 不存在 | 返回不成功状态码 |
/** * 审核 * @param user 用户信息 * @param apply 业务信息 */
public int aduit(User user,Apply apply){
// 用户ID
if(null == user) return -1;
//查询当前审批节点
Task task = taskService.createTaskQuery().processInstanceId(apply.getProcessInstanceId()).taskInvolvedUser(user.getUserId()+"").singleResult();
int state = -1;
if(null != task) {
//设置流程参数:审批ID
Map<String, Object> args = new HashMap<>();
switch (task.getName()){
case "teacher":
state = Constants.EPIDEMIC_APPLY_STATE_LSSH;
break;
case "academy":
state=Constants.EPIDEMIC_APPLY_STATE_XSCSH;
break;
case "epidemicGroup":
state=Constants.EPIDEMIC_APPLY_STATE_GZXZSH;
break;
}
args.put("applyState", state);//设置流程参数
// 设置审批任务的执行人
taskService.setAssignee(task.getId(),user.getUserId() + "");
try {
//完成审批任务
taskService.complete(task.getId(), args);
} catch (Exception e) {
log.error(e.getMessage());
return -1;
}
}
return state;
}
三、实例代码
代办:

已办:

审核代办:


查代办看是否完成:
查已办是否存在:
边栏推荐
- Shell_ 04_ Shell script
- 面试集锦库
- Alibaba cloud server builds SVN version Library
- Business system compatible database oracle/postgresql (opengauss) /mysql Trivia
- QT system learning series: 1.2 style sheet sub control lookup
- Mongodb在node中的使用
- ~87 animation
- 亮相Google I/O,字节跳动是这样应用Flutter的
- 我走过最迷的路,是字节跳动程序员的脑回路
- Gridhome, a static site generator that novices must know
猜你喜欢

逻辑运算指令

Native JS realizes the functions of all selection and inverse selection -- Feng Hao's blog

"One year after graduation, I won ACL best paper"

LeetCode 1584. Minimum cost of connecting all points

The daemon thread starts redis and modifies the configuration file

Alibaba cloud server builds SVN version Library

字节跳动海外技术团队再夺冠:高清视频编码已获17项第一

算数运算指令

ByteDance 2022 school recruitment R & D advance approval publicity meeting, students' top 10 issues

字节跳动技术面试官现身说法:我最想pick什么样的候选人
随机推荐
One hundred questions of image processing (1-10)
LeetCode 1638. Count the number of substrings with only one character difference
Detailed explanation of FLV format
~Introduction to form 80
我走过最迷的路,是字节跳动程序员的脑回路
Fdog series (V): use QT to imitate QQ to realize login interface to main interface, function chapter.
LeetCode 1636. Sort the array in ascending order by frequency
Typescript basic operations
@RequestMapping、@GetMapping
ByteDance open source Gan model compression framework, saving up to 97.8% of computing power - iccv 2021
谢邀,人在工区,刚交代码,在下字节跳动实习生
Error occurred during initialization of VM Could not reserve enough space for object heap
逻辑运算指令
亮相Google I/O,字节跳动是这样应用Flutter的
Full record of ByteDance technology newcomer training: a guide to the new growth of school recruitment
Fdog series (III): use Tencent cloud SMS interface to send SMS, write database, deploy to server, web finale.
Soft music -js find the number of times that character appears in the string - Feng Hao's blog
Cmake Express
One hundred questions of image processing (11-20)
我在字节跳动「修电影」