Commit c72e4629 authored by ZWT's avatar ZWT

feat(吉林演示): 松原

1.修改风资源监控页面历史风向统计接口,解决只能统计出一种风向问题,完成接口冒烟测试;
2.修改风资源监控页面风电站运行状态接口,解决没有启动状态时无法查询数据问题,完成接口冒烟测试;
3.修改风资源监控页面发电功率预测接口,增加使用模拟数据生成风电实际功率,完成接口冒烟测试;
4.修改风资源历史数据处理定时任务,增加模拟真实数据匹配逻辑,完成冒烟测试;
5.修改中期短期超短期风功率预测接口,增加模拟实际发电功率处理逻辑,完成接口冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 595308c9
......@@ -92,13 +92,13 @@ public class WindPredictionFutureService {
int betweenDay = 0;
DateTime day = inputTime;
//计算时间范围,开始时间往前推1天,结束时间往后推4小时
DateTime beginTime = DateUtil.offsetMinute(day, -1441);
DateTime beginTime = DateUtil.offsetDay(day, -1);
DateTime endTime = DateUtil.offsetHour(day, 4);
//查预测功率
Map<Date, WindPredictionFutureEnt> predictedMap = this.getPredictedMap(context, input.getStationId(), beginTime, endTime);
//查实际功率
Map<Date, BigDecimal> powerMap = Collections.emptyMap();
return XListResult.success(getPowerOutput(DateUtil.offsetDay(day, -1), endTime, betweenDay, now, predictedMap, powerMap));
Map<Date, ThirdWindPowerGenerationEnt> powerMap = this.getActivePower15MinuteMap(context, input.getStationId(), beginTime, endTime);
return XListResult.success(getPowerOutput(beginTime, endTime, betweenDay, now, predictedMap, powerMap));
}
/*-----------------------------------统计分析(风能发电监控) todo 模拟数据-----------------------------------*/
......@@ -682,8 +682,7 @@ public class WindPredictionFutureService {
//查预测功率
Map<Date, WindPredictionFutureEnt> predictedMap = this.getPredictedMap(context, stationId, beginTime, endTime);
//查实际功率
// Map<Date, BigDecimal> powerMap = getActivePowerMap15(context, stationId, beginTime, showTime);
Map<Date, BigDecimal> powerMap = Collections.emptyMap();
Map<Date, ThirdWindPowerGenerationEnt> powerMap = this.getActivePower15MinuteMap(context, stationId, beginTime, endTime);
return getPowerOutput(day, endTime, betweenDay, date, predictedMap, powerMap);
}
......@@ -699,13 +698,14 @@ public class WindPredictionFutureService {
* @return {@link List }<{@link GetWindPredictionFutureOutput }>
*/
private List<GetWindPredictionFutureOutput> getPowerOutput(DateTime beginTime, DateTime endTime, int betweenDay, Date now,
Map<Date, WindPredictionFutureEnt> predictedMap, Map<Date, BigDecimal> powerMap) {
Map<Date, WindPredictionFutureEnt> predictedMap, Map<Date, ThirdWindPowerGenerationEnt> powerMap) {
//取时间范围
List<DateTime> rangeToList = DateUtil.rangeToList(beginTime, endTime, DateField.MINUTE, 15);
GetWindPredictionFutureOutput output;
List<GetWindPredictionFutureOutput> outputs = new ArrayList<>(rangeToList.size());
Date dataDate;
WindPredictionFutureEnt windPredictionFutureEnt;
ThirdWindPowerGenerationEnt generationEnt;
for (DateTime dateTime : rangeToList) {
output = new GetWindPredictionFutureOutput();
//时间偏移
......@@ -719,14 +719,13 @@ public class WindPredictionFutureService {
if (predictedMap.containsKey(dataDate)) {
windPredictionFutureEnt = predictedMap.get(dataDate);
output.setPredictedPower(windPredictionFutureEnt.getPredictedPower());
output.setActualWindSpeed(windPredictionFutureEnt.getActualWindSpeed());
output.setWindSpeed(windPredictionFutureEnt.getWindSpeed());
}
//匹配实际发电量
if (DateUtil.compare(dataDate, now) > 0) {
output.setActualPower(null);
} else {
output.setActualPower(powerMap.getOrDefault(dateTime, null));
if (powerMap.containsKey(dataDate)) {
generationEnt = powerMap.get(dataDate);
output.setActualWindSpeed(generationEnt.getActualWindSpeed());
output.setActualPower(generationEnt.getActualPower());
}
outputs.add(output);
}
......@@ -817,4 +816,32 @@ public class WindPredictionFutureService {
BaseWindTurbineMapper mapper = context.getBean(BaseWindTurbineMapper.class);
return mapper.selectList(queryWrapper);
}
/**
* 获取真实发电功率
* todo 模拟数据
*
* @param context 上下文
* @param stationId 站点id
* @param beginTime 开始时间
* @param endTime 结束时间
* @return {@link Map }<{@link Date }, {@link ThirdWindPowerGenerationEnt }>
*/
private Map<Date, ThirdWindPowerGenerationEnt> getActivePower15MinuteMap(XContext context, String stationId, DateTime beginTime, DateTime endTime) {
ThirdWindPowerGenerationMapper generationMapper = context.getBean(ThirdWindPowerGenerationMapper.class);
List<ThirdWindPowerGenerationEnt> list = generationMapper.selectList(new QueryWrapper<ThirdWindPowerGenerationEnt>()
.select("collect_time", "IFNULL( MAX( actual_wind_speed ), 0 ) AS actual_wind_speed", "IFNULL( MAX( actual_power ), 0 ) AS actual_power")
.groupBy("collect_time")
.lambda()
.eq(ThirdWindPowerGenerationEnt::getStationId, stationId)
.between(ThirdWindPowerGenerationEnt::getCollectTime, beginTime, endTime)
);
Map<Date, ThirdWindPowerGenerationEnt> collect;
if (CollUtil.isEmpty(list)) {
collect = Collections.emptyMap();
} else {
collect = list.stream().collect(Collectors.toMap(ThirdWindPowerGenerationEnt::getCollectTime, Function.identity()));
}
return collect;
}
}
\ No newline at end of file
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