springboot+flowable入门第四篇
对应哔哩哔哩的第六集
https://www.bilibili.com/video/BV1rg411N7QJ?p=6
对应代码码云地址
https://gitee.com/fjdaima/flowable_study01
1.查询自己的任务
/**
* 查看任务表
*/
@RequestMapping("/query/task")
public String queryTask(){
TaskService taskService = processEngine.getTaskService();
Task task = taskService.createTaskQuery().taskAssignee("张三").singleResult();
Map<String, Object> processVariables = taskService.getVariables(task.getId());
System.out.println("员工名字"+processVariables.get("employee"));
System.out.println("员工请假天数"+processVariables.get("nrOfHolidays"));
System.out.println("员工理由"+processVariables.get("description"));
return "成功";
}
2.完成自己的任务
/**
* 完成自己的任务
*/
@RequestMapping("/complete/task")
public String completeTask(){
TaskService taskService = processEngine.getTaskService();
String taskId = "5008";
taskService.complete(taskId);
return "成功";
}
2.查看自己的历史任务
/**
* 查看自己的历史
*/
@RequestMapping("/history/task")
public String historyTask(){
String name = "张三";
HistoryService historyService = processEngine.getHistoryService();
List<HistoricTaskInstance> list = historyService.createHistoricTaskInstanceQuery().taskAssignee(name).list();
for (HistoricTaskInstance historicTaskInstance: list){
System.out.println(historicTaskInstance.getName() + "=====" +new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(historicTaskInstance.getEndTime()));
}
return "成功";
}
参考他人文章
https://blog.csdn.net/Master_chaoAndQi/article/details/80639362