Merge branch 'dev'

This commit is contained in:
wangliwen 2022-10-12 15:57:33 +08:00
commit 500b68d429
1 changed files with 39 additions and 0 deletions

View File

@ -15,11 +15,19 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.TaskService;
import org.activiti.engine.repository.ProcessDefinition;
import org.activiti.engine.repository.ProcessDefinitionQuery;
import org.activiti.engine.task.TaskQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
@ -35,6 +43,13 @@ public class ActTaskController {
private ActTaskService actTaskService;
@Autowired
private SysUserService sysUserService;
@Autowired
private JdbcTemplate jdbcTemplate;
@Autowired
protected RepositoryService repositoryService;
@Autowired
protected TaskService taskService;
/**
* 获取用户任务列表
@ -85,6 +100,30 @@ public class ActTaskController {
return new Result<PageData<TaskDTO>>().ok(page);
}
@GetMapping("myToDoTaskNum")
@ApiOperation("我的待办数目")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskName", value = "任务名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "processDefinitionKey", value = "流程定义KEY", paramType = "query", dataType = "String")
})
public Result<Map<String, Long>> myToDoTaskNum(@ApiIgnore @RequestParam Map<String, Object> params) {
Map<String, Long> result = new LinkedHashMap<>();
params.put("userId", SecurityUser.getUserId().toString());
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery()
.orderByProcessDefinitionId().desc().orderByProcessDefinitionKey().desc();
processDefinitionQuery.latestVersion();
List<ProcessDefinition> processDefinitionList = processDefinitionQuery.list(); // 获取所有流程模型 获取流程key
processDefinitionList.stream().forEach(index -> {
TaskQuery taskQuery = taskService.createTaskQuery();
taskQuery.processDefinitionKey(index.getKey()); // 流程模型key
taskQuery.taskAssignee(SecurityUser.getUserId().toString());
taskQuery.active();
result.put(index.getKey(), taskQuery.count());
});
result.put("meetingroom_book", jdbcTemplate.queryForObject("SELECT COUNT(id) FROM t_meetingroom_book WHERE state = 1;", Long.class));
return new Result<Map<String, Long>>().ok(result);
}
@GetMapping("deptToDoTaskPage")
@ApiOperation("部门待办列表")
@LogOperation("部门待办列表查询")