Commit 02fb2087 authored by ZWT's avatar ZWT

feat(能源管理系统): 间开优化定时任务

1.开发间开优化长期间开优化定时任务,了解长期并网型流程算法;
2.定时任务模块新增CRON常量类,定义常用表达式;
3.基础信息管理--井口配置Cloud模块,添加通过井口ID集合获取井口列表接口,完成接口冒烟测试;
4.基础信息管理--输电线路配置Cloud模块,添加通过线路ID集合获取线路配置光伏电站列表接口,完成接口冒烟测试;
5.光伏预测--光伏预测Cloud模块,添加条件查询获取光伏预测时间段平均值列表接口,完成接口冒烟测试;
6.修改prediction模块pom引用,添加接口;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent e3fe710d
...@@ -129,7 +129,7 @@ public class BasePowerLineCloudServiceImpl implements IBasePowerLineCloudService ...@@ -129,7 +129,7 @@ public class BasePowerLineCloudServiceImpl implements IBasePowerLineCloudService
BasePowerLinePlantMapper mapper = context.getBean(BasePowerLinePlantMapper.class); BasePowerLinePlantMapper mapper = context.getBean(BasePowerLinePlantMapper.class);
List<BasePowerLinePlantEnt> list = mapper.selectList( List<BasePowerLinePlantEnt> list = mapper.selectList(
new LambdaQueryWrapper<BasePowerLinePlantEnt>() new LambdaQueryWrapper<BasePowerLinePlantEnt>()
.eq(BaseModel::getIsDeleted, BusinessConstant.ZERO) .eq(BaseModel::getIsDeleted, BusinessConstant.ONE)
.eq(StringUtils.isNotBlank(plantId), BasePowerLinePlantEnt::getPlantId, plantId) .eq(StringUtils.isNotBlank(plantId), BasePowerLinePlantEnt::getPlantId, plantId)
.in(CollUtil.isNotEmpty(lineIds), BasePowerLinePlantEnt::getLineId, lineIds) .in(CollUtil.isNotEmpty(lineIds), BasePowerLinePlantEnt::getLineId, lineIds)
); );
......
...@@ -6,7 +6,6 @@ import xstartup.annotation.XText; ...@@ -6,7 +6,6 @@ import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.data.XServiceResult; import xstartup.data.XServiceResult;
import xstartup.service.job.XJob; import xstartup.service.job.XJob;
import xstartup.service.job.annotation.XCronTrigger;
/** /**
* 长期间开优化定时任务 * 长期间开优化定时任务
...@@ -24,7 +23,7 @@ public class SpaceOptimizeLongJob implements XJob { ...@@ -24,7 +23,7 @@ public class SpaceOptimizeLongJob implements XJob {
* @param xContext x上下文 * @param xContext x上下文
* @return {@link XServiceResult} * @return {@link XServiceResult}
*/ */
@XCronTrigger(value = XCronTrigger.PRE_10S) // @XCronTrigger(value = XCronTrigger.PRE_10S)
// @XCronTrigger(value = CronConstant.FIRST_DAY_OF_THE_MONTH) // @XCronTrigger(value = CronConstant.FIRST_DAY_OF_THE_MONTH)
@Override @Override
public XServiceResult execute(XContext xContext) { public XServiceResult execute(XContext xContext) {
......
...@@ -9,6 +9,9 @@ import pps.cloud.base.service.data.base_power_line_plant.DynamicQueryBasePowerLi ...@@ -9,6 +9,9 @@ import pps.cloud.base.service.data.base_power_line_plant.DynamicQueryBasePowerLi
import pps.cloud.base.service.data.base_power_line_plant.DynamicQueryBasePowerLinePlantOutput; import pps.cloud.base.service.data.base_power_line_plant.DynamicQueryBasePowerLinePlantOutput;
import pps.cloud.base.service.data.base_wellhead.DynamicQueryBaseWellheadInput; import pps.cloud.base.service.data.base_wellhead.DynamicQueryBaseWellheadInput;
import pps.cloud.base.service.data.base_wellhead.DynamicQueryBaseWellheadOutput; import pps.cloud.base.service.data.base_wellhead.DynamicQueryBaseWellheadOutput;
import pps.cloud.prediction.service.IPlantPredictedPowerCloudService;
import pps.cloud.prediction.service.data.plant_predicted_power_data.DynamicQueryPlantPredictedPowerInput;
import pps.cloud.prediction.service.data.plant_predicted_power_data.DynamicQueryPlantPredictedPowerOutput;
import pps.cloud.space.service.ISpaceOptimizeLongCloudService; import pps.cloud.space.service.ISpaceOptimizeLongCloudService;
import pps.core.common.constant.BusinessConstant; import pps.core.common.constant.BusinessConstant;
import pps.core.common.entity.BaseModel; import pps.core.common.entity.BaseModel;
...@@ -82,8 +85,18 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou ...@@ -82,8 +85,18 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
//并网型优化 //并网型优化
case "1": case "1":
//获取当前制度对应的光伏预测数据列表 //获取当前制度对应的光伏预测数据列表
List<DynamicQueryPlantPredictedPowerOutput> avgPowerList = this.getAveragePowerGenerationListByPlantIds(context,
DynamicQueryPlantPredictedPowerInput.builder()
.plantIds(
plantList.stream()
.filter(p -> StringUtils.equals(detail.getLineId(), p.getLineId()))
.map(DynamicQueryBasePowerLinePlantOutput::getPlantId)
.collect(Collectors.toList())
)
.yearTime("2023")
.monthTime("09")
.build()
);
//取当前制度下井口的总功率 //取当前制度下井口的总功率
BigDecimal wellheadTotalPower = spaceWellheadList.stream() BigDecimal wellheadTotalPower = spaceWellheadList.stream()
.filter(w -> StringUtils.equals(detail.getId(), w.getInstitutionId())) .filter(w -> StringUtils.equals(detail.getId(), w.getInstitutionId()))
...@@ -103,6 +116,20 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou ...@@ -103,6 +116,20 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
/*-----------------------------------private-----------------------------------*/ /*-----------------------------------private-----------------------------------*/
/**
* 条件获取获取光伏预测各时段平均值列表
*
* @param context 上下文
* @param input 输入
* @return {@link List}<{@link DynamicQueryPlantPredictedPowerOutput}>
*/
private List<DynamicQueryPlantPredictedPowerOutput> getAveragePowerGenerationListByPlantIds(XContext context, DynamicQueryPlantPredictedPowerInput input) {
IPlantPredictedPowerCloudService cloudService = context.getBean(IPlantPredictedPowerCloudService.class);
XListResult<DynamicQueryPlantPredictedPowerOutput> result = cloudService.queryAveragePowerGenerationListByParam(context, input);
result.throwIfFail();
return result.getResult();
}
/** /**
* 按线路ID集合获取电站列表 * 按线路ID集合获取电站列表
* *
......
...@@ -27,5 +27,5 @@ public interface IPlantPredictedPowerCloudService { ...@@ -27,5 +27,5 @@ public interface IPlantPredictedPowerCloudService {
*/ */
@XText("光伏预测Cloud模块--条件查询时段发电量平均值") @XText("光伏预测Cloud模块--条件查询时段发电量平均值")
@XApiPost @XApiPost
XListResult<DynamicQueryPlantPredictedPowerOutput> queryAveragePowerGenerationByParam(XContext context, DynamicQueryPlantPredictedPowerInput input); XListResult<DynamicQueryPlantPredictedPowerOutput> queryAveragePowerGenerationListByParam(XContext context, DynamicQueryPlantPredictedPowerInput input);
} }
\ No newline at end of file
package pps.cloud.prediction.service.data.plant_predicted_power_data; package pps.cloud.prediction.service.data.plant_predicted_power_data;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import java.util.List; import java.util.List;
...@@ -12,6 +15,9 @@ import java.util.List; ...@@ -12,6 +15,9 @@ import java.util.List;
* @date 2023/09/13 * @date 2023/09/13
*/ */
@Data @Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class DynamicQueryPlantPredictedPowerInput { public class DynamicQueryPlantPredictedPowerInput {
@XText("电站ID") @XText("电站ID")
...@@ -20,6 +26,9 @@ public class DynamicQueryPlantPredictedPowerInput { ...@@ -20,6 +26,9 @@ public class DynamicQueryPlantPredictedPowerInput {
@XText("电站ID集合") @XText("电站ID集合")
private List<String> plantIds; private List<String> plantIds;
@XText("年")
private String yearTime;
@XText("月") @XText("月")
private String monthTime; private String monthTime;
} }
...@@ -8,6 +8,7 @@ import pps.cloud.prediction.service.data.plant_predicted_power_data.DynamicQuery ...@@ -8,6 +8,7 @@ import pps.cloud.prediction.service.data.plant_predicted_power_data.DynamicQuery
import pps.cloud.prediction.service.data.plant_predicted_power_data.DynamicQueryPlantPredictedPowerOutput; import pps.cloud.prediction.service.data.plant_predicted_power_data.DynamicQueryPlantPredictedPowerOutput;
import pps.core.prediction.entity.PlantPredictedPowerDataEnt; import pps.core.prediction.entity.PlantPredictedPowerDataEnt;
import pps.core.prediction.mapper.PlantPredictedPowerDataMapper; import pps.core.prediction.mapper.PlantPredictedPowerDataMapper;
import xstartup.annotation.XService;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.base.util.XCopyUtils; import xstartup.base.util.XCopyUtils;
import xstartup.data.XListResult; import xstartup.data.XListResult;
...@@ -21,6 +22,7 @@ import java.util.List; ...@@ -21,6 +22,7 @@ import java.util.List;
* @author ZWT * @author ZWT
* @date 2023/09/13 19:05 * @date 2023/09/13 19:05
*/ */
@XService
public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPowerCloudService { public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPowerCloudService {
/** /**
...@@ -31,9 +33,10 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower ...@@ -31,9 +33,10 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower
* @return {@link XListResult}<{@link DynamicQueryPlantPredictedPowerOutput}> * @return {@link XListResult}<{@link DynamicQueryPlantPredictedPowerOutput}>
*/ */
@Override @Override
public XListResult<DynamicQueryPlantPredictedPowerOutput> queryAveragePowerGenerationByParam(XContext context, DynamicQueryPlantPredictedPowerInput input) { public XListResult<DynamicQueryPlantPredictedPowerOutput> queryAveragePowerGenerationListByParam(XContext context, DynamicQueryPlantPredictedPowerInput input) {
String plantId = input.getPlantId(); String plantId = input.getPlantId();
List<String> plantIds = input.getPlantIds(); List<String> plantIds = input.getPlantIds();
String yearTime = input.getYearTime();
String monthTime = input.getMonthTime(); String monthTime = input.getMonthTime();
PlantPredictedPowerDataMapper mapper = context.getBean(PlantPredictedPowerDataMapper.class); PlantPredictedPowerDataMapper mapper = context.getBean(PlantPredictedPowerDataMapper.class);
List<PlantPredictedPowerDataEnt> list = mapper.selectList( List<PlantPredictedPowerDataEnt> list = mapper.selectList(
...@@ -48,6 +51,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower ...@@ -48,6 +51,7 @@ public class PlantPredictedPowerCloudServiceImpl implements IPlantPredictedPower
.lambda() .lambda()
.eq(StringUtils.isNotBlank(plantId), PlantPredictedPowerDataEnt::getPlantId, plantId) .eq(StringUtils.isNotBlank(plantId), PlantPredictedPowerDataEnt::getPlantId, plantId)
.in(CollUtil.isNotEmpty(plantIds), PlantPredictedPowerDataEnt::getPlantId, plantIds) .in(CollUtil.isNotEmpty(plantIds), PlantPredictedPowerDataEnt::getPlantId, plantIds)
.eq(StringUtils.isNotBlank(yearTime), PlantPredictedPowerDataEnt::getYearTime, yearTime)
.eq(StringUtils.isNotBlank(monthTime), PlantPredictedPowerDataEnt::getMonthTime, monthTime) .eq(StringUtils.isNotBlank(monthTime), PlantPredictedPowerDataEnt::getMonthTime, monthTime)
.groupBy(PlantPredictedPowerDataEnt::getDataDate, .groupBy(PlantPredictedPowerDataEnt::getDataDate,
PlantPredictedPowerDataEnt::getYearTime, PlantPredictedPowerDataEnt::getYearTime,
......
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