|
@@ -57,40 +57,58 @@ public class ShortTermSinglePointDeviationServiceImpl extends ServiceImpl<ShortT
|
|
List abnormalList = new ArrayList<>();
|
|
List abnormalList = new ArrayList<>();
|
|
|
|
|
|
Map<String, List<List>> deviationMap = new HashMap<>();
|
|
Map<String, List<List>> deviationMap = new HashMap<>();
|
|
|
|
+ Set<String> stationIds;
|
|
|
|
+ List<ElectricField> electricFieldList=null;
|
|
|
|
+ if (StrUtil.isBlankIfStr(stationCode)) {
|
|
|
|
+ electricFieldList = electricFieldService.list();
|
|
|
|
+ stationIds = new HashSet<>();
|
|
|
|
+ for (ElectricField electricField : electricFieldList) {
|
|
|
|
+ stationIds.add(electricField.getStationCode());
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ stationIds = null;
|
|
|
|
+ }
|
|
|
|
+
|
|
for (String s : dateList) {
|
|
for (String s : dateList) {
|
|
timeList.add(s);
|
|
timeList.add(s);
|
|
if (groupedByDate.get(s) != null) {
|
|
if (groupedByDate.get(s) != null) {
|
|
- double[] array = groupedByDate.get(s).stream().map(ShortTermSinglePointDeviation::getDeviation).mapToDouble(m -> m.doubleValue()).toArray();
|
|
|
|
- // 所需盒须值
|
|
|
|
- Object[] result = plot(array, s);
|
|
|
|
- dataList.add(result);
|
|
|
|
if (StrUtil.isBlankIfStr(stationCode)) {
|
|
if (StrUtil.isBlankIfStr(stationCode)) {
|
|
- List<ElectricField> electricFieldList = electricFieldService.list();
|
|
|
|
- double min = (Double) result[0];
|
|
|
|
- double max = (Double) result[4];
|
|
|
|
- // 每天的获取异常值
|
|
|
|
- List<ShortTermSinglePointDeviation> shortTermSinglePointDeviationList = groupedByDate.get(s).stream()
|
|
|
|
- .filter(f -> f.getDeviation().doubleValue() < min || f.getDeviation().doubleValue() > max).collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
- // 遍历异常
|
|
|
|
- for (ShortTermSinglePointDeviation shortTermSinglePointDeviation : shortTermSinglePointDeviationList) {
|
|
|
|
- List<Object> ycDataList = new ArrayList<>();
|
|
|
|
- ycDataList.add(DateUtil.format(shortTermSinglePointDeviation.getTime(), "yyyy-MM-dd"));
|
|
|
|
- ycDataList.add(shortTermSinglePointDeviation.getDeviation());
|
|
|
|
- shortTermSinglePointDeviation.getStationCode();
|
|
|
|
- ElectricField electricField = electricFieldList.stream().filter(e -> e.getStationCode().equals(shortTermSinglePointDeviation.getStationCode())).findFirst().get();
|
|
|
|
-
|
|
|
|
- if (deviationMap.get(electricField.getName()) != null) {
|
|
|
|
- List<List> deviationList = deviationMap.get(electricField.getName());
|
|
|
|
- deviationList.add(ycDataList);
|
|
|
|
- } else {
|
|
|
|
- List<List> deviationList = new ArrayList<>();
|
|
|
|
- deviationList.add(ycDataList);
|
|
|
|
- deviationMap.put(electricField.getName(), deviationList);
|
|
|
|
|
|
+ double[] array = groupedByDate.get(s).stream().filter(stationData -> stationIds.contains(stationData.getStationCode())).map(ShortTermSinglePointDeviation::getDeviation).mapToDouble(m -> m.doubleValue()).toArray();
|
|
|
|
+ if (array.length>0){
|
|
|
|
+ // 所需盒须值
|
|
|
|
+ Object[] result = plot(array, s);
|
|
|
|
+ dataList.add(result);
|
|
|
|
+ double min = (Double) result[0];
|
|
|
|
+ double max = (Double) result[4];
|
|
|
|
+ // 每天的获取异常值
|
|
|
|
+ List<ShortTermSinglePointDeviation> shortTermSinglePointDeviationList = groupedByDate.get(s).stream()
|
|
|
|
+ .filter(f -> f.getDeviation().doubleValue() < min || f.getDeviation().doubleValue() > max).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ // 遍历异常
|
|
|
|
+ for (ShortTermSinglePointDeviation shortTermSinglePointDeviation : shortTermSinglePointDeviationList) {
|
|
|
|
+ List<Object> ycDataList = new ArrayList<>();
|
|
|
|
+ ycDataList.add(DateUtil.format(shortTermSinglePointDeviation.getTime(), "yyyy-MM-dd"));
|
|
|
|
+ ycDataList.add(shortTermSinglePointDeviation.getDeviation());
|
|
|
|
+ shortTermSinglePointDeviation.getStationCode();
|
|
|
|
+ ElectricField electricField = electricFieldList.stream().filter(e -> e.getStationCode().equals(shortTermSinglePointDeviation.getStationCode())).findFirst().get();
|
|
|
|
+
|
|
|
|
+ if (deviationMap.get(electricField.getName()) != null) {
|
|
|
|
+ List<List> deviationList = deviationMap.get(electricField.getName());
|
|
|
|
+ deviationList.add(ycDataList);
|
|
|
|
+ } else {
|
|
|
|
+ List<List> deviationList = new ArrayList<>();
|
|
|
|
+ deviationList.add(ycDataList);
|
|
|
|
+ deviationMap.put(electricField.getName(), deviationList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
map.put("abnormal", deviationMap);
|
|
map.put("abnormal", deviationMap);
|
|
} else {
|
|
} else {
|
|
|
|
+ double[] array = groupedByDate.get(s).stream().map(ShortTermSinglePointDeviation::getDeviation).mapToDouble(m -> m.doubleValue()).toArray();
|
|
|
|
+ // 所需盒须值
|
|
|
|
+ Object[] result = plot(array, s);
|
|
|
|
+ dataList.add(result);
|
|
double q3 = (Double) result[3];
|
|
double q3 = (Double) result[3];
|
|
double q1 = (Double) result[1];
|
|
double q1 = (Double) result[1];
|
|
abnormalList.addAll(accuracyPlotAbnormal(groupedByDate, s, q1, q3));
|
|
abnormalList.addAll(accuracyPlotAbnormal(groupedByDate, s, q1, q3));
|