wanghc há 3 anos atrás
pai
commit
549a7ec33f

+ 7 - 0
ipfcst-console/src/main/java/com/jiayue/ipfcst/console/service/ReceiveDataService.java

@@ -111,6 +111,7 @@ public class ReceiveDataService {
             AnalysisData(body, windTurbineInfo.getId(), windTurbineInfo.getEquipmentType().getCode(), electricField);
           }
         }
+        savePowerStationStatusData(electricField);
       } catch (Exception e) {
         e.printStackTrace();
       }
@@ -136,6 +137,7 @@ public class ReceiveDataService {
       Map<String, String> map = new HashMap<>();
       map.put("equipmentNo", equipmentId.toString());
       map.put("time", new Date(rows.getTimestamp()).toString());
+      log.info("循环点表");
       for (DataPoint dataPoint : dataPointList) {
         for (int i = 0; i < sensorIds.length; i++) {
           if (dataPoint.getMeasuringPoint().equals(sensorIds[i])) {
@@ -152,6 +154,7 @@ public class ReceiveDataService {
           weatherStationStatusDataRepository.save(weatherStationStatusData);
         } else {
           InverterInfo inverterInfo = inverterInfoService.get(equipmentId);
+          log.info("计算电压");
           if (map.get("activePower") != null && map.get("electricalCurrent") != null) {
             //有功
             BigDecimal activePower = new BigDecimal(map.get("activePower"));
@@ -161,6 +164,7 @@ public class ReceiveDataService {
             BigDecimal voltage = activePower.divide(electricalCurrent, 2, BigDecimal.ROUND_HALF_UP);
             map.put("voltage", voltage.toString());
           }
+          log.info("电压等于" + map.get("voltage"));
           if (inverterInfo != null) {
             redisUtils.hmset("nbq-" + electricField.getStationCode() + "-" + equipmentId, map);
             InverterStatusData inverterStatusData = JSON.parseObject(JSON.toJSONString(map), InverterStatusData.class);
@@ -184,12 +188,14 @@ public class ReceiveDataService {
         }
       }
     } catch (Exception e) {
+      log.info("程序异常");
       e.printStackTrace();
     }
   }
 
   public void savePowerStationStatusData(ElectricField electricField) {
     try {
+      log.info("开始计算实际功率");
       BigDecimal powerStationStatusData = new BigDecimal("0");
       if (electricField.getElectricFieldTypeEnum().getCode() == 1) {
         List<InverterInfo> inverterInfoList = inverterInfoService.getByStationCode(electricField.getStationCode());
@@ -217,6 +223,7 @@ public class ReceiveDataService {
       Map<String, String> map = JSON.parseObject(JSON.toJSONString(p), new TypeReference<Map<String, String>>() {
       });
       redisUtils.hmset("power-" + electricField.getStationCode(), map);
+      log.info("实际功率结束");
     } catch (Exception e) {
       e.printStackTrace();
     }