|
@@ -2,6 +2,7 @@ package com.jjt.biz.controller;
|
|
|
|
|
|
import com.jjt.biz.domain.*;
|
|
|
import com.jjt.biz.service.*;
|
|
|
+import com.jjt.biz.util.DataUtil;
|
|
|
import com.jjt.biz.vo.BizAccessVO;
|
|
|
import com.jjt.biz.vo.BizTypeVO;
|
|
|
import com.jjt.biz.vo.HlScoreVO;
|
|
@@ -126,7 +127,7 @@ public class IndexController extends BaseController {
|
|
|
map.put("score", scores);
|
|
|
result.add(map);
|
|
|
}
|
|
|
- standTime(standTime, result);
|
|
|
+ DataUtil.standTimeMap(standTime, result);
|
|
|
return success(result);
|
|
|
}
|
|
|
|
|
@@ -161,44 +162,10 @@ public class IndexController extends BaseController {
|
|
|
map.put("score", scores);
|
|
|
result.add(map);
|
|
|
}
|
|
|
- standTime(standTime, result);
|
|
|
+ DataUtil.standTimeMap(standTime, result);
|
|
|
return success(result);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 补数据
|
|
|
- *
|
|
|
- * @param standTime
|
|
|
- * @param result
|
|
|
- */
|
|
|
- private void standTime(List<String> standTime, List<Map<String, Object>> result) {
|
|
|
- for (Map<String, Object> map : result) {
|
|
|
- // 创建一个新的 times 和 scores 列表,以确保它们与标准时间序列对齐
|
|
|
- List<String> alignedTimes = new ArrayList<>();
|
|
|
- List<Float> alignedScores = new ArrayList<>();
|
|
|
- // 使用一个Map来存储原始数据,以便快速查找
|
|
|
- Map<String, Float> timeScoreMap = new HashMap<>();
|
|
|
- List<String> times = (List<String>) map.get("time");
|
|
|
- List<Float> scores = (List<Float>) map.get("score");
|
|
|
- for (int i = 0; i < times.size(); i++) {
|
|
|
- timeScoreMap.put(times.get(i), scores.get(i));
|
|
|
- }
|
|
|
- // 遍历标准时间序列,并根据需要添加空值或实际值
|
|
|
- for (String time : standTime) {
|
|
|
- alignedTimes.add(time);
|
|
|
- // 添加时间
|
|
|
- Float score = timeScoreMap.getOrDefault(time, 100F);
|
|
|
- // 如果没有对应的分数,则添加0.0f
|
|
|
- alignedScores.add(score);
|
|
|
- }
|
|
|
-
|
|
|
- // 更新原有的 times 和 scores 列表
|
|
|
- times.clear();
|
|
|
- times.addAll(alignedTimes);
|
|
|
- scores.clear();
|
|
|
- scores.addAll(alignedScores);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
@ApiOperation("应用健康趋势-按天")
|
|
|
@GetMapping("/hl/day/{date}")
|
|
@@ -242,7 +209,7 @@ public class IndexController extends BaseController {
|
|
|
result.add(map);
|
|
|
}
|
|
|
|
|
|
- standTime(standTime, result);
|
|
|
+ DataUtil.standTimeMap(standTime, result);
|
|
|
return success(result);
|
|
|
}
|
|
|
|