Commit 1fcf5bcc authored by ZWT's avatar ZWT

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

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

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 752474b7
......@@ -8,6 +8,7 @@ import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.data.XListResult;
import xstartup.data.XPageResult;
import xstartup.data.XServiceResult;
/**
......@@ -40,12 +41,11 @@ public interface IDailyElectricityTrendCloudService {
XListResult<GetLineDailyElectricityTrendOutput> queryDailyElectricityTrend(XContext context, GetLineDailyElectricityTrendInput input);
/**
* 井口分析
* 井口分析分页
*
* @param context 上下文
* @param input 输入
* @return {@link XListResult }<{@link GetWellDailyElectricityTrendOutput }>
* @return {@link XPageResult }<{@link GetWellDailyElectricityTrendOutput }>
*/
@XText("日用电趋势计算Cloud模块--井口分析")
XListResult<GetWellDailyElectricityTrendOutput> queryWellheadAnalysis(XContext context, GetWellDailyElectricityTrendInput input);
XPageResult<GetWellDailyElectricityTrendOutput> queryWellheadAnalysisPage(XContext context, GetWellDailyElectricityTrendInput input);
}
......@@ -4,6 +4,7 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import xstartup.base.data.XPageInput;
import java.util.Date;
import java.util.List;
......@@ -18,7 +19,7 @@ import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GetWellDailyElectricityTrendInput {
public class GetWellDailyElectricityTrendInput extends XPageInput {
/**
* 开始时间
......@@ -29,4 +30,9 @@ public class GetWellDailyElectricityTrendInput {
* 井号列表
*/
private List<String> wellNumberList;
/**
* 井号
*/
private String wellNumber;
}
......@@ -40,10 +40,10 @@ public interface WellDailyElectricityTrendViewMapper {
int batchInsert(@Param(value = "list") List<WellDailyElectricityTrendView> list);
/**
* 井口分析
* 井口分析分页
*
* @param record 记录
* @return {@link List }<{@link WellDailyElectricityTrendView }>
*/
List<WellDailyElectricityTrendView> selectWellheadAnalysis(WellDailyElectricityTrendView record);
List<WellDailyElectricityTrendView> selectWellheadAnalysisPage(WellDailyElectricityTrendView record);
}
......@@ -7,6 +7,8 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod;
import pps.cloud.prediction.service.IThirdPowerCloudService;
import pps.cloud.prediction.service.data.third_active_power.GetThirdActivePowerInput;
import pps.cloud.prediction.service.data.third_active_power.GetThirdActivePowerOutput;
......@@ -33,6 +35,7 @@ import xstartup.annotation.XService;
import xstartup.base.XContext;
import xstartup.base.util.XCopyUtils;
import xstartup.data.XListResult;
import xstartup.data.XPageResult;
import xstartup.data.XServiceResult;
import xstartup.helper.XTransactionHelper;
......@@ -197,24 +200,27 @@ public class DailyElectricityTrendCloudServiceImpl implements IDailyElectricityT
}
/**
* 井口分析
* 井口分析分页
*
* @param context 上下文
* @param input 输入
* @return {@link XListResult }<{@link GetWellDailyElectricityTrendOutput }>
* @return {@link XPageResult }<{@link GetWellDailyElectricityTrendOutput }>
*/
@Override
public XListResult<GetWellDailyElectricityTrendOutput> queryWellheadAnalysis(XContext context, GetWellDailyElectricityTrendInput input) {
public XPageResult<GetWellDailyElectricityTrendOutput> queryWellheadAnalysisPage(XContext context, GetWellDailyElectricityTrendInput input) {
DateTime date = DateUtil.date(input.getCreateDate());
PageMethod.startPage(input.getPage(), input.getLimit());
WellDailyElectricityTrendViewMapper mapper = context.getBean(WellDailyElectricityTrendViewMapper.class);
List<WellDailyElectricityTrendView> list = mapper.selectWellheadAnalysis(
List<WellDailyElectricityTrendView> list = mapper.selectWellheadAnalysisPage(
WellDailyElectricityTrendView.builder()
.createDate(date)
.month(date.monthBaseOne())
.year(date.year())
.wellNumberList(input.getWellNumberList())
.wellNumber(input.getWellNumber())
.build()
);
PageInfo<WellDailyElectricityTrendView> pageInfo = new PageInfo<>(list);
List<GetWellDailyElectricityTrendOutput> output;
if (CollUtil.isNotEmpty(list)) {
output = new ArrayList<>(list.size());
......@@ -234,7 +240,7 @@ public class DailyElectricityTrendCloudServiceImpl implements IDailyElectricityT
} else {
output = Collections.emptyList();
}
return XListResult.success(output);
return XPageResult.success(output, input, pageInfo.getTotal());
}
/*------------------------------------- private -------------------------------------*/
......
......@@ -77,8 +77,12 @@
<result column="year_daily_green_consumption" property="yearDailyGreenConsumption" jdbcType="DECIMAL"/>
</resultMap>
<select id="selectWellheadAnalysis" parameterType="pps.core.space.entity.WellDailyElectricityTrendView"
<select id="selectWellheadAnalysisPage" parameterType="pps.core.space.entity.WellDailyElectricityTrendView"
resultMap="ExtResultMap">
SELECT
z.*
FROM
(
SELECT t.well_number,
t.space_run_duration,
t.daily_liquid_production,
......@@ -122,5 +126,13 @@
<foreach collection="wellNumberList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
) z
<where>
<if test="wellNumber != null and wellNumber != ''">
AND z.well_number LIKE concat('%',#{wellNumber},'%')
</if>
</where>
ORDER BY
z.well_number
</select>
</mapper>
\ No newline at end of file
......@@ -49,6 +49,7 @@ import xstartup.base.XContext;
import xstartup.base.exception.XServiceException;
import xstartup.base.util.XCopyUtils;
import xstartup.data.XListResult;
import xstartup.data.XPageData;
import xstartup.data.XPageResult;
import xstartup.data.XSingleResult;
import xstartup.feature.api.annotation.XApiGet;
......@@ -742,11 +743,11 @@ public class EnergyConsumptionAnalysisService {
*
* @param context 上下文
* @param input 输入
* @return {@link XListResult }<{@link GetWellheadAnalysisOutput }>
* @return {@link XPageResult }<{@link GetWellheadAnalysisOutput }>
*/
@XText("间开效果评价--井口分析")
@XApiGet
public XListResult<GetWellheadAnalysisOutput> wellheadAnalysis(XContext context, GetEnergyConsumptionAnalysisInput input) {
public XPageResult<GetWellheadAnalysisOutput> wellheadAnalysis(XContext context, GetWellheadAnalysisInput input) {
DynamicQueryBasePowerLineWellheadInput wellheadInput = new DynamicQueryBasePowerLineWellheadInput();
String stationName = input.getStationName();
if (CharSequenceUtil.isNotBlank(stationName)) {
......@@ -755,66 +756,27 @@ public class EnergyConsumptionAnalysisService {
List<String> orgIds = this.getOrgIdsByPath(context, input.getOuId());
wellheadInput.setOuIds(orgIds);
}
List<GetWellheadAnalysisOutput> outputs = Collections.emptyList();
BigDecimal spaceRunDuration = BigDecimal.ZERO;
BigDecimal dailyLiquidProduction = BigDecimal.ZERO;
BigDecimal greenElectricityRate = BigDecimal.ZERO;
BigDecimal dailyCarbonReduction = BigDecimal.ZERO;
BigDecimal monthGreenElectricityRate = BigDecimal.ZERO;
BigDecimal monthDailyCarbonReduction = BigDecimal.ZERO;
BigDecimal yearGreenElectricityRate = BigDecimal.ZERO;
BigDecimal yearDailyCarbonReduction = BigDecimal.ZERO;
List<DynamicQueryBasePowerLineWellheadViewOutput> wellheadList = this.getPowerLineWellheadList(context, wellheadInput);
if (CollUtil.isNotEmpty(wellheadList)) {
DateTime yesterday = DateUtil.beginOfDay(DateUtil.yesterday());
IDailyElectricityTrendCloudService service = context.getBean(IDailyElectricityTrendCloudService.class);
XListResult<GetWellDailyElectricityTrendOutput> result = service.queryWellheadAnalysis(context, GetWellDailyElectricityTrendInput.builder()
GetWellDailyElectricityTrendInput build = GetWellDailyElectricityTrendInput.builder()
.createDate(yesterday)
.wellNumberList(wellheadList.stream().map(DynamicQueryBasePowerLineWellheadViewOutput::getWellNumber)
.collect(Collectors.toList()))
.build());
.wellNumber(input.getWellNumber())
.build();
build.setPage(input.getPage());
build.setLimit(input.getLimit());
XPageResult<GetWellDailyElectricityTrendOutput> result = service.queryWellheadAnalysisPage(context, build);
result.throwIfFail();
List<GetWellDailyElectricityTrendOutput> list = result.getResult();
XPageData<GetWellDailyElectricityTrendOutput> pageInfo = result.getResult();
List<GetWellDailyElectricityTrendOutput> list = pageInfo.getItems();
if (CollUtil.isNotEmpty(list)) {
outputs = new ArrayList<>(list.size());
for (GetWellDailyElectricityTrendOutput output : list) {
outputs.add(GetWellheadAnalysisOutput.builder()
.wellNumber(output.getWellNumber())
.spaceRunDuration(output.getSpaceRunDuration())
.dailyLiquidProduction(output.getDailyLiquidProduction())
.greenElectricityRate(output.getGreenElectricityRate())
.dailyCarbonReduction(output.getDailyCarbonReduction())
.monthGreenElectricityRate(output.getMonthGreenElectricityRate())
.monthDailyCarbonReduction(output.getMonthDailyCarbonReduction())
.yearGreenElectricityRate(output.getYearGreenElectricityRate())
.yearDailyCarbonReduction(output.getYearDailyCarbonReduction())
.build());
spaceRunDuration = spaceRunDuration.add(output.getSpaceRunDuration());
dailyLiquidProduction = dailyLiquidProduction.add(output.getDailyLiquidProduction());
greenElectricityRate = greenElectricityRate.add(output.getGreenElectricityRate());
dailyCarbonReduction = dailyCarbonReduction.add(output.getDailyCarbonReduction());
monthGreenElectricityRate = monthGreenElectricityRate.add(output.getMonthGreenElectricityRate());
monthDailyCarbonReduction = monthDailyCarbonReduction.add(output.getMonthDailyCarbonReduction());
yearGreenElectricityRate = yearGreenElectricityRate.add(output.getYearGreenElectricityRate());
yearDailyCarbonReduction = yearDailyCarbonReduction.add(output.getYearDailyCarbonReduction());
}
BigDecimal avg = BigDecimal.valueOf(list.size());
monthGreenElectricityRate = monthGreenElectricityRate.divide(avg, 2, RoundingMode.HALF_UP);
yearGreenElectricityRate = yearGreenElectricityRate.divide(avg, 2, RoundingMode.HALF_UP);
return XPageResult.success(XCopyUtils.copyNewList(list, GetWellheadAnalysisOutput.class), input, pageInfo.getTotal());
}
}
outputs.add(GetWellheadAnalysisOutput.builder()
.wellNumber("合计")
.spaceRunDuration(spaceRunDuration)
.dailyLiquidProduction(dailyLiquidProduction)
.greenElectricityRate(greenElectricityRate)
.dailyCarbonReduction(dailyCarbonReduction)
.monthGreenElectricityRate(monthGreenElectricityRate)
.monthDailyCarbonReduction(monthDailyCarbonReduction)
.yearGreenElectricityRate(yearGreenElectricityRate)
.yearDailyCarbonReduction(yearDailyCarbonReduction)
.build());
return XListResult.success(outputs);
return XPageResult.success(Collections.emptyList(), input, 0);
}
/*------------------------------ 能耗分析(废弃) ------------------------------*/
......
package pps.core.prediction.service.data.energy_consumption_analysis;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import xstartup.annotation.XText;
import xstartup.base.data.XPageInput;
/**
* 能耗分析
*
* @author ZWT
* @date 2024/05/21
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GetWellheadAnalysisInput extends XPageInput {
/**
* 组织机构ID
*/
@NotBlank(message = "缺少组织机构ID")
@XText("组织机构ID")
private String ouId;
/**
* 电站名称
*/
@XText("电站名称")
private String stationName;
/**
* 井号
*/
@XText("井号")
private String wellNumber;
}
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