Просмотр исходного кода

Merge branch 'master' into taosj_dev

# Conflicts:
#	gateway/forecast-device-gateway/src/main/java/cn/oleauto/device/gateway/service/WeatherDataSrv.java
taosj 1 месяц назад
Родитель
Сommit
96f6810007

+ 2 - 2
doc/数据库脚本/gateway-data.sql

@@ -13,8 +13,8 @@ INSERT INTO public.config_station (id, station_name,station_code,superior_area_i
     (1, '江门','JMJD01','EAST01',0,'124','37','370000','370000','广东省',120000,120000,75,12.500000,'2026-7-6','110KV','121.2223','38.9087','张工','13800000000',true,1,1,true,false,'admin','2026-07-01 13:23:25.447','admin','2026-07-01 13:23:25.447',0,'','EAST01');
 
 ---- 设备数据
-INSERT INTO config_device (id, name,config_channel_id,config_station_id,ilk,config_device_id,remark) VALUES (1, '电气设备',1,'1','ELEC',NULL,'Demo');
-INSERT INTO config_device (id, name,config_channel_id,config_station_id,ilk,config_device_id,remark) VALUES (2, '气象设备',1,'1','ELEC',NULL,'Demo');
+INSERT INTO public.config_device VALUES (1, '电气设备', 1, '1', 'ELEC', 'brand1', 'model1', 'serial1', 'GOOD', '2026-09-01', NULL, '', '2026-09-01 14:41:10.415056', '2026-09-01 14:41:10.415056', '', '');
+INSERT INTO public.config_device VALUES (2, '气象设备', 3, '1', 'WEAT', 'brand1', 'model1', 'serial1', 'GOOD', '2026-09-01', NULL, '', '2026-09-01 14:41:10.415056', '2026-09-01 14:41:10.415056', '', '');
 
 ---- 测点数据
 INSERT INTO public.config_point (name,code,addr,category,config_device_id,init_value,will_inverse,kb_composite,k,b,zero_filter,will_check_ud,up1,up2,down1,down2,hop_filter,lazy_tm,config_alarm_template_id,create_time,update_time,create_by,update_by) VALUES

+ 8 - 2
doc/数据库脚本/gateway.sql

@@ -232,9 +232,11 @@ CREATE TABLE data_weather_local
 (
     tm                    TIMESTAMPTZ NOT NULL,
     config_station_id     bigint      NOT NULL,
-    horizontal_irradiance DOUBLE PRECISION,
+    irradiance DOUBLE PRECISION,
     inclined_irradiance   DOUBLE PRECISION,
+    daily_irradiance      DOUBLE PRECISION,
     temperature           DOUBLE PRECISION,
+    board_temperature     DOUBLE PRECISION,
     pressure              DOUBLE PRECISION,
     humidity              DOUBLE PRECISION,
     wind_speed            DOUBLE PRECISION,
@@ -252,12 +254,16 @@ ON COLUMN data_weather_local.tm          IS '时间戳(带时区)';
 COMMENT
 ON COLUMN data_weather_local.config_station_id           IS '场站ID';
 COMMENT
-ON COLUMN data_weather_local.horizontal_irradiance  IS '水平面总辐照度,单位 W/m²';
+ON COLUMN data_weather_local.irradiance  IS '水平面总辐照度,单位 W/m²';
 COMMENT
 ON COLUMN data_weather_local.inclined_irradiance    IS '斜面辐照度,单位 W/m²';
 COMMENT
+ON COLUMN data_weather_local.daily_irradiance    IS '日累计辐照度,单位 W/m²';
+COMMENT
 ON COLUMN data_weather_local.temperature         IS '温度,单位 ℃';
 COMMENT
+ON COLUMN data_weather_local.board_temperature         IS '组件温度,单位 ℃';
+COMMENT
 ON COLUMN data_weather_local.pressure            IS '气压,单位 hPa';
 COMMENT
 ON COLUMN data_weather_local.humidity            IS '湿度,单位 %';

+ 2 - 5
forecast-backend-server/src/main/java/com/ufo/project/forecast/shortterm/power/controller/ShortTermPowerForecastingController.java

@@ -3,11 +3,8 @@ package com.ufo.project.forecast.shortterm.power.controller;
 import java.io.IOException;
 import java.net.URLEncoder;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.lang3.time.DateFormatUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -23,6 +20,7 @@ import com.ufo.base.framework.web.domain.AjaxResult;
 import com.ufo.project.forecast.shortterm.power.domain.DataShortTermPowerForecastIssued;
 import com.ufo.project.forecast.shortterm.power.domain.ShortTermPowerForecastData;
 import com.ufo.project.forecast.shortterm.power.service.IDataShortTermPowerForecastIssuedService;
+import com.ufo.project.forecast.shortterm.power.util.ExcelForecastFileUtil;
 
 /**
  * 短期功率预测Controller
@@ -92,8 +90,7 @@ public class ShortTermPowerForecastingController extends BaseController
         for (DataShortTermPowerForecastIssued issued : issuedList)
         {
             ShortTermPowerForecastData data = new ShortTermPowerForecastData();
-            Date date = new Date(issued.getStartTime() * 1000L);
-            data.setTime(DateFormatUtils.format(date, DateUtils.YYYY_MM_DD_HH_MM_SS));
+            data.setTime(ExcelForecastFileUtil.formatTime(String.valueOf(issued.getStartTime())));
             try
             {
                 data.setPower(Double.parseDouble(issued.getPower()));

+ 1 - 5
forecast-backend-server/src/main/java/com/ufo/project/forecast/shortterm/power/controller/UltraShortTermPowerForecastingController.java

@@ -7,8 +7,6 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.lang3.time.DateFormatUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -18,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import com.alibaba.excel.EasyExcel;
-import com.ufo.base.common.utils.DateUtils;
 import com.ufo.base.framework.aspectj.lang.annotation.Log;
 import com.ufo.base.framework.aspectj.lang.enums.BusinessType;
 import com.ufo.base.framework.web.controller.BaseController;
@@ -140,8 +137,7 @@ public class UltraShortTermPowerForecastingController extends BaseController
     private UltraShortTermPowerForecastData toData(DataUltraShortTermPowerForecasting data)
     {
         UltraShortTermPowerForecastData result = new UltraShortTermPowerForecastData();
-        Date date = new Date(data.getStartTime() * 1000L);
-        result.setTime(DateFormatUtils.format(date, DateUtils.YYYY_MM_DD_HH_MM_SS));
+        result.setTime(ExcelForecastFileUtil.formatTime(String.valueOf(data.getStartTime())));
         result.setMonitoredPower(parseDouble(data.getPower()));
         result.setPower15(parseDouble(data.getPower15()));
         result.setPower30(parseDouble(data.getPower30()));

+ 4 - 2
gateway/forecast-device-gateway/src/main/java/cn/oleauto/device/gateway/dto/DataWeatherPoint.java

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

+ 72 - 14
gateway/forecast-device-gateway/src/main/java/cn/oleauto/device/gateway/service/WeatherDataSrv.java

@@ -60,21 +60,33 @@ 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.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.getIrradiance())){
             log.warn("station={}, Irradiance config error,config={}", s.getConfigStationId(), s.getIrradiance());
             dataWeatherPoint.setIrradiance(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,8 +126,13 @@ public class WeatherDataSrv {
         data.setTm(new Date());
         data.setConfigStationId(v.getConfigStationId());
         // 赋予初值0
+<<<<<<< HEAD
         data.setHorizontalIrradiance(0.0);
         data.setIrradiance(0.0);
+=======
+        data.setIrradiance(0.0);
+        data.setInclinedIrradiance(0.0);
+>>>>>>> master
         data.setTemperature(0.0);
         data.setPressure(0.0);
         data.setHumidity(0.0);
@@ -123,12 +140,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){
-                data.setHorizontalIrradiance(pointIdValueDto.getDValue());
+            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID
+                    && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID
+                    && pointIdValueDto.getDValue() != null){
+                data.setIrradiance(pointIdValueDto.getDValue());
                 valid++;
             }
         }
@@ -136,8 +155,26 @@ public class WeatherDataSrv {
             PointIdValueDto pointIdValueDto = new PointIdValueDto();
             BeanUtils.copyProperties(v.getIrradiance(), pointIdValueDto);
             RealDataCache.getInstance().getValue(pointIdValueDto);
+<<<<<<< HEAD
             if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID){
                 data.setIrradiance(pointIdValueDto.getDValue());
+=======
+            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID
+                    && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID
+                    && pointIdValueDto.getDValue() != null){
+                data.setInclinedIrradiance(pointIdValueDto.getDValue());
+>>>>>>> master
+                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++;
             }
         }
@@ -145,16 +182,31 @@ public class WeatherDataSrv {
             PointIdValueDto pointIdValueDto = new PointIdValueDto();
             BeanUtils.copyProperties(v.getTemperature(), pointIdValueDto);
             RealDataCache.getInstance().getValue(pointIdValueDto);
-            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID){
+            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID
+                    && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID
+                    && pointIdValueDto.getDValue() != null){
                 data.setTemperature(pointIdValueDto.getDValue());
                 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);
             RealDataCache.getInstance().getValue(pointIdValueDto);
-            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID){
+            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID
+                    && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID
+                    && pointIdValueDto.getDValue() != null){
                 data.setPressure(pointIdValueDto.getDValue());
                 valid++;
             }
@@ -163,7 +215,9 @@ public class WeatherDataSrv {
             PointIdValueDto pointIdValueDto = new PointIdValueDto();
             BeanUtils.copyProperties(v.getHumidity(), pointIdValueDto);
             RealDataCache.getInstance().getValue(pointIdValueDto);
-            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID){
+            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID
+                    && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID
+                    && pointIdValueDto.getDValue() != null){
                 data.setHumidity(pointIdValueDto.getDValue());
                 valid++;
             }
@@ -172,7 +226,9 @@ public class WeatherDataSrv {
             PointIdValueDto pointIdValueDto = new PointIdValueDto();
             BeanUtils.copyProperties(v.getWindSpeed(), pointIdValueDto);
             RealDataCache.getInstance().getValue(pointIdValueDto);
-            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID){
+            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID
+                    && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID
+                    && pointIdValueDto.getDValue() != null){
                 data.setWindSpeed(pointIdValueDto.getDValue());
                 valid++;
             }
@@ -181,12 +237,14 @@ public class WeatherDataSrv {
             PointIdValueDto pointIdValueDto = new PointIdValueDto();
             BeanUtils.copyProperties(v.getWindDirection(), pointIdValueDto);
             RealDataCache.getInstance().getValue(pointIdValueDto);
-            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID){
+            if(pointIdValueDto.getPointAttr() != PointAttributeType.INVALID
+                    && pointIdValueDto.getValueAttr() != ValueAttributeType.INVALID
+                    && pointIdValueDto.getDValue() != null){
                 data.setWindDirection(pointIdValueDto.getDValue());
                 valid++;
             }
         }
-        if(valid > 4) {
+        if(valid > 5) {
             dataWeatherLocalService.insertDataWeatherLocal(data);
         } else {
             log.warn("valid data less then 5, discard real electricity data");

+ 8 - 1
gateway/forecast-device-gateway/src/main/resources/application.yml

@@ -1,5 +1,5 @@
 server:
-  port: 8081
+  port: 8083
 spring:
   application:
     name: forecast-device-gateway
@@ -54,6 +54,13 @@ mybatis:
   # 加载全局的配置文件
   configLocation: classpath:mybatis/mybatis-config.xml
 
+  # 开启mybatis-plus自带SQL打印
+#mybatis-plus:
+#  configuration:
+#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+#logging:
+#  level:
+#    cn.oleauto: DEBUG
 # PageHelper分页插件
 pagehelper:
   helperDialect: postgresql

+ 3 - 0
gateway/forecast-modbus-rtu/src/main/java/cn/oleauto/modbus/rtu/ModbusRtuProtocolImpl.java

@@ -28,6 +28,9 @@ import org.springframework.util.Assert;
 
 import java.util.List;
 
+/**
+ * @author
+ */
 @Slf4j
 public class ModbusRtuProtocolImpl extends AbstractProtocol {
     private ModbusConfig modbusConfig;

+ 31 - 0
gateway/forecast-south/pom.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>forecast-south</artifactId>
+    <description>南网调度上报子系统</description>
+
+    <parent>
+        <artifactId>forecast-gateway</artifactId>
+        <groupId>cn.oleauto</groupId>
+        <version>${revision}</version>
+    </parent>
+
+    <dependencies>
+        <dependency>
+            <groupId>cn.oleauto</groupId>
+            <artifactId>forecast-iec60870</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>cn.oleauto</groupId>
+            <artifactId>forecast-protocol-common</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>

+ 5 - 0
gateway/forecast-south/src/main/java/SouthApplication.java

@@ -0,0 +1,5 @@
+public class SouthApplication {
+    public static void main(String[] args) {
+        System.out.println("SouthApplication");
+    }
+}

+ 6 - 1
gateway/pom.xml

@@ -41,6 +41,11 @@
                 <artifactId>forecast-modbus-rtu</artifactId>
                 <version>${revision}</version>
             </dependency>
+            <dependency>
+                <groupId>cn.oleauto</groupId>
+                <artifactId>forecast-south</artifactId>
+                <version>0.0.1-SNAPSHOT</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -52,6 +57,6 @@
         <module>forecast-iec60870</module>
         <module>forecast-iec104</module>
 		<module>forecast-device-gateway</module>
-<!--        <module>elanguage</module>-->
+        <module>forecast-south</module>
     </modules>
 </project>