Commit 356beaeb authored by ZWT's avatar ZWT

feat(能源管理系统): 测试问题修复

1.修改间开制度管理-长期/中长期间开优化定时任务,解决未设置区间的井口不展示时间区间问题;
2.开发间开制度管理-校准周期模块,间开制度跟踪接口,完成接口冒烟测试,并生成接口文档;
3.修改间开制度管理-短期间开模块,短期间开制度详情接口,解决井口间开时间段展示异常问题;
4.开发间开制度管理-校准周期模块,井口生产情况分页列表接口,创建测试数据表,添加模拟数据,生成映射类,完成接口冒烟测试,并生成接口文档;
5.开发统计分析-能耗分析模块,发电列表接口;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent c2c76916
package pps.core.prediction.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import pps.cloud.base.service.IBasePowerLineCloudService;
import pps.cloud.base.service.data.base_power_line_plant.DynamicQueryBasePowerLinePlantInput;
import pps.cloud.base.service.data.base_power_line_plant.DynamicQueryBasePowerLinePlantOutput;
import pps.core.common.constant.BusinessConstant;
import pps.core.common.utils.BaseUtils;
import pps.core.prediction.entity.PlantPredictedPowerDataEnt;
import pps.core.prediction.entity.PlantPredictedPowerLongTermDataEnt;
import pps.core.prediction.mapper.PlantPredictedPowerDataMapper;
import pps.core.prediction.mapper.PlantPredictedPowerLongTermDataMapper;
import pps.core.prediction.service.data.energy_consumption_analysis.GetEnergyConsumptionAnalysisInput;
import pps.core.prediction.service.data.energy_consumption_analysis.GetEnergyConsumptionAnalysisOutput;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.base.util.XCopyUtils;
import xstartup.data.XListResult;
import xstartup.feature.api.annotation.XApiAnonymous;
import xstartup.feature.api.annotation.XApiGet;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* 能耗分析模块(测试用)
* todo: 模拟测试用,后续替换
*
* @author ZWT
* @date 2023/09/27 15:57
*/
@XText("能耗分析模块")
@XService
public class EnergyConsumptionAnalysisService {
/**
* 能耗分析--发电列表
*
* @param context 上下文
* @param input 输入
* @return {@link XListResult}<{@link GetEnergyConsumptionAnalysisOutput}>
*/
@XText("能耗分析--发电列表")
@XApiAnonymous
@XApiGet
public XListResult<GetEnergyConsumptionAnalysisOutput> queryEnergyConsumptionAnalysisList(XContext context, GetEnergyConsumptionAnalysisInput input) {
//通过线路ID查光伏电站
List<DynamicQueryBasePowerLinePlantOutput> plantListByLineIds = this.getPowerLinePlantListByLineIds(context, CollUtil.newArrayList(input.getLineId()));
List powerGenerationList = null;
List<String> plantIdList = null;
if (CollUtil.isNotEmpty(plantListByLineIds)) {
plantIdList = plantListByLineIds.stream()
.map(DynamicQueryBasePowerLinePlantOutput::getPlantId)
.collect(Collectors.toList());
//取当前时间
DateTime date = DateUtil.date();
PlantPredictedPowerDataMapper powerDataMapper;
switch (input.getDateType()) {
//负荷率=实际发电量/理论最大发电量x100%
case 0:
powerDataMapper = context.getBean(PlantPredictedPowerDataMapper.class);
powerGenerationList = powerDataMapper.selectList(new QueryWrapper<PlantPredictedPowerDataEnt>()
.select("hour_time",
"SUM( power ) AS power")
.lambda()
.eq(PlantPredictedPowerDataEnt::getYearTime, String.valueOf(date.year()))
.eq(PlantPredictedPowerDataEnt::getMonthTime, BaseUtils.getMonthString(date.month() + 1))
.eq(PlantPredictedPowerDataEnt::getDayTime, String.valueOf(date.dayOfMonth()))
.in(PlantPredictedPowerDataEnt::getPlantId, plantIdList)
.groupBy(PlantPredictedPowerDataEnt::getHourTime)
.orderByAsc(PlantPredictedPowerDataEnt::getHourTime)
);
break;
case 1:
powerDataMapper = context.getBean(PlantPredictedPowerDataMapper.class);
powerGenerationList = powerDataMapper.selectList(new QueryWrapper<PlantPredictedPowerDataEnt>()
.select("hour_time",
"SUM( power ) AS power")
.lambda()
.in(PlantPredictedPowerDataEnt::getPlantId, plantIdList)
.between(PlantPredictedPowerDataEnt::getDataDate,
date.toString(BusinessConstant.DATE_FORMAT_DAY),
DateUtil.offsetDay(date, 7).toString(BusinessConstant.DATE_FORMAT_DAY))
.groupBy(PlantPredictedPowerDataEnt::getHourTime)
.orderByAsc(PlantPredictedPowerDataEnt::getHourTime)
);
break;
case 2:
PlantPredictedPowerLongTermDataMapper longTermDataMapper = context.getBean(PlantPredictedPowerLongTermDataMapper.class);
powerGenerationList = longTermDataMapper.selectList(new QueryWrapper<PlantPredictedPowerLongTermDataEnt>()
.select("hour_time",
"SUM( power ) AS power")
.lambda()
.in(PlantPredictedPowerLongTermDataEnt::getPlantId, plantIdList)
.between(PlantPredictedPowerLongTermDataEnt::getDataDate,
date.toString(BusinessConstant.DATE_FORMAT_DAY),
DateUtil.offsetDay(date, 30).toString(BusinessConstant.DATE_FORMAT_DAY))
.groupBy(PlantPredictedPowerLongTermDataEnt::getHourTime)
.orderByAsc(PlantPredictedPowerLongTermDataEnt::getHourTime)
);
break;
default:
}
}
List<GetEnergyConsumptionAnalysisOutput> outputList = new ArrayList<>(0);
if (CollUtil.isNotEmpty(powerGenerationList)) {
XCopyUtils.copyList(powerGenerationList, outputList, GetEnergyConsumptionAnalysisOutput.class);
//有发电量说明有电站ID,查电站详情
}
return XListResult.success(outputList);
}
/*-----------------------------------private-----------------------------------*/
/**
* 按线路ID集合获取电站列表
*
* @param context 上下文
* @param lineIds 线路ID
* @return {@link List}<{@link DynamicQueryBasePowerLinePlantOutput}>
*/
private List<DynamicQueryBasePowerLinePlantOutput> getPowerLinePlantListByLineIds(XContext context, List<String> lineIds) {
IBasePowerLineCloudService cloudService = context.getBean(IBasePowerLineCloudService.class);
XListResult<DynamicQueryBasePowerLinePlantOutput> result = cloudService.queryPowerLinePlantListByParam(context,
DynamicQueryBasePowerLinePlantInput.builder()
.lineIds(lineIds)
.build()
);
result.throwIfFail();
return result.getResult();
}
}
......@@ -18,6 +18,7 @@ import java.util.List;
/**
* 储能预测电量数据Cloud模块(模拟数据测试用)
* todo: 模拟测试用,后续替换
*
* @author ZWT
* @date 2023/09/20 15:44
......
......@@ -19,6 +19,7 @@ import java.util.List;
/**
* 井口生产情况模块(测试用)
* todo: 模拟测试用,后续替换
*
* @author ZWT
* @date 2023/09/27
......
package pps.core.prediction.service.data.energy_consumption_analysis;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import xstartup.annotation.XText;
/**
* 储能预测电量数据(模拟数据测试用)
*
* @author ZWT
* @date 2023/09/20
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class GetEnergyConsumptionAnalysisInput {
@NotBlank(message = "缺少线路ID")
@XText("线路ID")
private String lineId;
@NotNull(message = "缺少日期类型")
@XText("日期类型(0_今日,1_近7天,2_近30天)")
private Integer dateType;
}
package pps.core.prediction.service.data.energy_consumption_analysis;
import lombok.Data;
import xstartup.annotation.XText;
import java.math.BigDecimal;
/**
* 储能预测电量数据(模拟数据测试用)
*
* @author ZWT
* @date 2023/09/20
*/
@Data
public class GetEnergyConsumptionAnalysisOutput {
@XText("时")
private String hourTime;
@XText("光伏出力")
private BigDecimal power;
@XText("生产负荷")
private BigDecimal productionLoad;
}
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