Commit e2ebbeac authored by ZWT's avatar ZWT

feat(零碳): 长庆

1.修改极短期间开预测定时任务逻辑,解决优化后部分优化结果时间段过短问题;
2.修改心知天气气象数据获取及接收定时任务,解决天气数据通过邮件下载后,部分数据精度丢失问题;
3.修改首页

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 7d29ad47
......@@ -44,6 +44,7 @@ import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.data.XListResult;
import xstartup.data.XSingleResult;
import xstartup.feature.api.annotation.XApiAnonymous;
import xstartup.feature.api.annotation.XApiGet;
import java.math.BigDecimal;
......@@ -248,12 +249,12 @@ public class HomePageService {
BigDecimal powerConsumption;
for (DateTime dateTime : rangeToList) {
if (avgMap.containsKey(dateTime)) {
powerConsumption = avgMap.get(dateTime);
powerConsumption = avgMap.get(dateTime).setScale(2, RoundingMode.HALF_UP);
} else {
powerConsumption = BigDecimal.ZERO;
}
if (powerMap.containsKey(dateTime)) {
powerGeneration = powerMap.get(dateTime);
powerGeneration = powerMap.get(dateTime).setScale(2, RoundingMode.HALF_UP);
} else {
powerGeneration = BigDecimal.ZERO;
}
......@@ -395,14 +396,14 @@ public class HomePageService {
BigDecimal meterPower = BigDecimal.ZERO;
String value = String.valueOf(i);
if (shortPowerMap.containsKey(value)) {
predictPower = shortPowerMap.get(value);
predictPower = shortPowerMap.get(value).setScale(2, RoundingMode.HALF_UP);
}
if (powerMap.containsKey(i)) {
powerDaily = powerMap.get(i);
actualPower = powerDaily.getPhotovoltaicPower();
actualPower = powerDaily.getPhotovoltaicPower().setScale(2, RoundingMode.HALF_UP);
}
if (avgMap.containsKey(i)) {
meterPower = avgMap.get(i);
meterPower = avgMap.get(i).setScale(2, RoundingMode.HALF_UP);
}
outputs.add(
GetPowerPredictionOutput.builder()
......@@ -508,14 +509,16 @@ public class HomePageService {
.wellNumber(wellList.size())
.intervalWellNumber(intervalWellNumber)
.continuousWellNumber(continuousWellNumber)
.operatingLoad(operatingLoad)
.operatingLoad(operatingLoad.setScale(2, RoundingMode.HALF_UP))
.lineNumber(lineList.size())
.photovoltaicPower(plantList.stream()
.map(GetBasePhotovoltaicPlantCloudOutput::getTotalPower)
.reduce(BigDecimal.ZERO, BigDecimal::add))
.reduce(BigDecimal.ZERO, BigDecimal::add)
.setScale(2, RoundingMode.HALF_UP))
.storagePower(storageList.stream()
.map(DynamicQueryBaseEnergyStorageDeviceOutput::getApparatusCapacity)
.reduce(BigDecimal.ZERO, BigDecimal::add))
.reduce(BigDecimal.ZERO, BigDecimal::add)
.setScale(2, RoundingMode.HALF_UP))
.build());
}
......@@ -553,6 +556,7 @@ public class HomePageService {
* @param input 输入
* @return {@link XSingleResult}<{@link GetLineViewOutput}>
*/
@XApiAnonymous
@XText("首页模块--线路详情")
@XApiGet
public XSingleResult<GetLineViewOutput> getLineView(XContext context, GetLineViewInput input) {
......@@ -569,6 +573,15 @@ public class HomePageService {
String areaName = null;
if (CollUtil.isNotEmpty(plantViewList)) {
areaName = this.getSysAreaPath(context, plantViewList.get(0).getAreaCode());
} else {
return XSingleResult.success(GetLineViewOutput.builder()
.wellList(wellheadList)
.operatingLoad(operatingLoad)
.cumulativeProduction(BigDecimal.ZERO)
.photovoltaicPower(BigDecimal.ZERO)
.powerGeneration(BigDecimal.ZERO)
.dailyElectricityConsumption(BigDecimal.ZERO)
.build());
}
ThirdDailyAccumulationUpdateMapper mapper = context.getBean(ThirdDailyAccumulationUpdateMapper.class);
ThirdDailyAccumulationUpdateEnt dailyAccumulation = mapper.selectOne(new QueryWrapper<ThirdDailyAccumulationUpdateEnt>()
......@@ -584,12 +597,13 @@ public class HomePageService {
return XSingleResult.success(GetLineViewOutput.builder()
.wellList(wellheadList)
.operatingLoad(operatingLoad)
.cumulativeProduction(dailyAccumulation.getDailyLiquidProduction())
.cumulativeProduction(dailyAccumulation.getDailyLiquidProduction().setScale(2, RoundingMode.HALF_UP))
.photovoltaicPower(plantViewList.stream()
.map(DynamicQueryBasePowerLinePlantViewOutput::getTotalPower)
.reduce(BigDecimal.ZERO, BigDecimal::add))
.powerGeneration(dailyAccumulation.getPhotovoltaicPower())
.dailyElectricityConsumption(dailyAccumulation.getDailyElectricityConsumption())
.reduce(BigDecimal.ZERO, BigDecimal::add)
.setScale(2, RoundingMode.HALF_UP))
.powerGeneration(dailyAccumulation.getPhotovoltaicPower().setScale(2, RoundingMode.HALF_UP))
.dailyElectricityConsumption(dailyAccumulation.getDailyElectricityConsumption().setScale(2, RoundingMode.HALF_UP))
.areaName(areaName)
.build());
}
......
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