feat(flowable): 添加待办任务数量统计功能
在FlowQueryVo中新增category字段用于流程分类筛选 实现待办任务数量统计接口,支持按分类筛选统计
This commit is contained in:
@@ -58,6 +58,12 @@ public class FlowTaskController {
|
||||
return flowTaskService.todoList(queryVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取待办数量统计", response = Integer.class)
|
||||
@GetMapping(value = "/todoCount")
|
||||
public AjaxResult todoCount(FlowQueryVo queryVo) {
|
||||
return flowTaskService.todoCount(queryVo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取已办任务", response = FlowTaskDto.class)
|
||||
@GetMapping(value = "/finishedList")
|
||||
public AjaxResult finishedList(FlowQueryVo queryVo) throws Exception {
|
||||
|
||||
@@ -35,5 +35,7 @@ public class FlowQueryVo {
|
||||
@ApiModelProperty("每页条数")
|
||||
private Integer pageSize;
|
||||
|
||||
@ApiModelProperty("流程分类(category)")
|
||||
private String category;
|
||||
|
||||
}
|
||||
|
||||
@@ -130,6 +130,14 @@ public interface IFlowTaskService {
|
||||
*/
|
||||
AjaxResult todoList(FlowQueryVo queryVo);
|
||||
|
||||
/**
|
||||
* 待办任务数量统计
|
||||
*
|
||||
* @param queryVo 请求参数
|
||||
* @return
|
||||
*/
|
||||
AjaxResult todoCount(FlowQueryVo queryVo);
|
||||
|
||||
|
||||
/**
|
||||
* 已办任务列表
|
||||
|
||||
@@ -785,6 +785,40 @@ public class FlowTaskServiceImpl extends FlowServiceFactory implements IFlowTask
|
||||
return AjaxResult.success(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待办任务数量统计
|
||||
*
|
||||
* @param queryVo 请求参数
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult todoCount(FlowQueryVo queryVo) {
|
||||
SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
||||
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||
.active()
|
||||
.includeProcessVariables()
|
||||
.taskCandidateGroupIn(sysUser.getRoles().stream().map(role -> role.getRoleId().toString()).collect(Collectors.toList()))
|
||||
.taskCandidateOrAssigned(sysUser.getUserId().toString())
|
||||
.orderByTaskCreateTime().desc();
|
||||
|
||||
List<Task> taskList = taskQuery.list();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
int count = 0;
|
||||
for (Task task : taskList) {
|
||||
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
|
||||
.processDefinitionId(task.getProcessDefinitionId())
|
||||
.singleResult();
|
||||
String category = pd.getCategory();
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(queryVo.getCategory())) {
|
||||
if (!queryVo.getCategory().equals(category)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
return AjaxResult.success(count);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 已办任务列表
|
||||
|
||||
Reference in New Issue
Block a user