Commit 8ae57480 authored by ZWT's avatar ZWT

feat[零碳项目]: 松原演示

[1.修改井口日用电趋势统计表,增加谷电时段发电时长及谷电占比字段,同时在代码中添加对应字段并修改数据库mapper文件相关业务处理逻辑sql语句;
2.修改线路日用电趋势统计表,增加谷电时段发电时长及谷电占比字段,同时在代码中添加对应字段并修改数据库mapper文件相关业务处理逻辑sql语句;
3.修改井口/线路日用电趋势统计定时任务,增加环境区分,通过读取配置表来获取当前部署环境,针对不同环境进行不同业务处理,同时增加获取每日井口及线路谷电运行时长统计逻辑,完成功能冒烟测试;
4.修改首页总览接口逻辑,增加环境区分,通过读取配置表来获取当前部署环境,针对不同环境进行不同业务处理;]
parent 7c30a71a
......@@ -184,54 +184,76 @@ public class HomePageService {
@XText("首页模块--井场实时监控")
@XApiGet
public XSingleResult<GetWellOverviewViewOutput> getWellOverview(XContext context, GetStationViewInput input) {
DateTime beginOfDay = DateUtil.beginOfDay(DateUtil.date());
DateTime beginOfDay = DateUtil.beginOfDay(DateUtil.offsetDay(DateUtil.date(), -3));
String stationId = input.getStationId();
int openWellNumber = 0;
int stopWellNumber = 0;
BigDecimal cumulativeProduction = BigDecimal.ZERO;
BigDecimal powerGeneration = BigDecimal.ZERO;
BigDecimal powerConsumption = BigDecimal.ZERO;
String oilFieldCode = this.getOilFieldCode(context);
switch (oilFieldCode) {
case BusinessConstant.ENV_CQ:
//实时站
Set<String> set = this.getPlantList(context, stationId, null).stream()
.map(GetBasePhotovoltaicPlantCloudOutput::getStationName)
.collect(Collectors.toSet());
ThirdDailyAccumulationUpdateMapper mapper = context.getBean(ThirdDailyAccumulationUpdateMapper.class);
ThirdDailyAccumulationUpdateEnt ent = mapper.selectOne(new QueryWrapper<ThirdDailyAccumulationUpdateEnt>()
.select("IFNULL( ROUND( SUM( photovoltaic_power ), 2 ), 0 ) AS photovoltaic_power",
"IFNULL( ROUND( SUM( daily_electricity_consumption ), 2 ), 0 ) AS daily_electricity_consumption",
"IFNULL( ROUND( SUM( daily_liquid_production ), 2 ), 0 ) AS daily_liquid_production")
.lambda()
.eq(ThirdDailyAccumulationUpdateEnt::getSaveDate, beginOfDay)
.in(ThirdDailyAccumulationUpdateEnt::getStationName, set)
);
if (ObjectUtil.isNotNull(ent)) {
cumulativeProduction = ent.getDailyLiquidProduction();
powerGeneration = ent.getPhotovoltaicPower();
powerConsumption = ent.getDailyElectricityConsumption();
}
break;
case BusinessConstant.ENV_SY:
break;
default:
}
//实时井口
Set<String> set = this.getWellList(context, stationId).stream()
.map(DynamicQueryBaseWellheadOutput::getWellNumber)
.collect(Collectors.toSet());
int openWellNumber = 0, stopWellNumber = 0, openJCNumber = 0, openLCNumber = 0, stopJCNumber = 0, stopLCNumber = 0;
List<DynamicQueryBaseWellheadOutput> list = this.getWellList(context, stationId);
Map<String, String> collect = list.stream()
.collect(Collectors.toMap(DynamicQueryBaseWellheadOutput::getWellNumber, DynamicQueryBaseWellheadOutput::getRunTypeKey));
ThirdCurrentWellConditionMapper wellMapper = context.getBean(ThirdCurrentWellConditionMapper.class);
List<ThirdCurrentWellConditionEnt> wellList = wellMapper.selectList(new LambdaQueryWrapper<ThirdCurrentWellConditionEnt>()
.in(ThirdCurrentWellConditionEnt::getWellNumber, set)
.in(ThirdCurrentWellConditionEnt::getWellNumber, collect.keySet())
.ge(ThirdCurrentWellConditionEnt::getUpdateTime, beginOfDay)
.eq(ThirdCurrentWellConditionEnt::getSystemSource, oilFieldCode)
);
if (CollUtil.isNotEmpty(wellList)) {
for (ThirdCurrentWellConditionEnt well : wellList) {
if (set.contains(well.getWellNumber())) {
if (collect.containsKey(well.getWellNumber())) {
if (CharSequenceUtil.equals(well.getWellStatus(), "开井")) {
openWellNumber++;
if (CharSequenceUtil.equals(collect.get(well.getWellNumber()), BusinessConstant.INTERVAL_PUMPING_WELL)) {
openJCNumber++;
} else {
openLCNumber++;
}
} else {
stopWellNumber++;
if (CharSequenceUtil.equals(collect.get(well.getWellNumber()), BusinessConstant.INTERVAL_PUMPING_WELL)) {
stopJCNumber++;
} else {
stopLCNumber++;
}
}
}
}
}
//实时站
set = this.getPlantList(context, stationId, null).stream()
.map(GetBasePhotovoltaicPlantCloudOutput::getStationName)
.collect(Collectors.toSet());
ThirdDailyAccumulationUpdateMapper mapper = context.getBean(ThirdDailyAccumulationUpdateMapper.class);
ThirdDailyAccumulationUpdateEnt ent = mapper.selectOne(new QueryWrapper<ThirdDailyAccumulationUpdateEnt>()
.select("IFNULL( ROUND( SUM( photovoltaic_power ), 2 ), 0 ) AS photovoltaic_power",
"IFNULL( ROUND( SUM( daily_electricity_consumption ), 2 ), 0 ) AS daily_electricity_consumption",
"IFNULL( ROUND( SUM( daily_liquid_production ), 2 ), 0 ) AS daily_liquid_production")
.lambda()
.eq(ThirdDailyAccumulationUpdateEnt::getSaveDate, beginOfDay)
.in(ThirdDailyAccumulationUpdateEnt::getStationName, set)
);
if (ObjectUtil.isNotNull(ent)) {
cumulativeProduction = ent.getDailyLiquidProduction();
powerGeneration = ent.getPhotovoltaicPower();
powerConsumption = ent.getDailyElectricityConsumption();
}
return XSingleResult.success(GetWellOverviewViewOutput.builder()
.openWellNumber(openWellNumber)
.stopWellNumber(stopWellNumber)
.openJCNumber(openJCNumber)
.openLCNumber(openLCNumber)
.stopJCNumber(stopJCNumber)
.stopLCNumber(stopLCNumber)
.cumulativeProduction(cumulativeProduction)
.powerGeneration(powerGeneration)
.powerConsumption(powerConsumption)
......
......@@ -34,4 +34,16 @@ public class GetWellOverviewViewOutput {
@XText("用电量(kWh)")
private BigDecimal powerConsumption;
@XText("开井间开数量")
private Integer openJCNumber;
@XText("开井连抽数量")
private Integer openLCNumber;
@XText("停井间开数量")
private Integer stopJCNumber;
@XText("停井连抽数量")
private Integer stopLCNumber;
}
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