Commit c02c3dea authored by ZWT's avatar ZWT

feat(吉林演示): 松原

1.排查并修复各时段间开优化功能执行异常导致未执行间开优化问题;
2.排查并修复15天间开优化功能执行后,优化结果时间段展示错乱问题;
3.排查并修复光伏功率预测展示功能,实际功率未展示问题;
4.排查并修复天气数据获取服务,数据处理后入库缺少数据问题;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 75092eea
...@@ -858,8 +858,9 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -858,8 +858,9 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
Map<String, List<BasePhotovoltaicPlantView>> plantMap = plantList.stream() Map<String, List<BasePhotovoltaicPlantView>> plantMap = plantList.stream()
.collect(Collectors.groupingBy(BasePhotovoltaicPlantView::getCityCode)); .collect(Collectors.groupingBy(BasePhotovoltaicPlantView::getCityCode));
int count = 0; int count = 0;
Map<String, Set<String>> temp = new HashMap<>(32);
for (JSONObject jsonObject : jsonObjectList) { for (JSONObject jsonObject : jsonObjectList) {
this.dataFractionation(jsonObject, plantMap, deleteList, batchList); this.dataFractionation(jsonObject, plantMap, deleteList, batchList, temp);
if (CollUtil.isEmpty(batchList)) { if (CollUtil.isEmpty(batchList)) {
continue; continue;
} }
...@@ -897,7 +898,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -897,7 +898,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
* @param deleteList 删除列表 * @param deleteList 删除列表
* @param batchList 批次列表 * @param batchList 批次列表
*/ */
private void dataFractionation(JSONObject jsonObject, Map<String, List<BasePhotovoltaicPlantView>> plantMap, List<String> deleteList, List<PlantPredictedPowerDataEnt> batchList) { private void dataFractionation(JSONObject jsonObject, Map<String, List<BasePhotovoltaicPlantView>> plantMap, List<String> deleteList, List<PlantPredictedPowerDataEnt> batchList, Map<String, Set<String>> temp) {
Map<String, List<DailyData>> cityDataMap = new HashMap<>(16); Map<String, List<DailyData>> cityDataMap = new HashMap<>(16);
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) { for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
...@@ -906,6 +907,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -906,6 +907,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
cityDataMap.put(key, ((JSONArray) value).toJavaList(DailyData.class)); cityDataMap.put(key, ((JSONArray) value).toJavaList(DailyData.class));
} }
} }
Set<String> timeSet;
for (String cityCode : cityDataMap.keySet()) { for (String cityCode : cityDataMap.keySet()) {
if (!plantMap.containsKey(cityCode)) { if (!plantMap.containsKey(cityCode)) {
continue; continue;
...@@ -924,16 +926,26 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -924,16 +926,26 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
List<PlantPredictedPowerDataEnt> objList = new ArrayList<>(16); List<PlantPredictedPowerDataEnt> objList = new ArrayList<>(16);
String plantId = plant.getId(); String plantId = plant.getId();
String stationName = plant.getStationName(); String stationName = plant.getStationName();
//获取时间临时缓存
if (temp.containsKey(plantId)) {
timeSet = temp.get(plantId);
} else {
timeSet = new HashSet<>(128);
temp.put(plantId, timeSet);
}
DateTime date; DateTime date;
int flag = 0; boolean nextDay = false;
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
if (nextDay) {
dateTime = DateUtil.offsetDay(dateTime, 1);
}
//判断小时数与查到的小时数,如果查到的小时数小,判断为第二天 //判断小时数与查到的小时数,如果查到的小时数小,判断为第二天
int hour = LocalTime.parse(dailyData.getHourTimeArray().get(i)).getHour(); int hour = LocalTime.parse(dailyData.getHourTimeArray().get(i)).getHour();
DateTime parse = DateUtil.parse(DateUtil.formatDate(dateTime) + ' ' + this.int2Str(hour) + ':' + BusinessConstant.START_OF_DAY_TIME); DateTime parse = DateUtil.parse(DateUtil.formatDate(dateTime) + ' ' + this.int2Str(hour) + ':' + BusinessConstant.START_OF_DAY_TIME);
if (DateUtil.compare(parse, dateTime) < 0 && flag == 0) { if (hour == 23) {
parse = DateUtil.offsetDay(parse, 1); nextDay = true;
dateTime = DateUtil.offsetDay(dateTime, 1); } else {
flag++; nextDay = false;
} }
PlantPredictedPowerDataEnt dao = this.getPlantPredictedPowerEnt(plantId, stationName, cityCode, PlantPredictedPowerDataEnt dao = this.getPlantPredictedPowerEnt(plantId, stationName, cityCode,
this.int2Str(hour), this.int2Str(hour),
...@@ -965,13 +977,15 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -965,13 +977,15 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
// 原站点时间结构为:08:00 11:00 14:00 17:00 20:00 23:00 02:00 05:00 // 原站点时间结构为:08:00 11:00 14:00 17:00 20:00 23:00 02:00 05:00
// 两条数据中间差了两个小时,使用上下两条数据推算出中间差掉的两个小时 // 两条数据中间差了两个小时,使用上下两条数据推算出中间差掉的两个小时
for (int i = 0; i < objList.size() - 1; i++) { for (int i = 0; i < objList.size() - 1; i++) {
for (int y = 1; y < 3; y++) {
PlantPredictedPowerDataEnt dataEnt = objList.get(i); PlantPredictedPowerDataEnt dataEnt = objList.get(i);
date = DateTime.of(dataEnt.getDataDate(), "yyyy-MM-dd HH:mm"); date = DateTime.of(dataEnt.getDataDate(), "yyyy-MM-dd HH:mm");
String hourString; String hourString;
Integer hourTime = Integer.valueOf(dataEnt.getHourTime()); Integer hourTime = Integer.valueOf(dataEnt.getHourTime());
if (hourTime.equals(23)) { if (hourTime.equals(23)) {
date = DateUtil.offsetDay(date, 1); date = DateUtil.offsetDay(date, 1);
}
for (int y = 1; y < 3; y++) {
if (hourTime.equals(23)) {
hourString = "0" + (y - 1); hourString = "0" + (y - 1);
} else { } else {
if ((hourTime + y) < 10) { if ((hourTime + y) < 10) {
...@@ -1000,46 +1014,22 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -1000,46 +1014,22 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
} }
} }
//入库 //入库
List<PlantPredictedPowerDataEnt> sortList = allList.stream() allList.sort(Comparator.comparing(PlantPredictedPowerDataEnt::getDataDate));
.sorted(Comparator.comparing(PlantPredictedPowerDataEnt::getDataDate)) for (int i = 0; i < allList.size(); i++) {
.collect(Collectors.toList()); PlantPredictedPowerDataEnt item = allList.get(i);
for (int i = 0; i < sortList.size(); i++) { //判断时间是否存在
PlantPredictedPowerDataEnt item = sortList.get(i); if (timeSet.contains(item.getDataDate())) {
batchList.add(item); continue;
if (i < sortList.size() - 1) { } else {
timeSet.add(item.getDataDate());
}
for (int y = 0; y < BusinessConstant.TIME_LIST.size(); y++) { for (int y = 0; y < BusinessConstant.TIME_LIST.size(); y++) {
PlantPredictedPowerDataEnt dao = XCopyUtils.copyNewObject(item); PlantPredictedPowerDataEnt dao = XCopyUtils.copyNewObject(item);
dao.setMinTime(BusinessConstant.TIME_LIST.get(y)); dao.setMinTime(BusinessConstant.TIME_LIST.get(y));
dao.setDataDate(dao.getYearTime() + '-' + dao.getMonthTime() + '-' + dao.getDayTime() + ' ' + dao.getHourTime() + ':' + dao.getMinTime()); dao.setDataDate(dao.getYearTime() + '-' + dao.getMonthTime() + '-' + dao.getDayTime() + ' ' + dao.getHourTime() + ':' + dao.getMinTime());
PlantPredictedPowerDataEnt nextData = sortList.get(i + 1);
BigDecimal valueOf = BigDecimal.valueOf(0.3 * (y + 1));
dao.setTemperature(this.compute(Objects.isNull(item.getTemperature()) ? BigDecimal.ZERO : item.getTemperature(),
Objects.isNull(nextData.getTemperature()) ? BigDecimal.ZERO : nextData.getTemperature(),
valueOf));
dao.setHumidity(this.compute(Objects.isNull(item.getHumidity()) ? BigDecimal.ZERO : item.getHumidity(),
Objects.isNull(nextData.getHumidity()) ? BigDecimal.ZERO : nextData.getHumidity(),
valueOf));
dao.setWindSpeed(this.compute(Objects.isNull(item.getWindSpeed()) ? BigDecimal.ZERO : item.getWindSpeed(),
Objects.isNull(nextData.getWindSpeed()) ? BigDecimal.ZERO : nextData.getWindSpeed(),
valueOf));
dao.setPressure(this.compute(Objects.isNull(item.getPressure()) ? BigDecimal.ZERO : item.getPressure(),
Objects.isNull(nextData.getPressure()) ? BigDecimal.ZERO : nextData.getPressure(),
valueOf));
dao.setPlaneIrradiance(this.compute(Objects.isNull(item.getPlaneIrradiance()) ? BigDecimal.ZERO : item.getPlaneIrradiance(),
Objects.isNull(nextData.getPlaneIrradiance()) ? BigDecimal.ZERO : nextData.getPlaneIrradiance(),
valueOf));
dao.setHorizontalIrradiance(this.compute(Objects.isNull(item.getHorizontalIrradiance()) ? BigDecimal.ZERO : item.getHorizontalIrradiance(),
Objects.isNull(nextData.getHorizontalIrradiance()) ? BigDecimal.ZERO : nextData.getHorizontalIrradiance(),
valueOf));
dao.setPower(this.compute(Objects.isNull(item.getPower()) ? BigDecimal.ZERO : item.getPower(),
Objects.isNull(nextData.getPower()) ? BigDecimal.ZERO : nextData.getPower(),
valueOf));
dao.setPrecipitation(this.compute(Objects.isNull(item.getPrecipitation()) ? BigDecimal.ZERO : item.getPrecipitation(),
Objects.isNull(nextData.getPrecipitation()) ? BigDecimal.ZERO : nextData.getPrecipitation(),
valueOf));
batchList.add(dao); batchList.add(dao);
} }
} batchList.add(item);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment