|
@@ -3,6 +3,8 @@ package com.cpp.web.service.station.impl;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.cpp.common.core.domain.entity.SysDictData;
|
|
|
+import com.cpp.common.utils.DictUtils;
|
|
|
import com.cpp.system.service.ISysConfigService;
|
|
|
import com.cpp.web.domain.BaseCppEntity;
|
|
|
import com.cpp.web.domain.cloud.ForecastPowerShortTermCloud;
|
|
@@ -12,7 +14,9 @@ import com.cpp.web.service.cloud.ForecastPowerShortTermCloudService;
|
|
|
import com.cpp.web.service.cloud.ForecastPowerUltraShortTermCloudService;
|
|
|
import com.cpp.web.service.cloud.NwpCloudService;
|
|
|
import com.cpp.web.service.station.*;
|
|
|
+import lombok.Data;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -20,6 +24,7 @@ import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* cpp_power_station_status_data
|
|
@@ -34,7 +39,6 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
|
|
|
private final ForecastPowerUltraShortTermCloudService forecastPowerUltraShortTermCloudService;
|
|
|
private final ForecastPowerShortTermCloudService forecastPowerShortTermCloudService;
|
|
|
private final ElectricFieldService electricFieldService;
|
|
|
-// private final ForecastManufactorService forecastManufactorService;
|
|
|
private final ForecastPowerShortTermStationService forecastPowerShortTermStationService;
|
|
|
private final ForecastPowerShortTermRegulationService forecastPowerShortTermRegulationService;
|
|
|
private final ForecastPowerShortTermSendService forecastPowerShortTermSendService;
|
|
@@ -78,7 +82,6 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public Map<String, List> getCenterData(Date startTime, Date endTime) {
|
|
|
return null;
|
|
@@ -98,20 +101,20 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
|
|
|
|
|
|
// 封装列表头信息
|
|
|
List headList = new ArrayList();
|
|
|
- Map<String,String> czmcHeadMap = new HashMap<>();
|
|
|
+ Map<String, String> czmcHeadMap = new HashMap<>();
|
|
|
czmcHeadMap.put("field", "czmc");
|
|
|
czmcHeadMap.put("label", "场站名称");
|
|
|
headList.add(czmcHeadMap);
|
|
|
- Map<String,String> timeHeadMap = new HashMap<>();
|
|
|
+ Map<String, String> timeHeadMap = new HashMap<>();
|
|
|
timeHeadMap.put("field", "time");
|
|
|
timeHeadMap.put("label", "时间");
|
|
|
headList.add(timeHeadMap);
|
|
|
- Map<String,String> hjHeadMap = new HashMap<>();
|
|
|
+ Map<String, String> hjHeadMap = new HashMap<>();
|
|
|
hjHeadMap.put("field", "hj");
|
|
|
|
|
|
Map<Long, WeatherStationStatusData> qxzMap = new HashMap<>();
|
|
|
Map<Long, WindTowerStatusData> cftMap = new HashMap<>();
|
|
|
- if ("E1".equals(stationType)){
|
|
|
+ if ("E1".equals(stationType)) {
|
|
|
// 光伏
|
|
|
hjHeadMap.put("label", "气象站总辐射(W/㎡)");
|
|
|
// 查询气象站数据
|
|
@@ -122,8 +125,7 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
|
|
|
for (WeatherStationStatusData weatherStationStatusData : list) {
|
|
|
qxzMap.put(weatherStationStatusData.getTime().getTime(), weatherStationStatusData);
|
|
|
}
|
|
|
- }
|
|
|
- else{
|
|
|
+ } else {
|
|
|
hjHeadMap.put("label", "测风塔轮毂风速(m/s)");
|
|
|
// 查询测风塔数据
|
|
|
QueryWrapper<WindTowerStatusData> wrapper = new QueryWrapper<>();
|
|
@@ -135,35 +137,35 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
|
|
|
}
|
|
|
}
|
|
|
headList.add(hjHeadMap);
|
|
|
- Map<String,String> sjglHeadMap = new HashMap<>();
|
|
|
+ Map<String, String> sjglHeadMap = new HashMap<>();
|
|
|
sjglHeadMap.put("field", "sjgl");
|
|
|
sjglHeadMap.put("label", "实际功率(MW)");
|
|
|
headList.add(sjglHeadMap);
|
|
|
- Map<String,String> kyglHeadMap = new HashMap<>();
|
|
|
+ Map<String, String> kyglHeadMap = new HashMap<>();
|
|
|
kyglHeadMap.put("field", "kygl");
|
|
|
kyglHeadMap.put("label", "可用功率(MW)");
|
|
|
headList.add(kyglHeadMap);
|
|
|
- Map<String,String> llglHeadMap = new HashMap<>();
|
|
|
+ Map<String, String> llglHeadMap = new HashMap<>();
|
|
|
llglHeadMap.put("field", "llgl");
|
|
|
llglHeadMap.put("label", "理论功率(MW)");
|
|
|
headList.add(llglHeadMap);
|
|
|
- Map<String,String> cdqysHeadMap = new HashMap<>();
|
|
|
+ Map<String, String> cdqysHeadMap = new HashMap<>();
|
|
|
cdqysHeadMap.put("field", "cdqys");
|
|
|
cdqysHeadMap.put("label", "超短期(MW)");
|
|
|
headList.add(cdqysHeadMap);
|
|
|
- Map<String,String> dqysHeadMap = new HashMap<>();
|
|
|
+ Map<String, String> dqysHeadMap = new HashMap<>();
|
|
|
dqysHeadMap.put("field", "dqys");
|
|
|
dqysHeadMap.put("label", "短期原始(MW)");
|
|
|
headList.add(dqysHeadMap);
|
|
|
- Map<String,String> dqzxHeadMap = new HashMap<>();
|
|
|
+ Map<String, String> dqzxHeadMap = new HashMap<>();
|
|
|
dqzxHeadMap.put("field", "dqzx");
|
|
|
dqzxHeadMap.put("label", "短期调控(MW)");
|
|
|
headList.add(dqzxHeadMap);
|
|
|
- Map<String,String> dqsbHeadMap = new HashMap<>();
|
|
|
+ Map<String, String> dqsbHeadMap = new HashMap<>();
|
|
|
dqsbHeadMap.put("field", "dqsb");
|
|
|
dqsbHeadMap.put("label", "短期上报(MW)");
|
|
|
headList.add(dqsbHeadMap);
|
|
|
- Map<String,String> czHeadMap = new HashMap<>();
|
|
|
+ Map<String, String> czHeadMap = new HashMap<>();
|
|
|
czHeadMap.put("field", "cz");
|
|
|
czHeadMap.put("label", "下发与上报差值");
|
|
|
headList.add(czHeadMap);
|
|
@@ -188,10 +190,10 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
|
|
|
Map<Long, ForecastPowerShortTermStation> dqysMap = new HashMap<>();
|
|
|
String dqHowLongAgo = configService.selectConfigByKey("dqHowLongAgo");
|
|
|
QueryWrapper dqysWrapper = new QueryWrapper<>();
|
|
|
- dqysWrapper.eq("forecast_how_long_ago",Integer.parseInt(dqHowLongAgo));
|
|
|
- dqysWrapper.eq("station_code",stationCode);
|
|
|
+ dqysWrapper.eq("forecast_how_long_ago", Integer.parseInt(dqHowLongAgo));
|
|
|
+ dqysWrapper.eq("station_code", stationCode);
|
|
|
dqysWrapper.between("time", new Date(startTime), new Date(endTime));
|
|
|
- List<ForecastPowerShortTermStation> forecastPowerShortTermStationList =forecastPowerShortTermStationService.list(dqysWrapper);
|
|
|
+ List<ForecastPowerShortTermStation> forecastPowerShortTermStationList = forecastPowerShortTermStationService.list(dqysWrapper);
|
|
|
for (ForecastPowerShortTermStation forecastPowerShortTermStation : forecastPowerShortTermStationList) {
|
|
|
dqysMap.put(forecastPowerShortTermStation.getTime().getTime(), forecastPowerShortTermStation);
|
|
|
}
|
|
@@ -199,74 +201,69 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
|
|
|
Map<Long, ForecastPowerUltraShortTermStation> cdqysMap = new HashMap<>();
|
|
|
String cdqHowLongAgo = configService.selectConfigByKey("cdqHowLongAgo");
|
|
|
QueryWrapper cdqysWrapper = new QueryWrapper<>();
|
|
|
- cdqysWrapper.eq("forecast_how_long_ago",Integer.parseInt(dqHowLongAgo));
|
|
|
- cdqysWrapper.eq("station_code",stationCode);
|
|
|
+ cdqysWrapper.eq("forecast_how_long_ago", Integer.parseInt(dqHowLongAgo));
|
|
|
+ cdqysWrapper.eq("station_code", stationCode);
|
|
|
cdqysWrapper.between("time", new Date(startTime), new Date(endTime));
|
|
|
- List<ForecastPowerUltraShortTermStation> forecastPowerUltraShortTermStationList =forecastPowerUltraShortTermStationService.list(dqysWrapper);
|
|
|
+ List<ForecastPowerUltraShortTermStation> forecastPowerUltraShortTermStationList = forecastPowerUltraShortTermStationService.list(dqysWrapper);
|
|
|
for (ForecastPowerUltraShortTermStation forecastPowerUltraShortTermStation : forecastPowerUltraShortTermStationList) {
|
|
|
cdqysMap.put(forecastPowerUltraShortTermStation.getTime().getTime(), forecastPowerUltraShortTermStation);
|
|
|
}
|
|
|
// 获取短期上报曲线
|
|
|
Map<Long, ForecastPowerShortTermRegulation> dqsbMap = new HashMap<>();
|
|
|
QueryWrapper dqsbWrapper = new QueryWrapper<>();
|
|
|
- dqsbWrapper.eq("forecast_how_long_ago",Integer.parseInt(dqHowLongAgo));
|
|
|
- dqsbWrapper.eq("station_code",stationCode);
|
|
|
+ dqsbWrapper.eq("forecast_how_long_ago", Integer.parseInt(dqHowLongAgo));
|
|
|
+ dqsbWrapper.eq("station_code", stationCode);
|
|
|
dqsbWrapper.between("time", new Date(startTime), new Date(endTime));
|
|
|
- List<ForecastPowerShortTermRegulation> forecastPowerShortTermRegulationList =forecastPowerShortTermRegulationService.list(dqysWrapper);
|
|
|
+ List<ForecastPowerShortTermRegulation> forecastPowerShortTermRegulationList = forecastPowerShortTermRegulationService.list(dqysWrapper);
|
|
|
for (ForecastPowerShortTermRegulation forecastPowerShortTermRegulation : forecastPowerShortTermRegulationList) {
|
|
|
dqsbMap.put(forecastPowerShortTermRegulation.getTime().getTime(), forecastPowerShortTermRegulation);
|
|
|
}
|
|
|
// 获取短期调控下发的中心曲线
|
|
|
Map<Long, ForecastPowerShortTermSend> dqzxMap = new HashMap<>();
|
|
|
QueryWrapper dqzxWrapper = new QueryWrapper<>();
|
|
|
- dqzxWrapper.eq("forecast_how_long_ago",Integer.parseInt(dqHowLongAgo));
|
|
|
- dqzxWrapper.eq("station_code",stationCode);
|
|
|
+ dqzxWrapper.eq("forecast_how_long_ago", Integer.parseInt(dqHowLongAgo));
|
|
|
+ dqzxWrapper.eq("station_code", stationCode);
|
|
|
dqzxWrapper.between("time", new Date(startTime), new Date(endTime));
|
|
|
- List<ForecastPowerShortTermSend> forecastPowerShortTermSendList =forecastPowerShortTermSendService.list(dqysWrapper);
|
|
|
+ List<ForecastPowerShortTermSend> forecastPowerShortTermSendList = forecastPowerShortTermSendService.list(dqysWrapper);
|
|
|
for (ForecastPowerShortTermSend forecastPowerShortTermSend : forecastPowerShortTermSendList) {
|
|
|
dqzxMap.put(forecastPowerShortTermSend.getTime().getTime(), forecastPowerShortTermSend);
|
|
|
}
|
|
|
|
|
|
|
|
|
- List<Map<String,Object>> tableList = new ArrayList();
|
|
|
- int i=0;
|
|
|
+ List<Map<String, Object>> tableList = new ArrayList();
|
|
|
+ int i = 0;
|
|
|
for (Long tempDateTime = startTime; tempDateTime < endTime; tempDateTime = tempDateTime + 15 * 60 * 1000) {
|
|
|
// 封装列表的数据
|
|
|
- Map<String,Object> map1 = new HashMap<>();
|
|
|
+ Map<String, Object> map1 = new HashMap<>();
|
|
|
map1.put("czmc", electricField.getName());
|
|
|
map1.put("time", DateUtil.format(new Date(tempDateTime), "yyyy-MM-dd HH:mm"));
|
|
|
// 气象站或者测风塔数据
|
|
|
- if ("E1".equals(stationType)){
|
|
|
+ if ("E1".equals(stationType)) {
|
|
|
if (qxzMap.get(tempDateTime) != null) {
|
|
|
WeatherStationStatusData weatherStationStatusData = qxzMap.get(tempDateTime);
|
|
|
- if (weatherStationStatusData.getGlobalR().compareTo(new BigDecimal("-99"))==0) {
|
|
|
- map1.put("hj",null);
|
|
|
+ if (weatherStationStatusData.getGlobalR().compareTo(new BigDecimal("-99")) == 0) {
|
|
|
+ map1.put("hj", null);
|
|
|
hjList.add(null);
|
|
|
- }
|
|
|
- else{
|
|
|
- map1.put("hj",weatherStationStatusData.getGlobalR().toString());
|
|
|
+ } else {
|
|
|
+ map1.put("hj", weatherStationStatusData.getGlobalR().toString());
|
|
|
hjList.add(weatherStationStatusData.getGlobalR().toString());
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
- map1.put("hj",null);
|
|
|
+ } else {
|
|
|
+ map1.put("hj", null);
|
|
|
hjList.add(null);
|
|
|
}
|
|
|
- }
|
|
|
- else{
|
|
|
+ } else {
|
|
|
if (cftMap.get(tempDateTime) != null) {
|
|
|
WindTowerStatusData windTowerStatusData = cftMap.get(tempDateTime);
|
|
|
- if (windTowerStatusData.getWsHubHeight().compareTo(new BigDecimal("-99"))==0) {
|
|
|
- map1.put("hj",null);
|
|
|
+ if (windTowerStatusData.getWsHubHeight().compareTo(new BigDecimal("-99")) == 0) {
|
|
|
+ map1.put("hj", null);
|
|
|
hjList.add(null);
|
|
|
- }
|
|
|
- else{
|
|
|
- map1.put("hj",windTowerStatusData.getWsHubHeight().toString());
|
|
|
+ } else {
|
|
|
+ map1.put("hj", windTowerStatusData.getWsHubHeight().toString());
|
|
|
hjList.add(windTowerStatusData.getWsHubHeight().toString());
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
- map1.put("hj",null);
|
|
|
+ } else {
|
|
|
+ map1.put("hj", null);
|
|
|
hjList.add(null);
|
|
|
}
|
|
|
}
|
|
@@ -275,110 +272,98 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
|
|
|
if (sjMap.get(tempDateTime) != null) {
|
|
|
// 实际功率
|
|
|
PowerStationStatusData powerStationStatusData = sjMap.get(tempDateTime);
|
|
|
- if (powerStationStatusData.getRealValue().compareTo(new BigDecimal("-99"))==0) {
|
|
|
+ if (powerStationStatusData.getRealValue().compareTo(new BigDecimal("-99")) == 0) {
|
|
|
sjList.add(null);
|
|
|
- map1.put("sjgl",null);
|
|
|
- }
|
|
|
- else{
|
|
|
+ map1.put("sjgl", null);
|
|
|
+ } else {
|
|
|
sjList.add(powerStationStatusData.getRealValue().toString());
|
|
|
- map1.put("sjgl",powerStationStatusData.getRealValue().toString());
|
|
|
+ map1.put("sjgl", powerStationStatusData.getRealValue().toString());
|
|
|
}
|
|
|
- if (powerStationStatusData.getAbleValue().compareTo(new BigDecimal("-99"))==0) {
|
|
|
+ if (powerStationStatusData.getAbleValue().compareTo(new BigDecimal("-99")) == 0) {
|
|
|
kyList.add(null);
|
|
|
- map1.put("kygl",null);
|
|
|
- }
|
|
|
- else{
|
|
|
+ map1.put("kygl", null);
|
|
|
+ } else {
|
|
|
kyList.add(powerStationStatusData.getAbleValue().toString());
|
|
|
- map1.put("kygl",powerStationStatusData.getAbleValue().toString());
|
|
|
+ map1.put("kygl", powerStationStatusData.getAbleValue().toString());
|
|
|
}
|
|
|
- if (powerStationStatusData.getTheoryValue().compareTo(new BigDecimal("-99"))==0) {
|
|
|
+ if (powerStationStatusData.getTheoryValue().compareTo(new BigDecimal("-99")) == 0) {
|
|
|
llList.add(null);
|
|
|
- map1.put("llgl",null);
|
|
|
- }
|
|
|
- else{
|
|
|
+ map1.put("llgl", null);
|
|
|
+ } else {
|
|
|
llList.add(powerStationStatusData.getTheoryValue().toString());
|
|
|
- map1.put("llgl",powerStationStatusData.getTheoryValue().toString());
|
|
|
+ map1.put("llgl", powerStationStatusData.getTheoryValue().toString());
|
|
|
}
|
|
|
} else {
|
|
|
- map1.put("sjgl",null);
|
|
|
- map1.put("kygl",null);
|
|
|
- map1.put("llgl",null);
|
|
|
+ map1.put("sjgl", null);
|
|
|
+ map1.put("kygl", null);
|
|
|
+ map1.put("llgl", null);
|
|
|
sjList.add(null);
|
|
|
kyList.add(null);
|
|
|
llList.add(null);
|
|
|
}
|
|
|
// 封装超短期原始曲线list
|
|
|
- if (cdqysMap.get(tempDateTime) !=null){
|
|
|
+ if (cdqysMap.get(tempDateTime) != null) {
|
|
|
ForecastPowerUltraShortTermStation forecastPowerUltraShortTermStation = cdqysMap.get(tempDateTime);
|
|
|
- if (forecastPowerUltraShortTermStation.getFpValue().compareTo(new BigDecimal("-99"))==0) {
|
|
|
+ if (forecastPowerUltraShortTermStation.getFpValue().compareTo(new BigDecimal("-99")) == 0) {
|
|
|
cdqysList.add(null);
|
|
|
- map1.put("cdqys",null);
|
|
|
- }
|
|
|
- else{
|
|
|
+ map1.put("cdqys", null);
|
|
|
+ } else {
|
|
|
cdqysList.add(forecastPowerUltraShortTermStation.getFpValue().toString());
|
|
|
- map1.put("cdqys",forecastPowerUltraShortTermStation.getFpValue().toString());
|
|
|
+ map1.put("cdqys", forecastPowerUltraShortTermStation.getFpValue().toString());
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
cdqysList.add(null);
|
|
|
}
|
|
|
|
|
|
// 封装短期原始曲线list
|
|
|
- if (dqysMap.get(tempDateTime) !=null){
|
|
|
+ if (dqysMap.get(tempDateTime) != null) {
|
|
|
ForecastPowerShortTermStation forecastPowerShortTermStation = dqysMap.get(tempDateTime);
|
|
|
- if (forecastPowerShortTermStation.getFpValue().compareTo(new BigDecimal("-99"))==0) {
|
|
|
+ if (forecastPowerShortTermStation.getFpValue().compareTo(new BigDecimal("-99")) == 0) {
|
|
|
dqysList.add(null);
|
|
|
- map1.put("dqys",null);
|
|
|
- }
|
|
|
- else{
|
|
|
+ map1.put("dqys", null);
|
|
|
+ } else {
|
|
|
dqysList.add(forecastPowerShortTermStation.getFpValue().toString());
|
|
|
- map1.put("dqys",forecastPowerShortTermStation.getFpValue().toString());
|
|
|
+ map1.put("dqys", forecastPowerShortTermStation.getFpValue().toString());
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
dqysList.add(null);
|
|
|
}
|
|
|
// 封装短期上报曲线list
|
|
|
- if (dqsbMap.get(tempDateTime) !=null){
|
|
|
+ if (dqsbMap.get(tempDateTime) != null) {
|
|
|
ForecastPowerShortTermRegulation forecastPowerShortTermRegulation = dqsbMap.get(tempDateTime);
|
|
|
- if (forecastPowerShortTermRegulation.getFpValue().compareTo(new BigDecimal("-99"))==0) {
|
|
|
+ if (forecastPowerShortTermRegulation.getFpValue().compareTo(new BigDecimal("-99")) == 0) {
|
|
|
dqsbList.add(null);
|
|
|
- map1.put("dqsb",null);
|
|
|
- map1.put("cz",null);
|
|
|
- }
|
|
|
- else{
|
|
|
+ map1.put("dqsb", null);
|
|
|
+ map1.put("cz", null);
|
|
|
+ } else {
|
|
|
dqsbList.add(forecastPowerShortTermRegulation.getFpValue().toString());
|
|
|
- map1.put("dqsb",forecastPowerShortTermRegulation.getFpValue().toString());
|
|
|
+ map1.put("dqsb", forecastPowerShortTermRegulation.getFpValue().toString());
|
|
|
// 站端上报了短期,再判断短期下发的值是否为空
|
|
|
- if (dqzxMap.get(tempDateTime) !=null){
|
|
|
+ if (dqzxMap.get(tempDateTime) != null) {
|
|
|
// 需要计算差值,下发减上报差值
|
|
|
ForecastPowerShortTermSend forecastPowerShortTermSend = dqzxMap.get(tempDateTime);
|
|
|
- map1.put("cz",forecastPowerShortTermSend.getFpValue().subtract(forecastPowerShortTermRegulation.getFpValue()).toString());
|
|
|
- }
|
|
|
- else{
|
|
|
+ map1.put("cz", forecastPowerShortTermSend.getFpValue().subtract(forecastPowerShortTermRegulation.getFpValue()).toString());
|
|
|
+ } else {
|
|
|
// 中心没有调控下发,则差值字段正常就是空
|
|
|
- map1.put("cz",null);
|
|
|
+ map1.put("cz", null);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
dqsbList.add(null);
|
|
|
// 站端没有上报短期,差值字段为空
|
|
|
- map1.put("cz","—");
|
|
|
+ map1.put("cz", "—");
|
|
|
}
|
|
|
// 封装短期中心调控下发曲线list
|
|
|
- if (dqzxMap.get(tempDateTime) !=null){
|
|
|
+ if (dqzxMap.get(tempDateTime) != null) {
|
|
|
ForecastPowerShortTermSend forecastPowerShortTermSend = dqzxMap.get(tempDateTime);
|
|
|
- if (forecastPowerShortTermSend.getFpValue().compareTo(new BigDecimal("-99"))==0) {
|
|
|
+ if (forecastPowerShortTermSend.getFpValue().compareTo(new BigDecimal("-99")) == 0) {
|
|
|
dqzxList.add(null);
|
|
|
- map1.put("dqzx",null);
|
|
|
- }
|
|
|
- else{
|
|
|
+ map1.put("dqzx", null);
|
|
|
+ } else {
|
|
|
dqzxList.add(forecastPowerShortTermSend.getFpValue().toString());
|
|
|
- map1.put("dqzx",forecastPowerShortTermSend.getFpValue().toString());
|
|
|
+ map1.put("dqzx", forecastPowerShortTermSend.getFpValue().toString());
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
dqzxList.add(null);
|
|
|
}
|
|
|
|
|
@@ -406,10 +391,9 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
|
|
|
zhMap.put("短期原始", dqysList);
|
|
|
zhMap.put("短期调控", dqzxList);
|
|
|
zhMap.put("短期上报", dqsbList);
|
|
|
- if ("E1".equals(stationType)){
|
|
|
+ if ("E1".equals(stationType)) {
|
|
|
zhMap.put("气象站总辐射", hjList);
|
|
|
- }
|
|
|
- else{
|
|
|
+ } else {
|
|
|
zhMap.put("测风塔轮毂风速", hjList);
|
|
|
}
|
|
|
map.put("stationType", stationType);
|
|
@@ -432,12 +416,13 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
|
|
|
}
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 中心侧预测数据统计,查询短期、超短期实时表厂家是SYJY的,每个点位值累加一起展示
|
|
|
- * @param startTime
|
|
|
- * @param endTime
|
|
|
- * @return
|
|
|
- */
|
|
|
+ // /**
|
|
|
+// * 中心侧预测数据统计,查询短期、超短期实时表厂家是SYJY的,每个点位值累加一起展示
|
|
|
+// *
|
|
|
+// * @param startTime
|
|
|
+// * @param endTime
|
|
|
+// * @return
|
|
|
+// */
|
|
|
// public Map<String, List> getCenterData(Date startTime, Date endTime) {
|
|
|
// Long startDateTime = startTime.getTime();
|
|
|
// Long endDateTime = endTime.getTime();
|
|
@@ -525,9 +510,6 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
|
|
|
//
|
|
|
// return map;
|
|
|
// }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
@Override
|
|
|
public List<PowerStationStatusData> findByTimeBetween(Date starTime, Date endTime) {
|
|
|
QueryWrapper<PowerStationStatusData> wrapper = new QueryWrapper<>();
|
|
@@ -538,4 +520,101 @@ public class PowerStationStatusDataServiceImpl extends ServiceImpl<PowerStationS
|
|
|
return baseMapper.selectList(wrapper);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 中心侧数据查询
|
|
|
+ *
|
|
|
+ * @param startTime
|
|
|
+ * @param endTime
|
|
|
+ * @param forecastHowLongAgo
|
|
|
+ * @param stationCode
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String, Object> cloudDataQuery(Date startTime, Date endTime, Integer forecastHowLongAgo, String stationCode) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ //表数据
|
|
|
+ map.put("tableData", new ArrayList<Map<String, Object>>());
|
|
|
+
|
|
|
+ Map<String, Map<Date, List<ForecastPowerShortTermCloud>>> forecastPowerShortTermCloudModelTimeMap = forecastPowerShortTermCloudService.findByForecastTimeBetweenAndHowLongAgoAndStationCode(startTime, endTime, forecastHowLongAgo, stationCode).stream().collect(Collectors.groupingBy(ForecastPowerShortTermCloud::getForecastModel, Collectors.groupingBy(ForecastPowerShortTermCloud::getTime, Collectors.toList())));
|
|
|
+ Map<Date, List<ForecastPowerShortTermStation>> forecastPowerShortTermStationTimeMap = forecastPowerShortTermStationService.findByForecastTimeBetweenAndForecastHowLongAgoAndStationCode(startTime, endTime, forecastHowLongAgo, stationCode).stream().collect(Collectors.groupingBy(ForecastPowerShortTermStation::getTime, Collectors.toList()));
|
|
|
+
|
|
|
+ Map<Date, List<PowerStationStatusData>> powerStationStatusDataTimeMap = findByTimeBetweenAndStationCode(startTime, endTime, stationCode).stream().collect(Collectors.groupingBy(PowerStationStatusData::getTime, Collectors.toList()));
|
|
|
+
|
|
|
+ ElectricField electricField = electricFieldService.findByStationCode(stationCode);
|
|
|
+ String electricFieldType = electricField.getElectricFieldTypeEnum();
|
|
|
+ List<TableFiled> tableFields = new ArrayList<>();
|
|
|
+
|
|
|
+ tableFields.addAll(Arrays.asList(new TableFiled("时间", "time"), new TableFiled("实际功率", "realPower"), new TableFiled("可用功率", "ablePower"), new TableFiled("理论功率", "theoryPower"),new TableFiled("站端", "fpValue")));
|
|
|
+
|
|
|
+ Map<String, String> forecastModelMap = new HashMap<>();
|
|
|
+
|
|
|
+ for (SysDictData sysDictData : DictUtils.getDictCache("forecast_model")) {
|
|
|
+ forecastModelMap.put(sysDictData.getDictLabel(), sysDictData.getDictValue());
|
|
|
+ tableFields.add(new TableFiled(sysDictData.getDictLabel(), sysDictData.getDictValue()));
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<Date, List<BaseCppEntity>> enStatusDataMap;
|
|
|
+ if (electricFieldType.equals("E1")) {
|
|
|
+ tableFields.add(new TableFiled("总辐射", "globalR"));
|
|
|
+ enStatusDataMap = weatherStationStatusDataService.findByBetweenTimeAndStationCode(startTime, endTime, stationCode).stream().collect(Collectors.groupingBy(WeatherStationStatusData::getTime, Collectors.toList()));
|
|
|
+ } else {
|
|
|
+ tableFields.add(new TableFiled("轮毂风速", "wsHubHeight"));
|
|
|
+ enStatusDataMap = windTowerStatusDataService.findByBetweenTimeAndStationCode(startTime, endTime, stationCode).stream().collect(Collectors.groupingBy(WindTowerStatusData::getTime, Collectors.toList()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<Map<String, Object>> list = (List<Map<String, Object>>) map.get("tableData");
|
|
|
+
|
|
|
+ for (long l = startTime.getTime(); l < endTime.getTime(); l += 900000L) {
|
|
|
+ Map<String, Object> dataMap = new HashMap<>();
|
|
|
+ Date time = new Date(l);
|
|
|
+ dataMap.put("time", DateFormatUtils.format(time,"yyyy-MM-dd HH:mm"));
|
|
|
+ PowerStationStatusData powerStationStatusData = Optional.ofNullable(powerStationStatusDataTimeMap.containsKey(time) ? powerStationStatusDataTimeMap.get(time).get(0) : null).orElse(new PowerStationStatusData());
|
|
|
+ dataMap.put("realPower", powerStationStatusData.getRealValue());
|
|
|
+ dataMap.put("ablePower", powerStationStatusData.getAbleValue());
|
|
|
+ dataMap.put("theoryPower", powerStationStatusData.getTheoryValue());
|
|
|
+
|
|
|
+ if (electricFieldType.equals("E1")) {
|
|
|
+ WeatherStationStatusData weatherStationStatusData = Optional.ofNullable(enStatusDataMap.containsKey(time) ? (WeatherStationStatusData) enStatusDataMap.get(time).get(0) : null).orElse(new WeatherStationStatusData());
|
|
|
+ dataMap.put("globalR", weatherStationStatusData.getGlobalR());
|
|
|
+
|
|
|
+ } else {
|
|
|
+ WindTowerStatusData windTowerStatusData = Optional.ofNullable(enStatusDataMap.containsKey(time) ? (WindTowerStatusData) enStatusDataMap.get(time).get(0) : null).orElse(new WindTowerStatusData());
|
|
|
+ dataMap.put("wsHubHeight", windTowerStatusData.getWsHubHeight());
|
|
|
+ }
|
|
|
+
|
|
|
+ ForecastPowerShortTermStation forecastPowerShortTermStation = Optional.ofNullable(forecastPowerShortTermStationTimeMap.containsKey(time) ? forecastPowerShortTermStationTimeMap.get(time).get(0) : null).orElse(new ForecastPowerShortTermStation());
|
|
|
+ dataMap.put("fpValue", forecastPowerShortTermStation.getFpValue());
|
|
|
+
|
|
|
+
|
|
|
+ for (Map.Entry<String, String> stringStringEntry : forecastModelMap.entrySet()) {
|
|
|
+ ForecastPowerShortTermCloud forecastPowerShortTermCloud = new ForecastPowerShortTermCloud();
|
|
|
+ if (forecastPowerShortTermCloudModelTimeMap.containsKey(stringStringEntry.getValue())) {
|
|
|
+ Map<Date, List<ForecastPowerShortTermCloud>> dateListMap = forecastPowerShortTermCloudModelTimeMap.get(stringStringEntry.getValue());
|
|
|
+ forecastPowerShortTermCloud = Optional.ofNullable(dateListMap.containsKey(time) ? dateListMap.get(time).get(0) : null).orElse(new ForecastPowerShortTermCloud());
|
|
|
+ }
|
|
|
+ dataMap.put(stringStringEntry.getValue(), forecastPowerShortTermCloud.getFpValue());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ list.add(dataMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ //表头
|
|
|
+ map.put("tableField", tableFields);
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Data
|
|
|
+ public class TableFiled {
|
|
|
+ private String title;
|
|
|
+ private String field;
|
|
|
+
|
|
|
+ public TableFiled(String title, String field) {
|
|
|
+ this.title = title;
|
|
|
+ this.field = field;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|