Commit 4d6a9f1d by HlQ

[chg] 任务人员分析计算逻辑修改

1 parent fc5cf70a
...@@ -457,7 +457,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem ...@@ -457,7 +457,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
List<FaultLog> logList = faultLogService.lambdaQuery().list(); List<FaultLog> logList = faultLogService.lambdaQuery().list();
Map<Long, Double> taskId2HourMap = logList.stream() Map<Long, Double> taskId2HourMap = logList.stream()
.filter(l -> ObjUtil.isNotNull(l.getManHour())) .filter(l -> ObjUtil.isNotNull(l.getManHour()))
.collect(Collectors.groupingBy(FaultLog::getTaskId, Collectors.summingDouble(FaultLog::getManHour))); .collect(Collectors.groupingBy(FaultLog::getOperator, Collectors.summingDouble(FaultLog::getManHour)));
// 根据工单日志,判断工单完成人 // 根据工单日志,判断工单完成人
var user2TaskIdMap = logList.stream() var user2TaskIdMap = logList.stream()
...@@ -469,7 +469,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem ...@@ -469,7 +469,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
Map<Long, List<Task>> p2TaskMap = taskList.stream().collect(Collectors.groupingBy(Task::getActiveUser)); Map<Long, List<Task>> p2TaskMap = taskList.stream().collect(Collectors.groupingBy(Task::getActiveUser));
var resList = new ArrayList<Map<String, Object>>(); var resList = new ArrayList<Map<String, Object>>();
p2TaskMap.forEach((p, list) -> { p2TaskMap.forEach((p, list) -> {
var hourSum = list.stream().mapToDouble(v -> taskId2HourMap.getOrDefault(v.getId(), 0D)).sum(); var hourSum = taskId2HourMap.getOrDefault(p, 0D);
var inList = list.stream().filter(v -> v.getStatus().equals(2)).toList(); var inList = list.stream().filter(v -> v.getStatus().equals(2)).toList();
var expList = inList.stream().filter(v -> v.getExpDate().isAfter(LocalDate.now())).toList(); var expList = inList.stream().filter(v -> v.getExpDate().isAfter(LocalDate.now())).toList();
...@@ -477,7 +477,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem ...@@ -477,7 +477,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
var storeIdSet = list.stream().map(Task::getStoreId).collect(Collectors.toSet()); var storeIdSet = list.stream().map(Task::getStoreId).collect(Collectors.toSet());
var storeNameList = storeList.stream().filter(v -> storeIdSet.contains(v.getId())).distinct().map(Store::getName).collect(Collectors.joining(",")); var storeNameList = storeList.stream().filter(v -> storeIdSet.contains(v.getId())).distinct().map(Store::getName).collect(Collectors.joining(","));
Map<String, Object> cntMap = Map.of("person", id2UsernameMap.get(p), Map<String, Object> cntMap = Map.of("person", id2UsernameMap.get(p),
"total", list, "total", CollUtil.unionDistinct(finishList, inList),
"finish", finishList, "finish", finishList,
"in", inList, "in", inList,
"exp", expList, "exp", expList,
...@@ -486,7 +486,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem ...@@ -486,7 +486,7 @@ public class TaskServiceImpl extends MPJBaseServiceImpl<TaskMapper, Task> implem
resList.add(cntMap); resList.add(cntMap);
}); });
// resList 按照 total对应的list的size降序排列 // resList 按照 total对应的list的size降序排列
resList.sort((o1, o2) -> ((List<Task>) o2.get("total")).size() - ((List<Task>) o1.get("total")).size()); resList.sort((o1, o2) -> ((Set<Task>) o2.get("total")).size() - ((Set<Task>) o1.get("total")).size());
return resList; return resList;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!