Commit ca4d4695 authored by ZWT's avatar ZWT

feat(吉林演示): 松原

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

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent f0d2b485
......@@ -1357,41 +1357,30 @@ public class EnergyConsumptionAnalysisService {
@XText("井组监控--光伏电站发电详情")
@XApiGet
public XListResult<GetPowerGenerationDetailsOutput> powerGenerationDetails(XContext context, GetEnergyConsumptionAnalysisInput input) {
List<DynamicQueryBasePowerLinePlantViewOutput> plantList = ServiceUtil.getPowerLinePlantList(context, DynamicQueryBasePowerLinePlantInput.builder()
.ouIds(ServiceUtil.getOrgIdsByPath(context, input.getOuId()))
.build());
Map<Date, BigDecimal> nowMap;
Map<Date, BigDecimal> lastMap;
Map<String, BigDecimal> collect = Collections.emptyMap();
DateTime begin = DateUtil.beginOfMonth(DateUtil.date());
DateTime end = DateUtil.endOfMonth(begin);
//电站名称列表有值再查
if (CollUtil.isNotEmpty(plantList)) {
List<String> stationNameList = new ArrayList<>(plantList.size());
List<String> stationIdList = new ArrayList<>(plantList.size());
for (DynamicQueryBasePowerLinePlantViewOutput plant : plantList) {
stationNameList.add(plant.getStationName());
stationIdList.add(plant.getPlantId());
}
//查电站关联井口
DynamicQueryBasePowerLineInput lineParam = new DynamicQueryBasePowerLineInput();
if (CharSequenceUtil.isNotBlank(input.getStationName())) {
//用stationName匹配电站
lineParam.setLineNames(CollUtil.list(false, input.getStationName()));
} else {
List<String> orgIdsByPath = ServiceUtil.getOrgIdsByPath(context, input.getOuId());
lineParam.setOuIdList(orgIdsByPath);
}
//查电站列表,计算统计数据
List<DynamicQueryBasePowerLineOutput> powerLineList = ServiceUtil.getPowerLineList(context, lineParam);
if (CollUtil.isNotEmpty(powerLineList)) {
String oilFieldCode = ServiceUtil.getOilFieldCode(context);
List<String> lineNameSet = powerLineList.stream()
.map(DynamicQueryBasePowerLineOutput::getLineName).collect(Collectors.toList());
//查本期实际发电量
nowMap = this.getPowerMap(context, begin, end, stationNameList, 1, oilFieldCode, null);
nowMap = this.getPowerMap(context, begin, end, lineNameSet, 1, oilFieldCode, null);
//查同期实际发电量
DateTime offset = DateUtil.offset(begin, DateField.YEAR, -1);
lastMap = this.getPowerMap(context, offset, DateUtil.endOfMonth(offset), stationNameList, 1, oilFieldCode, null);
//查预测功率
PlantPredictedPowerShortTermMapper shortTermMapper = context.getBean(PlantPredictedPowerShortTermMapper.class);
List<PlantPredictedPowerShortTermEnt> shortTermList = shortTermMapper.selectList(new QueryWrapper<PlantPredictedPowerShortTermEnt>()
.select("IFNULL( ROUND( SUM( power ), 2 ), 0 ) AS power", "DATE_FORMAT( data_date, '%Y-%m-%d 00:00:00' ) AS data_date")
.groupBy("DATE_FORMAT( data_date, '%Y-%m-%d 00:00:00' )")
.lambda()
.between(PlantPredictedPowerShortTermEnt::getDataDate, begin, end)
.in(PlantPredictedPowerShortTermEnt::getPlantId, stationIdList)
);
if (CollUtil.isNotEmpty(shortTermList)) {
collect = shortTermList.stream()
.collect(Collectors.toMap(PlantPredictedPowerShortTermEnt::getDataDate, PlantPredictedPowerShortTermEnt::getPower));
}
lastMap = this.getPowerMap(context, offset, DateUtil.endOfMonth(offset), lineNameSet, 1, oilFieldCode, null);
} else {
nowMap = Collections.emptyMap();
lastMap = Collections.emptyMap();
......@@ -1416,7 +1405,6 @@ public class EnergyConsumptionAnalysisService {
.dateFormat(dateTime.toString())
.powerGeneration(powerGeneration)
.lastPowerGeneration(lastPowerGeneration)
.predictedPower(collect.getOrDefault(dateTime.toString(), BigDecimal.ZERO))
.build());
}
return XListResult.success(outputs);
......@@ -1614,6 +1602,7 @@ public class EnergyConsumptionAnalysisService {
/*-----------------------------------private-----------------------------------*/
/**
* 电量统计
*
......@@ -1627,25 +1616,43 @@ public class EnergyConsumptionAnalysisService {
* @return {@link Map }<{@link Date }, {@link BigDecimal }>
*/
private Map<Date, BigDecimal> getPowerMap(XContext context, Date startTime, Date endTime, List<String> stationNameList, int flag, String oilFieldCode, Integer dateType) {
ThirdDailyAccumulationUpdateViewMapper mapper = context.getBean(ThirdDailyAccumulationUpdateViewMapper.class);
List<ThirdDailyAccumulationUpdateView> powerList = mapper.selectPowerTrendByDate(ThirdDailyAccumulationUpdateView.builder()
.startTime(startTime)
.endTime(endTime)
.stationNameList(stationNameList)
.systemSource(oilFieldCode)
.dayFlag(dateType)
.build());
Map<Date, BigDecimal> powerMap;
if (CollUtil.isNotEmpty(powerList) && CollUtil.isNotEmpty(stationNameList)) {
if (flag == 1) {
powerMap = powerList.stream()
.collect(Collectors.toMap(ThirdDailyAccumulationUpdateView::getCreateDate, ThirdDailyAccumulationUpdateView::getPhotovoltaicPower));
} else {
powerMap = powerList.stream()
.collect(Collectors.toMap(ThirdDailyAccumulationUpdateView::getCreateDate, ThirdDailyAccumulationUpdateView::getDailyElectricityConsumption));
}
} else {
powerMap = Collections.emptyMap();
switch (oilFieldCode) {
case BusinessConstant.ENV_SY:
StationDailyProductionSituationMapper situationMapper = context.getBean(StationDailyProductionSituationMapper.class);
List<StationDailyProductionSituationEnt> list = situationMapper.selectList(new QueryWrapper<StationDailyProductionSituationEnt>()
.select("IFNULL( ROUND( SUM( daily_electricity_consumption ), 2 ), 0 ) AS daily_electricity_consumption",
"IFNULL( ROUND( SUM( daily_liquid_production ), 2 ), 0 ) AS daily_liquid_production",
"IFNULL( ROUND( SUM( photovoltaic_power ), 2 ), 0 ) AS photovoltaic_power",
"data_date"
)
.lambda()
.in(CollUtil.isNotEmpty(stationNameList), StationDailyProductionSituationEnt::getStationName, stationNameList)
.between(ObjectUtil.isAllNotEmpty(startTime, endTime), StationDailyProductionSituationEnt::getDataDate, startTime, endTime)
.groupBy(StationDailyProductionSituationEnt::getDataDate)
);
if (CollUtil.isNotEmpty(list)) {
powerMap = list.stream()
.collect(Collectors.toMap(StationDailyProductionSituationEnt::getDataDate, flag == 1 ? StationDailyProductionSituationEnt::getPhotovoltaicPower : StationDailyProductionSituationEnt::getDailyElectricityConsumption));
} else {
powerMap = Collections.emptyMap();
}
break;
default:
ThirdDailyAccumulationUpdateViewMapper mapper = context.getBean(ThirdDailyAccumulationUpdateViewMapper.class);
List<ThirdDailyAccumulationUpdateView> powerList = mapper.selectPowerTrendByDate(ThirdDailyAccumulationUpdateView.builder()
.startTime(startTime)
.endTime(endTime)
.stationNameList(stationNameList)
.systemSource(oilFieldCode)
.dayFlag(dateType)
.build());
if (CollUtil.isNotEmpty(powerList) && CollUtil.isNotEmpty(stationNameList)) {
powerMap = powerList.stream()
.collect(Collectors.toMap(ThirdDailyAccumulationUpdateView::getCreateDate, flag == 1 ? ThirdDailyAccumulationUpdateView::getPhotovoltaicPower : ThirdDailyAccumulationUpdateView::getDailyElectricityConsumption));
} else {
powerMap = Collections.emptyMap();
}
}
return powerMap;
}
......
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