首页待办任务

This commit is contained in:
gaojiabao
2023-05-11 20:00:14 +08:00
parent 81b05b01fc
commit e57527bce7
@@ -290,6 +290,91 @@ public class TodoTaskController extends BaseAction {
return todoList;
}
@ApiOperation(value = "我的待办任务列表首页")
@ApiImplicitParams({@ApiImplicitParam(name = "name", value = "名称"),
@ApiImplicitParam(name = "current", value = "当前页"),
@ApiImplicitParam(name = "size", value = "每页条数"),
@ApiImplicitParam(name = "userId", value = "用户Id")})
@PostMapping("/todoTaskListShow")
public List<BusProcessName> todoTaskListByUserIdShow(@RequestBody TaskCommonQuery taskCommonQuery) {
// 创建查询对象
NativeTaskQuery nativeTaskQuery = taskTodoService.createSql(taskCommonQuery);
int current = taskCommonQuery.getCurrent();
int size = taskCommonQuery.getSize();
long total = nativeTaskQuery.list().size();
if (ChkUtil.isNotNull(taskCommonQuery.getName()) || ChkUtil.isNotNull(taskCommonQuery.getStartTime())
|| ChkUtil.isNotNull(taskCommonQuery.getEndTime())) {
current = 1;
}
// 获取查询列表
// List<Task> list = nativeTaskQuery.listPage((current - 1) * size, size);
List<Task> list = nativeTaskQuery.list();
List<Map<String, Object>> listEnd = ActivitiTools.turnTasks(list);
for (Map<String, Object> map : listEnd) {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(map.get("processDefinitionId") + "").singleResult();
map.put("processInstanceName", processDefinition.getName());
//接受任务时间
// map.put("acceptTime",);
}
Set<String> prdSet = new HashSet();
Map<String, List<Map<String, Object>>> resutMap = new LinkedHashMap<>();
for (Map<String, Object> map : listEnd) {
String key = map.get("name").toString() + "," + map.get("processInstanceId").toString();
if (resutMap.get(key) == null) {
List<Map<String, Object>> value = new ArrayList<>();
value.add(map);
resutMap.put(key, value);
} else {
List<Map<String, Object>> value = resutMap.get(key);
value.add(map);
resutMap.put(key, value);
}
}
List<BusProcessName> todoList = new ArrayList<>();
for (Map.Entry<String, List<Map<String, Object>>> entry : resutMap.entrySet()) {
String prcId = entry.getKey().split(",")[1];
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("PRC_ID", prcId);
if (taskCommonQuery.getPrcNum() != null && !taskCommonQuery.getPrcNum().equals("")) {
queryWrapper.like("PRC_NUM", taskCommonQuery.getPrcNum());
}
if (taskCommonQuery.getPrcName() != null && !taskCommonQuery.getPrcName().equals("")) {
queryWrapper.like("PRC_NAME", taskCommonQuery.getPrcName());
}
if (taskCommonQuery.getPrcType() != null && !taskCommonQuery.getPrcType().equals("")) {
queryWrapper.eq("PRC_TYPE", taskCommonQuery.getPrcType());
}
BusProcessName busProcessName = iBusProcessNameService.getOne(queryWrapper);
String taskIds = "";
for (Map<String, Object> map : entry.getValue()) {
if (busProcessName != null) {
BusProcessName res=new BusProcessName();
BeanUtils.copyProperties(busProcessName,res);
res.setTaskIds(map.get("id").toString());
res.setTaskInfo(entry.getValue().get(0).get("name").toString());
res.setTaskAssignee(entry.getValue().get(0).get("assignee").toString());
res.setMes(null);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String data = sdf.format(entry.getValue().get(0).get("createTime"));
res.setAcceptTime(data);
// //获取新的流程名称
// QueryWrapper<BusProcessNew> queryWrapper1=new QueryWrapper<>();
// queryWrapper1.eq("P_ID",res.getPrcId());
// queryWrapper1.eq("TASK_ID",res.getTaskIds());
// BusProcessNew busProcessNew=iBusProcessNewService.getOne(queryWrapper1);
// res.setPrcName(busProcessNew != null ? (StringUtils.isNotBlank(busProcessNew.getPrcName()) ? busProcessNew.getPrcName() : "") : "" );
todoList.add(res);
}
}
}
return todoList;
}
@ApiOperation(value = "我的待办任务列表速度优化项")
@ApiImplicitParams({@ApiImplicitParam(name = "name", value = "名称"),