Commit a178739e authored by ZWT's avatar ZWT

feat(零碳): 长庆演示系统新增功能

1.修改第三方日累计数据推送表表结构,增加日累计储能放电量字段,同时修改代码对应实体及mapper文件,修改相关接口增加储能日累计放电量接收逻辑;
2.修改首页井场收益分析模块接口,修改获取储能累计放电量逻辑;
3.设计并创建井口日用电趋势表,生成对应实体类及mapper文件;
4.统计分析模块,新增本月累计节电经济效益查询接口,添加线上接口文档并完成接口冒烟测试;
5.统计分析模块,新增本月累计减碳量查询接口,添加线上接口文档并完成接口冒烟测试;
6.统计分析模块,新增光伏发电趋势查询接口,添加线上接口文档并完成接口冒烟测试;
7.统计分析模块,新增月度总览查询接口,添加线上接口文档并完成接口冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 172b802c
package pps.cloud.space.service;
import pps.cloud.space.service.data.space_optimize_short_wellhead.GetMonthlyWellCountInput;
import pps.cloud.space.service.data.space_optimize_short_wellhead.GetMonthlyWellCountOutput;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.data.XServiceResult;
import xstartup.data.XSingleResult;
/**
* 极短期间开优化Cloud模块
......@@ -23,4 +26,14 @@ public interface ISpaceOptimizeShortCloudService {
*/
@XText("短期间开开优化Cloud模块--定时任务")
XServiceResult optimizeShortJob(XContext context);
/**
* 月度井口统计
*
* @param context 上下文
* @param input 输入
* @return {@link XSingleResult }<{@link GetMonthlyWellCountOutput }>
*/
@XText("短期间开开优化Cloud模块--月度井口统计")
XSingleResult<GetMonthlyWellCountOutput> monthlyWellCount(XContext context, GetMonthlyWellCountInput input);
}
package pps.cloud.space.service.data.space_optimize_short_wellhead;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import xstartup.annotation.XText;
/**
* 月度优化井口统计
*
* @author ZWT
* @date 2024/05/27 14:24
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GetMonthlyWellCountInput {
@XText("月份")
private Integer month;
}
package pps.cloud.space.service.data.space_optimize_short_wellhead;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import xstartup.annotation.XText;
/**
* 月度优化井口统计
*
* @author ZWT
* @date 2024/05/27 14:24
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GetMonthlyWellCountOutput {
@XText("优化井数")
private Long wellNumber;
}
package pps.core.space.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import pps.cloud.space.service.ISpaceOptimizeShortCloudService;
import pps.cloud.space.service.data.space_optimize_short_wellhead.GetMonthlyWellCountInput;
import pps.cloud.space.service.data.space_optimize_short_wellhead.GetMonthlyWellCountOutput;
import pps.core.space.entity.SpaceOptimizeShortWellheadEnt;
import pps.core.space.mapper.SpaceOptimizeShortWellheadMapper;
import xstartup.annotation.XService;
import xstartup.base.XContext;
import xstartup.data.XServiceResult;
import xstartup.data.XSingleResult;
/**
* 极短期间开优化Cloud模块
......@@ -73,4 +79,16 @@ public class SpaceOptimizeShortCloudServiceImpl extends SpaceOptimizeBaseService
// });
return XServiceResult.OK;
}
@Override
public XSingleResult<GetMonthlyWellCountOutput> monthlyWellCount(XContext context, GetMonthlyWellCountInput input) {
SpaceOptimizeShortWellheadMapper mapper = context.getBean(SpaceOptimizeShortWellheadMapper.class);
Long count = mapper.selectCount(new QueryWrapper<SpaceOptimizeShortWellheadEnt>()
.select("DISTINCT well_number")
.apply("MONTH ( optimize_date ) = {0}", input.getMonth())
);
return XSingleResult.success(GetMonthlyWellCountOutput.builder()
.wellNumber(count)
.build());
}
}
\ No newline at end of file
......@@ -22,10 +22,13 @@ import pps.cloud.base.service.data.base_wellhead.DynamicQueryBaseWellheadInput;
import pps.cloud.base.service.data.base_wellhead.DynamicQueryBaseWellheadOutput;
import pps.cloud.space.service.IDailyElectricityTrendCloudService;
import pps.cloud.space.service.ISpaceInstitutionDetailCloudService;
import pps.cloud.space.service.ISpaceOptimizeShortCloudService;
import pps.cloud.space.service.data.line_daily_electricity_trend.GetLineDailyElectricityTrendInput;
import pps.cloud.space.service.data.line_daily_electricity_trend.GetLineDailyElectricityTrendOutput;
import pps.cloud.space.service.data.space_institution_wellhead.GetSpaceInstitutionWellheadInput;
import pps.cloud.space.service.data.space_institution_wellhead.GetSpaceInstitutionWellheadOutput;
import pps.cloud.space.service.data.space_optimize_short_wellhead.GetMonthlyWellCountInput;
import pps.cloud.space.service.data.space_optimize_short_wellhead.GetMonthlyWellCountOutput;
import pps.cloud.space.service.data.well_daily_electricity_trend.GetWellDailyElectricityTrendInput;
import pps.cloud.space.service.data.well_daily_electricity_trend.GetWellDailyElectricityTrendOutput;
import pps.cloud.system.service.SysOrganizationCloudService;
......@@ -621,6 +624,67 @@ public class EnergyConsumptionAnalysisService {
/*------------------------------ 间开效果评价 ------------------------------*/
/**
* 月度总览
*
* @param context 上下文
* @param input 输入
* @return {@link XSingleResult }<{@link GetMonthlyOverviewOutput }>
*/
@XText("间开效果评价--月度总览")
@XApiGet
public XSingleResult<GetMonthlyOverviewOutput> monthlyOverview(XContext context, GetEnergyConsumptionAnalysisInput input) {
DynamicQueryBasePowerLinePlantInput plantInput = new DynamicQueryBasePowerLinePlantInput();
String stationName = input.getStationName();
if (CharSequenceUtil.isNotBlank(stationName)) {
plantInput.setLineName(stationName);
} else {
plantInput.setOuIds(this.getOrgIdsByPath(context, input.getOuId()));
}
BigDecimal accumulatePowerGeneration = BigDecimal.ZERO;
BigDecimal dailyElectricityConsumption = BigDecimal.ZERO;
BigDecimal greenElectricityRate = BigDecimal.ZERO;
BigDecimal economicBenefit = BigDecimal.ZERO;
BigDecimal carbonReduction = BigDecimal.ZERO;
DateTime end = DateUtil.beginOfDay(DateUtil.date());
List<DynamicQueryBasePowerLinePlantViewOutput> plantList = this.getPowerLinePlantViewList(context, plantInput);
if (CollUtil.isNotEmpty(plantList)) {
DateTime start = DateUtil.beginOfMonth(end);
//累计发电
ThirdDailyAccumulationUpdateMapper analysisMapper = context.getBean(ThirdDailyAccumulationUpdateMapper.class);
ThirdDailyAccumulationUpdateEnt analysisEnt = analysisMapper.selectOne(new QueryWrapper<ThirdDailyAccumulationUpdateEnt>()
.select("IFNULL( SUM( photovoltaic_power ), 0 ) AS photovoltaic_power",
"IFNULL( SUM( daily_electricity_consumption ), 0 ) AS daily_electricity_consumption",
"IFNULL( SUM( daily_liquid_production ), 0 ) AS daily_liquid_production",
"IFNULL( SUM( in_place_consumption ), 0 ) AS in_place_consumption")
.lambda()
.between(ThirdDailyAccumulationUpdateEnt::getSaveDate, start, end)
.in(ThirdDailyAccumulationUpdateEnt::getStationName, plantList.stream()
.map(DynamicQueryBasePowerLinePlantViewOutput::getStationName)
.collect(Collectors.toList()))
);
accumulatePowerGeneration = analysisEnt.getPhotovoltaicPower();
dailyElectricityConsumption = analysisEnt.getDailyElectricityConsumption();
greenElectricityRate = this.getAbsorptionRate(analysisEnt.getInPlaceConsumption(), analysisEnt.getDailyElectricityConsumption());
economicBenefit = this.calculateEconomicBenefit(analysisEnt.getPhotovoltaicPower());
carbonReduction = this.calculateCarbonReduction(analysisEnt.getPhotovoltaicPower());
}
ISpaceOptimizeShortCloudService service = context.getBean(ISpaceOptimizeShortCloudService.class);
XSingleResult<GetMonthlyWellCountOutput> result = service.monthlyWellCount(context, GetMonthlyWellCountInput.builder()
.month(end.monthBaseOne())
.build());
result.throwIfFail();
Long wellNumber = result.getResult().getWellNumber();
return XSingleResult.success(GetMonthlyOverviewOutput.builder()
.accumulatePowerGeneration(accumulatePowerGeneration)
.dailyElectricityConsumption(dailyElectricityConsumption)
.greenElectricityRate(greenElectricityRate)
.wellNumber(wellNumber)
.economicBenefit(economicBenefit)
.carbonReduction(carbonReduction)
.build());
}
/**
* 本月累计节电经济效益/减碳量
*
......
package pps.core.prediction.service.data.energy_consumption_analysis;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import xstartup.annotation.XText;
import java.math.BigDecimal;
/**
* 月度总览
*
* @author ZWT
* @date 2024/05/27 14:03
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GetMonthlyOverviewOutput {
@XText("累计发电量(kWh)")
private BigDecimal accumulatePowerGeneration;
@XText("累计用电量(KW·h)")
private BigDecimal dailyElectricityConsumption;
@XText("绿电占比(%)")
private BigDecimal greenElectricityRate;
@XText("优化井数")
private Long wellNumber;
@XText("经济效益(元)")
private BigDecimal economicBenefit;
@XText("减碳量(吨)")
private BigDecimal carbonReduction;
}
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