|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.cpp.web.domain.accuracy.ShortTermSinglePointDeviation;
|
|
|
import com.cpp.web.mapper.accuracy.ShortTermSinglePointDeviationMapper;
|
|
|
import com.cpp.web.service.accuracy.ShortTermSinglePointDeviationService;
|
|
|
+import com.cpp.web.utils.DateTimeUtil;
|
|
|
import org.springframework.security.core.parameters.P;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -44,31 +45,38 @@ public class ShortTermSinglePointDeviationServiceImpl extends ServiceImpl<ShortT
|
|
|
Collectors.mapping(std -> std.getDeviation().doubleValue(), Collectors.toList())
|
|
|
));
|
|
|
|
|
|
+ // 获取每一天,因为有没有数据都要展示出来
|
|
|
+ List<String> dateList = DateTimeUtil.getDatesInRange(startTime, endTime);
|
|
|
|
|
|
List dataList = new ArrayList<>();
|
|
|
List timeList = new ArrayList<>();
|
|
|
List abnormalList = new ArrayList<>();
|
|
|
- for (Map.Entry<String, List<Double>> listMap : groupedByDate.entrySet()) {
|
|
|
-
|
|
|
- timeList.add(listMap.getKey());
|
|
|
- // 转数组
|
|
|
- double[] array = listMap.getValue().stream().mapToDouble(Double::doubleValue).toArray();
|
|
|
- // 所需盒须值
|
|
|
- double[] result = plot(array);
|
|
|
- dataList.add(result);
|
|
|
- double max = result[result.length - 1];double min = result[0];
|
|
|
-
|
|
|
- List<Double> doubleList = listMap.getValue().stream().filter(f -> f < min && f > max).collect(Collectors.toList());
|
|
|
- if (doubleList.size() > 0) {
|
|
|
- for (Double v : doubleList) {
|
|
|
- List ceShiList = new ArrayList<>();
|
|
|
- ceShiList.add(listMap.getKey());
|
|
|
- ceShiList.add(v);
|
|
|
- abnormalList.add(ceShiList);
|
|
|
+
|
|
|
+ for (String s : dateList) {
|
|
|
+ timeList.add(s);
|
|
|
+ if (groupedByDate.get(s) != null) {
|
|
|
+ // 转换为数组
|
|
|
+ double[] array = groupedByDate.get(s).stream().mapToDouble(Double::doubleValue).toArray();
|
|
|
+ // 所需盒须值
|
|
|
+ double[] result = plot(array);
|
|
|
+ dataList.add(result);
|
|
|
+
|
|
|
+ double max = result[result.length - 1];double min = result[0];
|
|
|
+ // 获取异常值
|
|
|
+ List<Double> doubleList = groupedByDate.get(s).stream().filter(f -> f < min && f > max).collect(Collectors.toList());
|
|
|
+ List ycDataList = new ArrayList<>();
|
|
|
+ if (doubleList.size() > 0) {
|
|
|
+ for (Double v : doubleList) {
|
|
|
+ ycDataList.add(s);
|
|
|
+ ycDataList.add(v);
|
|
|
+ abnormalList.add(ycDataList);
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ dataList.add("");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("result", dataList);
|
|
|
map.put("time", timeList);
|