Browse Source

同步修改实体对象和网关

xiaoguohua 4 days ago
parent
commit
3295c0e2d4

+ 5 - 1
gateway/forecast-device-gateway/src/main/java/cn/oleauto/device/gateway/dto/DataWeatherPoint.java

@@ -11,12 +11,16 @@ public class DataWeatherPoint {
 
     private Long configStationId;
 
-    private PointIdDto horizontalIrradiance;
+    private PointIdDto irradiance;
 
     private PointIdDto inclinedIrradiance;
 
+    private PointIdDto dailyIrradiance;
+
     private PointIdDto temperature;
 
+    private PointIdDto boardTemperature;
+
     private PointIdDto pressure;
 
     private PointIdDto humidity;

+ 42 - 9
gateway/forecast-device-gateway/src/main/java/cn/oleauto/device/gateway/service/WeatherDataSrv.java

@@ -60,21 +60,32 @@ public class WeatherDataSrv {
     private static void refreshStationConfig(ConfigStation r, ConfigWeatherLocal s, HashMap<Long, DataWeatherPoint> tempMap) {
         DataWeatherPoint dataWeatherPoint = new DataWeatherPoint();
         dataWeatherPoint.setConfigStationId(r.getId());
-        dataWeatherPoint.setHorizontalIrradiance(JSONUtil.toBean(s.getHorizontalIrradiance(), PointIdDto.class));
+        dataWeatherPoint.setIrradiance(JSONUtil.toBean(s.getIrradiance(), PointIdDto.class));
         dataWeatherPoint.setInclinedIrradiance(JSONUtil.toBean(s.getInclinedIrradiance(), PointIdDto.class));
+        dataWeatherPoint.setDailyIrradiance(JSONUtil.toBean(s.getDailyIrradiance(), PointIdDto.class));
         dataWeatherPoint.setTemperature(JSONUtil.toBean(s.getTemperature(), PointIdDto.class));
+        dataWeatherPoint.setBoardTemperature(JSONUtil.toBean(s.getBoardTemperature(), PointIdDto.class));
         dataWeatherPoint.setPressure(JSONUtil.toBean(s.getPressure(), PointIdDto.class));
         dataWeatherPoint.setHumidity(JSONUtil.toBean(s.getHumidity(), PointIdDto.class));
         dataWeatherPoint.setWindSpeed(JSONUtil.toBean(s.getWindSpeed(), PointIdDto.class));
         dataWeatherPoint.setWindDirection(JSONUtil.toBean(s.getWindDirection(), PointIdDto.class));
-        if(!Validator.isValid(dataWeatherPoint.getHorizontalIrradiance())){
-            log.warn("station={}, HorizontalIrradiance config error,config={}", s.getConfigStationId(), s.getHorizontalIrradiance());
-            dataWeatherPoint.setHorizontalIrradiance(null);
+
+        if(!Validator.isValid(dataWeatherPoint.getIrradiance())){
+            log.warn("station={}, HorizontalIrradiance config error,config={}", s.getConfigStationId(), s.getIrradiance());
+            dataWeatherPoint.setIrradiance(null);
         }
         if(!Validator.isValid(dataWeatherPoint.getInclinedIrradiance())){
             log.warn("station={}, InclinedIrradiance config error,config={}", s.getConfigStationId(), s.getInclinedIrradiance());
             dataWeatherPoint.setInclinedIrradiance(null);
         }
+        if(!Validator.isValid(dataWeatherPoint.getDailyIrradiance())){
+            log.warn("station={}, dailyIrradiance config error,config={}", s.getConfigStationId(), s.getDailyIrradiance());
+            dataWeatherPoint.setDailyIrradiance(null);
+        }
+        if(!Validator.isValid(dataWeatherPoint.getBoardTemperature())){
+            log.warn("station={}, Temperature config error,config={}", s.getConfigStationId(), s.getBoardTemperature());
+            dataWeatherPoint.setBoardTemperature(null);
+        }
         if(!Validator.isValid(dataWeatherPoint.getTemperature())){
             log.warn("station={}, Temperature config error,config={}", s.getConfigStationId(), s.getTemperature());
             dataWeatherPoint.setTemperature(null);
@@ -114,7 +125,7 @@ public class WeatherDataSrv {
         data.setTm(new Date());
         data.setConfigStationId(v.getConfigStationId());
         // 赋予初值0
-        data.setHorizontalIrradiance(0.0);
+        data.setIrradiance(0.0);
         data.setInclinedIrradiance(0.0);
         data.setTemperature(0.0);
         data.setPressure(0.0);
@@ -123,14 +134,14 @@ public class WeatherDataSrv {
         data.setWindDirection(0.0);
         int valid = 0;
         // 逐个去内存里面找数据
-        if(v.getHorizontalIrradiance() != null) {
+        if(v.getIrradiance() != null) {
             PointIdValueDto pointIdValueDto = new PointIdValueDto();
-            BeanUtils.copyProperties(v.getHorizontalIrradiance(), pointIdValueDto);
+            BeanUtils.copyProperties(v.getIrradiance(), pointIdValueDto);
             RealDataCache.getInstance().getValue(pointIdValueDto);
             if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID
                     && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID
                     && pointIdValueDto.getDValue() != null){
-                data.setHorizontalIrradiance(pointIdValueDto.getDValue());
+                data.setIrradiance(pointIdValueDto.getDValue());
                 valid++;
             }
         }
@@ -145,6 +156,17 @@ public class WeatherDataSrv {
                 valid++;
             }
         }
+        if(v.getDailyIrradiance() != null) {
+            PointIdValueDto pointIdValueDto = new PointIdValueDto();
+            BeanUtils.copyProperties(v.getDailyIrradiance(), pointIdValueDto);
+            RealDataCache.getInstance().getValue(pointIdValueDto);
+            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID
+                    && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID
+                    && pointIdValueDto.getDValue() != null){
+                data.setDailyIrradiance(pointIdValueDto.getDValue());
+                valid++;
+            }
+        }
         if(v.getTemperature() != null) {
             PointIdValueDto pointIdValueDto = new PointIdValueDto();
             BeanUtils.copyProperties(v.getTemperature(), pointIdValueDto);
@@ -156,6 +178,17 @@ public class WeatherDataSrv {
                 valid++;
             }
         }
+        if(v.getBoardTemperature() != null) {
+            PointIdValueDto pointIdValueDto = new PointIdValueDto();
+            BeanUtils.copyProperties(v.getBoardTemperature(), pointIdValueDto);
+            RealDataCache.getInstance().getValue(pointIdValueDto);
+            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID
+                    && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID
+                    && pointIdValueDto.getDValue() != null){
+                data.setBoardTemperature(pointIdValueDto.getDValue());
+                valid++;
+            }
+        }
         if(v.getPressure() != null) {
             PointIdValueDto pointIdValueDto = new PointIdValueDto();
             BeanUtils.copyProperties(v.getPressure(), pointIdValueDto);
@@ -200,7 +233,7 @@ public class WeatherDataSrv {
                 valid++;
             }
         }
-        if(valid > 4) {
+        if(valid > 5) {
             dataWeatherLocalService.insertDataWeatherLocal(data);
         } else {
             log.warn("valid data less then 5, discard real electricity data");

+ 0 - 5
gateway/forecast-modbus-rtu/pom.xml

@@ -64,11 +64,6 @@
             <groupId>cn.oleauto</groupId>
             <artifactId>forecast-protocol-common</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <scope>provided</scope>
-        </dependency>
     </dependencies>
 
 </project>