feat(flowable): 添加待办任务数量统计功能

在FlowQueryVo中新增category字段用于流程分类筛选
实现待办任务数量统计接口,支持按分类筛选统计
This commit is contained in:
2026-04-01 14:29:27 +08:00
parent e78c34c94f
commit 6e4c089625
4 changed files with 50 additions and 0 deletions

View File

@@ -35,5 +35,7 @@ public class FlowQueryVo {
@ApiModelProperty("每页条数")
private Integer pageSize;
@ApiModelProperty("流程分类(category)")
private String category;
}

View File

@@ -130,6 +130,14 @@ public interface IFlowTaskService {
*/
AjaxResult todoList(FlowQueryVo queryVo);
/**
* 待办任务数量统计
*
* @param queryVo 请求参数
* @return
*/
AjaxResult todoCount(FlowQueryVo queryVo);
/**
* 已办任务列表

View File

@@ -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);
}
/**
* 已办任务列表