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

[0917] 光伏气象资源报表、辐照度累计值报表测试

taosj 1 месяц назад
Родитель
Сommit
6e0c706a95

+ 21 - 23
forecast-backend-server/src/main/java/com/ufo/project/data/controller/DataController.java

@@ -1,6 +1,7 @@
 package com.ufo.project.data.controller;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.text.SimpleDateFormat;
 import java.time.Instant;
 import java.time.ZoneOffset;
@@ -225,8 +226,8 @@ public class DataController extends BaseController
     private List<PvMeteorologicalResourceDataVO> buildMeteorologicalList(String entityId, String startTime, String endTime)
     {
         Long stationId = parseLong(entityId);
-        String startStr = formatOffsetDateTimeDay(startTime);
-        String endStr = formatOffsetDateTimeDay(endTime);
+        String startStr = startTime + "T00:00:00+08:00";
+        String endStr = endTime + "T23:59:59+08:00";
         List<DataWeatherLocal> list = weatherLocalService.selectWeatherFieldsByTimeRange(stationId, startStr, endStr);
         if (list == null || list.isEmpty()) return new ArrayList<>();
 
@@ -235,8 +236,9 @@ public class DataController extends BaseController
         {
             if (item.getTm() == null) continue;
             PvMeteorologicalResourceDataVO vo = new PvMeteorologicalResourceDataVO();
+            
             vo.setTime(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(item.getTm()));
-            vo.setTotalIrradiation(toDecimal(item.getIrradiance()));
+            vo.setTotalIrradiation(toDecimal(null == item.getIrradiance() ? item.getDailyIrradiance() : item.getIrradiance()));
             vo.setBoardTemperature(toDecimal(item.getBoardTemperature()));
             vo.setWindSpeed(toDecimal(item.getWindSpeed()));
             vo.setWindDirection(toDecimal(item.getWindDirection()));
@@ -271,29 +273,34 @@ public class DataController extends BaseController
         {
             return Collections.emptyList();
         }
+        String startStr = startTime + "T00:00:00+08:00";
+        String endStr = endTime + "T23:59:59+08:00";
         List<DataWeatherLocal> rawData = weatherLocalService.selectForCumulativeIrradiance(
-                entityId, startTime, endTime);
+                entityId, startStr, endStr);
         if (rawData == null || rawData.isEmpty())
         {
             return Collections.emptyList();
         }
 
         List<CumulativeIrradianceVO> result = new ArrayList<>();
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         for (DataWeatherLocal item : rawData)
         {
             CumulativeIrradianceVO vo = new CumulativeIrradianceVO();
             if (item.getTm() != null)
             {
-                vo.setTime(dateFormat.format(item.getTm()));
+                vo.setTime(timeFormat.format(item.getTm()));
             }
-            vo.setTotalIrradiation(toBigDecimal(item.getIrradiance()));
-            vo.setBoardTemperature(toBigDecimal(item.getBoardTemperature()));
-            vo.setWindSpeed(toBigDecimal(item.getWindSpeed()));
-            vo.setWindDirection(toBigDecimal(item.getWindDirection()));
-            vo.setTemperature(toBigDecimal(item.getTemperature()));
-            vo.setHumidity(toBigDecimal(item.getHumidity()));
-            vo.setPressure(toBigDecimal(item.getPressure()));
+
+            // dailyIrradiance: 优先取 irradiance,为空或<=0 时取 daily_irradiance
+            // 注意: 数据库单位为 W/㎡,需要转换为 Mj/㎡(1 W/㎡ = 3.6 Mj/㎡ 日累计)
+            Double irradianceValue = null == item.getIrradiance() ? item.getDailyIrradiance() : item.getIrradiance();
+            BigDecimal dailyValue = toBigDecimal(irradianceValue).multiply(new BigDecimal("3.6"))
+                        .setScale(3, RoundingMode.HALF_UP);
+            vo.setDailyIrradiance(dailyValue);
+
+            // hourlyIrradiance: 日累计 / 24
+            vo.setHourlyIrradiance(dailyValue.divide(new BigDecimal("24"), 3, RoundingMode.HALF_UP));
 
             result.add(vo);
         }
@@ -306,16 +313,7 @@ public class DataController extends BaseController
     private BigDecimal toDecimal(Double value)
     {
         if (value == null) return BigDecimal.ZERO;
-        return new BigDecimal(value);
-    }
-
-    /**
-     * 将 yyyy-MM-dd 转换为 ISO 8601 格式的当天起止时间(+08:00)
-     */
-    private String formatOffsetDateTimeDay(String dateStr)
-    {
-        if (dateStr == null || dateStr.isEmpty()) return dateStr;
-        return dateStr + "T00:00:00+08:00";
+        return BigDecimal.valueOf(value).setScale(3, RoundingMode.HALF_UP);
     }
 
     /**

+ 14 - 74
forecast-backend-server/src/main/java/com/ufo/project/data/domain/vo/CumulativeIrradianceVO.java

@@ -18,33 +18,13 @@ public class CumulativeIrradianceVO implements Serializable {
     @Excel(name = "时间")
     private String time;
 
-    /** 总辐照度 W/㎡ */
-    @Excel(name = "总辐照度(W/㎡)")
-    private BigDecimal totalIrradiation;
+    /** 总辐照度日累计 */
+    @Excel(name = "总辐照度日累计(Mj/㎡)")
+    private BigDecimal dailyIrradiance;
 
-    /** 组件温度(℃) */
-    @Excel(name = "组件温度(℃)")
-    private BigDecimal boardTemperature;
-
-    /** 风速(m/s) */
-    @Excel(name = "风速(m/s)")
-    private BigDecimal windSpeed;
-
-    /** 风向(度) */
-    @Excel(name = "风向(度)")
-    private BigDecimal windDirection;
-
-    /** 温度(℃) */
-    @Excel(name = "温度(℃)")
-    private BigDecimal temperature;
-
-    /** 湿度(%RH) */
-    @Excel(name = "湿度(%RH)")
-    private BigDecimal humidity;
-
-    /** 气压(hPa) */
-    @Excel(name = "气压(hPa)")
-    private BigDecimal pressure;
+    /** 总辐照度时累计 */
+    @Excel(name = "总辐照度时累计(Mj/㎡)")
+    private BigDecimal hourlyIrradiance;
 
     public String getTime() {
         return time;
@@ -54,59 +34,19 @@ public class CumulativeIrradianceVO implements Serializable {
         this.time = time;
     }
 
-    public BigDecimal getTotalIrradiation() {
-        return totalIrradiation;
-    }
-
-    public void setTotalIrradiation(BigDecimal totalIrradiation) {
-        this.totalIrradiation = totalIrradiation;
-    }
-
-    public BigDecimal getBoardTemperature() {
-        return boardTemperature;
-    }
-
-    public void setBoardTemperature(BigDecimal boardTemperature) {
-        this.boardTemperature = boardTemperature;
-    }
-
-    public BigDecimal getWindSpeed() {
-        return windSpeed;
-    }
-
-    public void setWindSpeed(BigDecimal windSpeed) {
-        this.windSpeed = windSpeed;
-    }
-
-    public BigDecimal getWindDirection() {
-        return windDirection;
-    }
-
-    public void setWindDirection(BigDecimal windDirection) {
-        this.windDirection = windDirection;
-    }
-
-    public BigDecimal getTemperature() {
-        return temperature;
-    }
-
-    public void setTemperature(BigDecimal temperature) {
-        this.temperature = temperature;
-    }
-
-    public BigDecimal getHumidity() {
-        return humidity;
+    public BigDecimal getDailyIrradiance() {
+        return dailyIrradiance;
     }
 
-    public void setHumidity(BigDecimal humidity) {
-        this.humidity = humidity;
+    public void setDailyIrradiance(BigDecimal dailyIrradiance) {
+        this.dailyIrradiance = dailyIrradiance;
     }
 
-    public BigDecimal getPressure() {
-        return pressure;
+    public BigDecimal getHourlyIrradiance() {
+        return hourlyIrradiance;
     }
 
-    public void setPressure(BigDecimal pressure) {
-        this.pressure = pressure;
+    public void setHourlyIrradiance(BigDecimal hourlyIrradiance) {
+        this.hourlyIrradiance = hourlyIrradiance;
     }
 }

+ 1 - 1
forecast-backend-server/src/main/java/com/ufo/project/weather/mapper/DataWeatherLocalMapper.java

@@ -42,7 +42,7 @@ public interface DataWeatherLocalMapper
      * @return 本地气象采样数据集合
      */
     public List<DataWeatherLocal> selectDataWeatherLocalListByTimeRange(@Param("stationId") Long stationId,
-            @Param("startTime") Long startTime, @Param("endTime") Long endTime);
+            @Param("startTime") String startTime, @Param("endTime") String endTime);
 
     /**
      * 新增本地气象采样数据

+ 14 - 22
forecast-backend-server/src/main/java/com/ufo/project/weather/service/impl/DataWeatherLocalServiceImpl.java

@@ -2,6 +2,9 @@ package com.ufo.project.weather.service.impl;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -221,28 +224,9 @@ public class DataWeatherLocalServiceImpl implements IDataWeatherLocalService
      */
     @Override
     public List<DataWeatherLocal> selectForCumulativeIrradiance(String stationId, String startTime, String endTime)
-    {
-        Long startTs = parseDateToTimestamp(startTime + " 00:00:00");
-        Long endTs = parseDateToTimestamp(endTime + " 23:59:59");
+    {   
         return dataWeatherLocalMapper.selectDataWeatherLocalListByTimeRange(
-                Long.valueOf(stationId), startTs, endTs);
-    }
-
-    /**
-     * 将日期字符串转为 unix 秒级时间戳
-     */
-    private Long parseDateToTimestamp(String dateStr)
-    {
-        try
-        {
-            java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            Date d = sdf.parse(dateStr.trim());
-            return d.getTime() / 1000;
-        }
-        catch (Exception e)
-        {
-            return null;
-        }
+                Long.valueOf(stationId), startTime, endTime);
     }
 
     /**
@@ -252,8 +236,16 @@ public class DataWeatherLocalServiceImpl implements IDataWeatherLocalService
     private LocalCurvePoints buildCurvePoints(Long stationId, Long startTime, Long endTime,
             Function<DataWeatherLocal, Double> valueGetter)
     {
+
+        Instant startInstant = Instant.ofEpochSecond(startTime * 1000);
+        Instant endInstant = Instant.ofEpochSecond(endTime * 1000);
+        String startFormatted = startInstant.atZone(ZoneId.of("Asia/Shanghai"))
+                          .format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX"));
+        String endFormatted = endInstant.atZone(ZoneId.of("Asia/Shanghai"))
+                          .format(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX"));
+
         List<DataWeatherLocal> list =
-                dataWeatherLocalMapper.selectDataWeatherLocalListByTimeRange(stationId, startTime, endTime);
+                dataWeatherLocalMapper.selectDataWeatherLocalListByTimeRange(stationId, startFormatted, endFormatted);
         List<Object[]> points = new ArrayList<Object[]>();
         int valid = 0;
         for (DataWeatherLocal record : list)

+ 2 - 2
forecast-backend-server/src/main/resources/mybatis/weather/DataWeatherLocalMapper.xml

@@ -49,8 +49,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectDataWeatherLocalListByTimeRange" resultMap="DataWeatherLocalResult">
         <include refid="selectDataWeatherLocalVo"/>
         where config_station_id = #{stationId}
-          and tm &gt;= to_timestamp(#{startTime})
-          and tm &lt;= to_timestamp(#{endTime})
+          and tm &gt;= #{startTime}
+          and tm &lt;= #{endTime}
         order by tm asc
     </select>
 

+ 3 - 8
forecast-backend-vue/src/views/ufo/electricity/datareport/cumulativeIrradianceDataReport.vue

@@ -57,14 +57,9 @@ const query = reactive({
 });
 
 const tableColumns = [
-  { title: '时间', dataIndex: 'time', width: 120 },
-  { title: '总辐照度(W/㎡)', dataIndex: 'totalIrradiation', width: 160 },
-  { title: '组件温度(℃)', dataIndex: 'boardTemperature', width: 130 },
-  { title: '风速(m/s)', dataIndex: 'windSpeed', width: 110 },
-  { title: '风向(度)', dataIndex: 'windDirection', width: 100 },
-  { title: '温度(℃)', dataIndex: 'temperature', width: 110 },
-  { title: '湿度(%RH)', dataIndex: 'humidity', width: 110 },
-  { title: '气压(hPa)', dataIndex: 'pressure', width: 120 }
+  { title: '时间', dataIndex: 'time', width: 160 },
+  { title: '总辐照度日累计(Mj/㎡)', dataIndex: 'dailyIrradiance', width: 180 },
+  { title: '总辐照度时累计(Mj/㎡)', dataIndex: 'hourlyIrradiance', width: 180 }
 ];
 
 const queryValid = computed(() => {

+ 31 - 0
release_note/2026.09.17/readme_tsj.md

@@ -0,0 +1,31 @@
+改动内容
+
+1. 微调的web端菜单宽度、兼容当前菜单名称较长
+2. 隐藏菜单`多源多模型预测, 理论功率预测`
+3. 调整菜单名称`预报管理`为`功率预测`
+4. 调整菜单`功率预测`下子菜单为:`短期功率预测`,`超短期功率预测`,`辐照功率对比`,`短期预测功率修正`,`超短期预测功率修正`
+5. 增加菜单`数据报表`
+    - 增加`短期预测日报`
+    - 增加`短期预测月报`
+    - 增加`短期预测年报`
+    - 增加`超短期预测日报`
+    - 增加`超短期预测月报`
+    - 增加`超短期预测年报`
+    - 增加`光伏电场累计日报`
+    - 增加`光伏电场累计月报`
+    - 增加`光伏电场累计年报`
+    - 增加`光伏气象资源数据报表`
+    - 增加`辐照度累计值报表`
+
+
+[更新说明]
+1. 执行 [20260917_dp.sql]
+2. 更新服务端jar
+3. 更新前端dist
+
+[测试说明]
+请自行模拟以下表数据
+data_electricity_local
+data_weather_local
+data_short_term_power_forecast_report
+data_super_short_term_forecast_report