Parcourir la source

对风偏差状态修改

王波 il y a 2 mois
Parent
commit
bf594ed65b

+ 47 - 9
runeconomy-xk/src/main/java/com/gyee/runeconomy/service/WindDirection/WindDirectionService.java

@@ -52,7 +52,11 @@ public class WindDirectionService {
         // 初始化设备点
         Map<EquipmentPointType, ProBasicEquipmentPoint> points = Arrays.stream(EquipmentPointType.values())
                 .collect(Collectors.toMap(type -> type, type -> getEquipmentPoint(wtid, type)));
-
+        if (collect.size() > 0) {
+            points.remove(EquipmentPointType.YQZT);
+        } else {
+            points.remove(EquipmentPointType.EQZT);
+        }
         // 获取历史数据
         Map<EquipmentPointType, List<TsDoubleData>> historyData = points.entrySet().stream()
                 .collect(Collectors.toMap(Map.Entry::getKey,
@@ -61,8 +65,16 @@ public class WindDirectionService {
         // 创建时间戳到数据的映射表
         Map<Long, TsDoubleData> pjfsMap = historyData.get(EquipmentPointType.PJFS).stream()
                 .collect(Collectors.toMap(TsDoubleData::getTs, Function.identity(), (a, b) -> a));
-        Map<Long, TsDoubleData> sbztMap = historyData.get(EquipmentPointType.SBZT).stream()
-                .collect(Collectors.toMap(TsDoubleData::getTs, Function.identity(), (a, b) -> a));
+//        Map<Long, TsDoubleData> sbztMap = historyData.get(EquipmentPointType.SBZT).stream()
+//                .collect(Collectors.toMap(TsDoubleData::getTs, Function.identity(), (a, b) -> a));
+        Map<Long, TsDoubleData> sbztMap = null;
+        if (collect.size() == 0) {
+            sbztMap = historyData.get(EquipmentPointType.YQZT).stream()
+                    .collect(Collectors.toMap(TsDoubleData::getTs, Function.identity(), (a, b) -> a));
+        } else {
+            sbztMap = historyData.get(EquipmentPointType.EQZT).stream()
+                    .collect(Collectors.toMap(TsDoubleData::getTs, Function.identity(), (a, b) -> a));
+        }
         Map<Long, TsDoubleData> dfwcMap = historyData.get(EquipmentPointType.DFWC).stream()
                 .collect(Collectors.toMap(TsDoubleData::getTs, Function.identity(), (a, b) -> a));
         Map<Long, TsDoubleData> phjdMap = historyData.get(EquipmentPointType.PHJD).stream()
@@ -156,6 +168,12 @@ public class WindDirectionService {
             if (timeBW == DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN)) {
                 timeBW = item.getTime();
             }
+
+            if (collect.size() == 0 && item.getMxzt() == 0) {
+                item.setMxzt(2);
+            } else if (collect.size() > 0 && item.getMxzt() == 5){
+                item.setMxzt(2);
+            }
             // 过滤非并网值  风机状态不等于2
             if (filter == 0 && isfbw && item.getMxzt() != 2) {
                 filter = 1;
@@ -260,10 +278,10 @@ public class WindDirectionService {
             map.put("wt", obj.getAname());
             map.put("ys", WindALG.fxNewRoses(filterls));//风速、风向
             map.put("speeedtime", WindALG.speedtimeNewRoses(filterls));//风速
-            map.put("roses", WindALG.fxysNewRoses(filterls));//风速、风向
-            map.put("count", WindALG.fxNewCountRoses(filterls));//风速、风向
-            map.put("radar", WindALG.fxRadarRoses(filterls,collect));//对风误差
-            map.put("frequency", WindALG.windDeviationPoint(filterls)); //风速、风向、明细状态、功率、偏航角度
+            map.put("roses", WindALG.fxysNewRoses(filterls));//风速风向玫瑰图——风速、风向
+            map.put("count", WindALG.fxNewCountRoses(filterls));//风向频次玫瑰图——风速、风向
+            map.put("radar", WindALG.fxRadarRoses(filterls,collect));//风向频次雷达图——对风误差
+            map.put("frequency", WindALG.windDeviationPoint(filterls)); //静态偏航对风分析——风速、风向、明细状态、功率、偏航角度
             result.add(map);
         }
 
@@ -290,6 +308,11 @@ public class WindDirectionService {
         Map<EquipmentPointType, ProBasicEquipmentPoint> points = Arrays.stream(EquipmentPointType.values())
                 .collect(Collectors.toMap(type -> type, type -> getEquipmentPoint(wtid, type)));
 
+        if (equipments.size() > 0) {
+            points.remove(EquipmentPointType.YQZT);
+        } else {
+            points.remove(EquipmentPointType.EQZT);
+        }
         // 获取历史数据
         Map<EquipmentPointType, List<TsDoubleData>> historyData = points.entrySet().stream()
                 .collect(Collectors.toMap(Map.Entry::getKey,
@@ -298,8 +321,15 @@ public class WindDirectionService {
         // 创建时间戳到数据的映射表
         Map<Long, TsDoubleData> pjfsMap = historyData.get(EquipmentPointType.PJFS).stream()
                 .collect(Collectors.toMap(TsDoubleData::getTs, Function.identity(), (a, b) -> a));
-        Map<Long, TsDoubleData> sbztMap = historyData.get(EquipmentPointType.SBZT).stream()
-                .collect(Collectors.toMap(TsDoubleData::getTs, Function.identity(), (a, b) -> a));
+        Map<Long, TsDoubleData> sbztMap = null;
+        if (equipments.size() == 0) {
+            sbztMap = historyData.get(EquipmentPointType.YQZT).stream()
+                    .collect(Collectors.toMap(TsDoubleData::getTs, Function.identity(), (a, b) -> a));
+        } else {
+            sbztMap = historyData.get(EquipmentPointType.EQZT).stream()
+                    .collect(Collectors.toMap(TsDoubleData::getTs, Function.identity(), (a, b) -> a));
+        }
+
         Map<Long, TsDoubleData> dfwcMap = historyData.get(EquipmentPointType.DFWC).stream()
                 .collect(Collectors.toMap(TsDoubleData::getTs, Function.identity(), (a, b) -> a));
         Map<Long, TsDoubleData> phjdMap = historyData.get(EquipmentPointType.PHJD).stream()
@@ -393,6 +423,12 @@ public class WindDirectionService {
             if (timeBW == DateUtil.format(new Date(0), DateUtil.DATE_TIME_PATTERN)) {
                 timeBW = item.getTime();
             }
+
+            if (equipments.size() == 0 && item.getMxzt() == 0) {
+                item.setMxzt(2);
+            } else if (equipments.size() > 0 && item.getMxzt() == 5){
+                item.setMxzt(2);
+            }
             // 过滤非并网值  风机状态不等于2
             if (filter == 0 && isfbw && item.getMxzt() != 2) {
                 filter = 1;
@@ -525,6 +561,8 @@ public class WindDirectionService {
         PJFS(ContantXk.CJ_SSFS),
         PJFX(ContantXk.CJ_FX),
         SBZT(ContantXk.MXZT),
+        YQZT(ContantXk.JKZT),//0==正常发电
+        EQZT(ContantXk.FJZT),//5==并网(正常运行)
         DFWC(ContantXk.CJ_DFJD),
         GL(ContantXk.CJ_SSGL),
         PHJD(ContantXk.CJ_PHJD),