|
|
@@ -1,5 +1,6 @@
|
|
|
package com.ufo.project.data.controller;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.Instant;
|
|
|
import java.time.ZoneOffset;
|
|
|
@@ -23,6 +24,8 @@ import com.ufo.base.framework.web.page.TableDataInfo;
|
|
|
import com.ufo.base.common.utils.poi.ExcelUtil;
|
|
|
import com.ufo.project.data.domain.IrradiancePowerComparisonQuery;
|
|
|
import com.ufo.project.data.domain.vo.IrradiancePowerComparisonVO;
|
|
|
+import com.ufo.project.data.domain.vo.PvMeteorologicalResourceDataQuery;
|
|
|
+import com.ufo.project.data.domain.vo.PvMeteorologicalResourceDataVO;
|
|
|
import com.ufo.project.data.domain.vo.PvPlantCumulativeReportQuery;
|
|
|
import com.ufo.project.data.domain.vo.PvPlantCumulativeReportVO;
|
|
|
import com.ufo.project.data.domain.vo.ShortTermPowerForecastReportQuery;
|
|
|
@@ -175,6 +178,80 @@ public class DataController extends BaseController
|
|
|
util.exportExcel(response, list, "光伏电场累计报表");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 光伏气象资源数据
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('data:pvMeteorologicalResourceData:list')")
|
|
|
+ @PostMapping("/pvMeteorologicalResourceData")
|
|
|
+ public TableDataInfo pvMeteorologicalResourceData(@RequestBody PvMeteorologicalResourceDataQuery query)
|
|
|
+ {
|
|
|
+ List<PvMeteorologicalResourceDataVO> list = buildMeteorologicalList(
|
|
|
+ query.getEntityId(), query.getStartTime(), query.getEndTime());
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 光伏气象资源数据导出
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('data:pvMeteorologicalResourceData:export')")
|
|
|
+ @Log(title = "光伏气象资源数据", businessType = BusinessType.EXPORT)
|
|
|
+ @PostMapping("/pvMeteorologicalResourceData/export")
|
|
|
+ public void pvMeteorologicalResourceDataExport(HttpServletResponse response,
|
|
|
+ @RequestBody PvMeteorologicalResourceDataQuery query)
|
|
|
+ {
|
|
|
+ List<PvMeteorologicalResourceDataVO> list = buildMeteorologicalList(
|
|
|
+ query.getEntityId(), query.getStartTime(), query.getEndTime());
|
|
|
+ ExcelUtil<PvMeteorologicalResourceDataVO> util = new ExcelUtil<>(PvMeteorologicalResourceDataVO.class);
|
|
|
+ util.exportExcel(response, list, "光伏气象资源数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 构建气象资源数据列表
|
|
|
+ */
|
|
|
+ private List<PvMeteorologicalResourceDataVO> buildMeteorologicalList(String entityId, String startTime, String endTime)
|
|
|
+ {
|
|
|
+ Long stationId = parseLong(entityId);
|
|
|
+ String startStr = formatOffsetDateTimeDay(startTime);
|
|
|
+ String endStr = formatOffsetDateTimeDay(endTime);
|
|
|
+ List<DataWeatherLocal> list = weatherLocalService.selectWeatherFieldsByTimeRange(stationId, startStr, endStr);
|
|
|
+ if (list == null || list.isEmpty()) return new ArrayList<>();
|
|
|
+
|
|
|
+ List<PvMeteorologicalResourceDataVO> result = new ArrayList<>();
|
|
|
+ for (DataWeatherLocal item : list)
|
|
|
+ {
|
|
|
+ if (item.getTm() == null) continue;
|
|
|
+ PvMeteorologicalResourceDataVO vo = new PvMeteorologicalResourceDataVO();
|
|
|
+ vo.setTime(new java.text.SimpleDateFormat("yyyy-MM-dd").format(item.getTm()));
|
|
|
+ vo.setTotalIrradiation(toDecimal(item.getIrradiance()));
|
|
|
+ vo.setBoardTemperature(toDecimal(item.getBoardTemperature()));
|
|
|
+ vo.setWindSpeed(toDecimal(item.getWindSpeed()));
|
|
|
+ vo.setWindDirection(toDecimal(item.getWindDirection()));
|
|
|
+ vo.setTemperature(toDecimal(item.getTemperature()));
|
|
|
+ vo.setHumidity(toDecimal(item.getHumidity()));
|
|
|
+ vo.setPressure(toDecimal(item.getPressure()));
|
|
|
+ result.add(vo);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 将 Double 转为 BigDecimal,null 时返回 0
|
|
|
+ */
|
|
|
+ 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";
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 构建对比数据列表
|
|
|
*/
|