Commit 8f15e50d authored by hanbing's avatar hanbing

[update] 新信号评价-修改运行评价热力图方向处理方式

parent 58a94e96
......@@ -535,10 +535,24 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
default:
throw new IllegalArgumentException("状态值非法");
}
// 过滤 status 字段值为 status 变量的对象,并按照选择的字段分组
// 过滤 status 字段值为 status 变量的对象,并按照方向分组
Map<String, List<CrossDataHistPO>> grouped = crossDataHistPOList.stream()
.filter(po -> status.equals(po.getStatus()))
.collect(Collectors.groupingBy(groupByField));
.flatMap(po -> {
String dirs = "";
if (status == 1) {
dirs = po.getUnbalanceDirs();
} else if (status == 2) {
dirs = po.getCongestionDirs();
} else if (status == 3) {
dirs = po.getSpilloverDirs();
}
return Arrays.stream(dirs.split(","))
.map(dir -> new AbstractMap.SimpleEntry<>(dir, po));
})
.collect(Collectors.groupingBy(
Map.Entry::getKey,
Collectors.mapping(Map.Entry::getValue, Collectors.toList())
));
// 对每个组进行处理,仅保留 start_time 相同的记录中 duration 最大的一条
Map<String, List<CrossDataHistPO>> filteredGrouped = grouped.entrySet().stream()
.collect(Collectors.toMap(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment