|
@@ -1,5 +1,6 @@
|
|
|
package com.cpp.web.service.accuracy.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.cpp.web.domain.accuracy.ShortTermSinglePointDeviation;
|
|
@@ -39,11 +40,9 @@ public class ShortTermSinglePointDeviationServiceImpl extends ServiceImpl<ShortT
|
|
|
|
|
|
List<ShortTermSinglePointDeviation> list = list(wrapper);
|
|
|
|
|
|
- Map<String, List<Double>> groupedByDate = list.stream()
|
|
|
+ Map<String, List<ShortTermSinglePointDeviation>> groupedByDate = list.stream()
|
|
|
.collect(Collectors.groupingBy(
|
|
|
- std -> sdf.format(std.getTime()),
|
|
|
- Collectors.mapping(std -> std.getDeviation().doubleValue(), Collectors.toList())
|
|
|
- ));
|
|
|
+ std -> sdf.format(std.getTime()), Collectors.toList()));
|
|
|
|
|
|
// 获取每一天,因为有没有数据都要展示出来
|
|
|
List<String> dateList = getDatesInRange(startTime, endTime);
|
|
@@ -58,7 +57,8 @@ public class ShortTermSinglePointDeviationServiceImpl extends ServiceImpl<ShortT
|
|
|
timeList.add(s);
|
|
|
if (groupedByDate.get(s) != null) {
|
|
|
// 转换为数组
|
|
|
- double[] array = groupedByDate.get(s).stream().mapToDouble(Double::doubleValue).toArray();
|
|
|
+// double[] array = groupedByDate.get(s).stream().mapToDouble(Double::doubleValue).toArray();
|
|
|
+ double[] array = groupedByDate.get(s).stream().map(ShortTermSinglePointDeviation::getDeviation).mapToDouble(m -> m.doubleValue()).toArray();
|
|
|
// 所需盒须值
|
|
|
Object[] result = plot(array,s);
|
|
|
dataList.add(result);
|
|
@@ -66,15 +66,21 @@ public class ShortTermSinglePointDeviationServiceImpl extends ServiceImpl<ShortT
|
|
|
double q3 = (Double) result[3];
|
|
|
double q1 = (Double)result[1];
|
|
|
|
|
|
- // 获取异常值
|
|
|
- List<Double> doubleList = groupedByDate.get(s).stream().filter(f -> f < q1 || f > q3).collect(Collectors.toList());
|
|
|
-
|
|
|
- if (doubleList.size() > 0) {
|
|
|
- for (Double v : doubleList) {
|
|
|
- List ycDataList = new ArrayList<>();
|
|
|
- ycDataList.add(s);
|
|
|
- ycDataList.add(v);
|
|
|
- abnormalList.add(ycDataList);
|
|
|
+ if (StrUtil.isBlankIfStr(stationCode)){
|
|
|
+
|
|
|
+ }else {
|
|
|
+ // 获取异常值
|
|
|
+ List<Double> doubleList = groupedByDate.get(s).stream()
|
|
|
+ .filter(f -> f.getDeviation().doubleValue() < q1 || f.getDeviation().doubleValue() > q3)
|
|
|
+ .map(f -> f.getDeviation().doubleValue()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (doubleList.size() > 0) {
|
|
|
+ for (Double v : doubleList) {
|
|
|
+ List ycDataList = new ArrayList<>();
|
|
|
+ ycDataList.add(s);
|
|
|
+ ycDataList.add(v);
|
|
|
+ abnormalList.add(ycDataList);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
} else {
|