Commit 5db0d481 authored by ZWT's avatar ZWT

feat(零碳): 长庆

1.长庆演示首页功能开发,新增采油厂统计信息查询接口,添加线上接口并完成接口冒烟测试;
2.长庆演示首页功能开发,新增线路图查询接口,添加线上接口并完成接口冒烟测试;
3.长庆演示首页功能开发,新增线路详情查询接口,添加线上接口并完成接口冒烟测试;
4.对接第三方接口,完成获取井场日累计数据接口调用,创建数据表,同时生成对应代码,开发定时任务及对外接口,完成第三方数据接入及系统展示功能,添加线上接口文档并完成接口及定时任务冒烟测试;
5.对接第三方接口,完成获取第三方单井平均有功功率接口调用,创建数据表,同时生成对应代码,开发定时任务及对外接口,完成第三方数据接入及系统展示功能,添加线上接口文档并完成接口及定时任务冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent f9958efb
......@@ -119,4 +119,14 @@ public interface IBasePowerLineCloudService {
*/
@XText("输电线路配置Cloud模块--查询线路井口运行总功率")
XSingleResult<GetBasePowerLineWellheadViewOutput> queryLineSumServiceRatingByLineId(XContext context, DynamicQueryBasePowerLineWellheadInput input);
}
/**
* 输电线路配置Cloud模块--通过电站ID查井口
*
* @param context 上下文
* @param input 输入
* @return {@link XListResult}<{@link DynamicQueryBasePowerLineWellheadViewOutput}>
*/
@XText("输电线路配置Cloud模块--条件查询线路关联井口信息")
XListResult<DynamicQueryBasePowerLineWellheadViewOutput> getPowerLineWellheadListByPlant(XContext context, DynamicQueryBasePowerLineWellheadInput input);
}
\ No newline at end of file
......@@ -28,4 +28,7 @@ public class DynamicQueryBasePowerLineWellheadInput {
@XText("井口ID集合")
private List<String> wellheadIds;
@XText("电站ID集合")
private List<String> plantIds;
}
......@@ -88,4 +88,11 @@ public class BasePowerLineWellheadView extends BaseModel implements Serializable
@XText("线路ID集合")
@TableField(exist = false)
private List<String> lineIds;
/**
* 电站id
*/
@XText("电站ID集合")
@TableField(exist = false)
private List<String> plantIds;
}
......@@ -39,4 +39,12 @@ public interface BasePowerLineWellheadViewMapper {
* @return int
*/
int batchInsertList(@Param(value = "list") List<BasePowerLineWellheadView> list);
/**
* 通过电站ID查井口
*
* @param record 记录
* @return {@link List}<{@link BasePowerLineWellheadView}>
*/
List<BasePowerLineWellheadView> selectWellheadListByPlant(BasePowerLineWellheadView record);
}
......@@ -35,11 +35,13 @@ public class BasePhotovoltaicPlantCloudServiceImpl implements BasePhotovoltaicPl
*/
@Override
public XListResult<GetBasePhotovoltaicPlantCloudOutput> getBasePhotovoltaicPlantList(XContext context, GetBasePhotovoltaicPlantCloudInput input) {
String id = input.getId();
String ouId = input.getOuId();
List<String> plantIds = input.getPlantIds();
BasePhotovoltaicPlantMapper mapper = context.getBean(BasePhotovoltaicPlantMapper.class);
List<BasePhotovoltaicPlantEnt> list = mapper.selectList(new LambdaQueryWrapper<BasePhotovoltaicPlantEnt>()
.eq(BaseModel::getIsDeleted, BusinessConstant.ONE)
.eq(CharSequenceUtil.isNotBlank(id), BasePhotovoltaicPlantEnt::getId, id)
.eq(CharSequenceUtil.isNotBlank(ouId), BasePhotovoltaicPlantEnt::getOuId, ouId)
.in(CollUtil.isNotEmpty(plantIds), BaseModel::getId, plantIds)
);
......
......@@ -242,4 +242,22 @@ public class BasePowerLineCloudServiceImpl implements IBasePowerLineCloudService
.orElse(BigDecimal.ZERO))
.build());
}
/**
* 通过电站ID查井口
*
* @param context 上下文
* @param input 输入
* @return {@link XListResult}<{@link DynamicQueryBasePowerLineWellheadViewOutput}>
*/
@Override
public XListResult<DynamicQueryBasePowerLineWellheadViewOutput> getPowerLineWellheadListByPlant(XContext context, DynamicQueryBasePowerLineWellheadInput input) {
BasePowerLineWellheadViewMapper wellheadViewMapper = context.getBean(BasePowerLineWellheadViewMapper.class);
List<BasePowerLineWellheadView> wellheadViews = wellheadViewMapper.selectWellheadListByPlant(
BasePowerLineWellheadView.builder()
.plantIds(input.getPlantIds())
.build()
);
return XListResult.success(XCopyUtils.copyNewList(wellheadViews, DynamicQueryBasePowerLineWellheadViewOutput.class));
}
}
\ No newline at end of file
......@@ -115,4 +115,20 @@
)
</foreach>
</insert>
<select id="selectWellheadListByPlant" parameterType="pps.core.base.entity.BasePowerLineWellheadView"
resultMap="ExtendsResultMap">
SELECT b.well_number
FROM base_power_line_plant p
JOIN base_power_line_wellhead w ON p.line_id = w.line_id
JOIN base_wellhead b ON w.wellhead_id = b.id
WHERE p.is_deleted = 1
AND w.is_deleted = 1
AND b.is_deleted = 1
AND p.plant_id IN
<foreach collection="plantIds" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
......@@ -10,6 +10,7 @@ import xstartup.annotation.XText;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 第三方单井平均有功功率
......@@ -45,4 +46,12 @@ public class ThirdWellAvgActivePowerView implements Serializable {
@XText("入库日期")
@TableField
private Date saveDate;
@XText("小时")
@TableField(exist = false)
private Integer hourNumber;
@XText("井号列表")
@TableField(exist = false)
private List<String> wellNumbers;
}
......@@ -18,7 +18,6 @@ public interface ThirdWellAvgActivePowerViewMapper {
List<ThirdWellAvgActivePowerView> selectList(ThirdWellAvgActivePowerView record);
/**
* 批量插入
*
......@@ -26,4 +25,12 @@ public interface ThirdWellAvgActivePowerViewMapper {
* @return int
*/
int batchInsertList(@Param(value = "list") List<ThirdWellAvgActivePowerView> dtoList);
/**
* 井场负荷
*
* @param record 记录
* @return {@link List}<{@link ThirdWellAvgActivePowerView}>
*/
List<ThirdWellAvgActivePowerView> selectMeterPower(ThirdWellAvgActivePowerView record);
}
......@@ -90,7 +90,7 @@ public class HomePageService {
});
} else {
//查电站
List<GetBasePhotovoltaicPlantCloudOutput> plantList = this.getPlantList(context, stationId);
List<GetBasePhotovoltaicPlantCloudOutput> plantList = this.getPlantList(context, stationId, null);
outputs = new ArrayList<>(plantList.size());
plantList.forEach(item -> {
GetStationViewOutput output = new GetStationViewOutput();
......@@ -119,7 +119,7 @@ public class HomePageService {
public XSingleResult<GetOverviewViewOutput> getOverview(XContext context, GetStationViewInput input) {
String stationId = input.getStationId();
List<DynamicQueryBaseWellheadOutput> wellList = this.getWellList(context, stationId);
List<GetBasePhotovoltaicPlantCloudOutput> plantList = this.getPlantList(context, stationId);
List<GetBasePhotovoltaicPlantCloudOutput> plantList = this.getPlantList(context, stationId, null);
List<DynamicQueryBasePowerLineOutput> lineList = this.getLineList(context, stationId, "10");
List<DynamicQueryBaseEnergyStorageDeviceOutput> storageList = this.getStorageList(context, stationId);
return XSingleResult.success(GetOverviewViewOutput.builder()
......@@ -180,7 +180,7 @@ public class HomePageService {
new HashMap<>(0));
List<GetCumulativePowerGenerationOutput> stationList = JSON.parseArray(stationResult, GetCumulativePowerGenerationOutput.class);
if (CollUtil.isNotEmpty(stationList)) {
Set<String> set = this.getPlantList(context, stationId).stream()
Set<String> set = this.getPlantList(context, stationId, null).stream()
.map(GetBasePhotovoltaicPlantCloudOutput::getStationName)
.collect(Collectors.toSet());
for (GetCumulativePowerGenerationOutput station : stationList) {
......@@ -232,7 +232,7 @@ public class HomePageService {
).stream()
.collect(Collectors.toMap(ThirdWellAvgActivePowerEnt::getInputTime, ThirdWellAvgActivePowerEnt::getAvgActivePower));
//查组织下所有电站
List<GetBasePhotovoltaicPlantCloudOutput> plantList = this.getPlantList(context, stationId);
List<GetBasePhotovoltaicPlantCloudOutput> plantList = this.getPlantList(context, stationId, null);
//发电功率
ThirdActivePowerMapper dailyUpdateMapper = context.getBean(ThirdActivePowerMapper.class);
Map<Date, BigDecimal> powerMap = dailyUpdateMapper.selectList(new QueryWrapper<ThirdActivePowerEnt>()
......@@ -347,13 +347,14 @@ public class HomePageService {
List<String> plantIds = null;
if (CharSequenceUtil.isNotBlank(plantId)) {
input.setStationId(null);
plantList = this.getPlantList(context, null, plantId);
} else {
plantList = this.getPlantList(context, input.getStationId());
plantIds = plantList.stream().map(GetBasePhotovoltaicPlantCloudOutput::getId).collect(Collectors.toList());
if (CollUtil.isEmpty(plantIds)) {
plantIds = null;
}
List<DynamicQueryBaseWellheadOutput> wellList = this.getWellList(context, input.getStationId());
plantList = this.getPlantList(context, input.getStationId(), null);
}
plantIds = plantList.stream()
.map(GetBasePhotovoltaicPlantCloudOutput::getId)
.collect(Collectors.toList());
DateTime day = DateUtil.beginOfDay(DateUtil.date());
//预测发电量
PredictedPowerViewMapper mapper = context.getBean(PredictedPowerViewMapper.class);
......@@ -363,7 +364,7 @@ public class HomePageService {
.plantId(plantId)
.build()).stream()
.collect(Collectors.toMap(PredictedPowerView::getHourTime, PredictedPowerView::getPower));
//实时数据
//实际功率
ThirdActivePowerDailyUpdateViewMapper nowMapper = context.getBean(ThirdActivePowerDailyUpdateViewMapper.class);
Map<Integer, ThirdActivePowerDailyUpdateView> powerMap = nowMapper.selectEnergyUseCurve(ThirdActivePowerDailyUpdateView.builder()
.stationIds(plantIds)
......@@ -371,6 +372,23 @@ public class HomePageService {
.saveDate(day)
.build()).stream()
.collect(Collectors.toMap(ThirdActivePowerDailyUpdateView::getHourNumber, Function.identity()));
//井场负荷
Map<Integer, BigDecimal> avgMap;
List<DynamicQueryBasePowerLineWellheadViewOutput> wellheadListByPlant = this.getPowerLineWellheadListByPlant(context, plantIds);
if (CollUtil.isNotEmpty(wellheadListByPlant)) {
List<String> collect = wellheadListByPlant.stream()
.map(DynamicQueryBasePowerLineWellheadViewOutput::getWellNumber)
.collect(Collectors.toList());
ThirdWellAvgActivePowerViewMapper averageMapper = context.getBean(ThirdWellAvgActivePowerViewMapper.class);
avgMap = averageMapper.selectMeterPower(ThirdWellAvgActivePowerView.builder()
.wellNumbers(collect)
.inputTime(day)
.build()).stream()
.collect(Collectors.toMap(ThirdWellAvgActivePowerView::getHourNumber, ThirdWellAvgActivePowerView::getAvgActivePower));
} else {
avgMap = new HashMap<>(0);
}
//封装结果
List<GetPowerPredictionOutput> outputs = new ArrayList<>(24);
ThirdActivePowerDailyUpdateView powerDaily;
for (int i = 0; i < 24; i++) {
......@@ -384,7 +402,9 @@ public class HomePageService {
if (powerMap.containsKey(i)) {
powerDaily = powerMap.get(i);
actualPower = powerDaily.getPhotovoltaicPower();
meterPower = powerDaily.getMeterPower();
}
if (avgMap.containsKey(i)) {
meterPower = avgMap.get(i);
}
outputs.add(
GetPowerPredictionOutput.builder()
......@@ -481,7 +501,7 @@ public class HomePageService {
//线路统计
List<DynamicQueryBasePowerLineOutput> lineList = this.getLineList(context, stationId, "10");
//光伏电站
List<GetBasePhotovoltaicPlantCloudOutput> plantList = this.getPlantList(context, stationId);
List<GetBasePhotovoltaicPlantCloudOutput> plantList = this.getPlantList(context, stationId, null);
//储能电站
List<DynamicQueryBaseEnergyStorageDeviceOutput> storageList = this.getStorageList(context, stationId);
return XSingleResult.success(GetOilExtractionPlantOutput.builder()
......@@ -564,6 +584,22 @@ public class HomePageService {
/*------------------------------------------------- private ---------------------------------------------------------*/
/**
* 通过电站ID查井口
*
* @param context 上下文
* @param plantIds 植物id
* @return {@link List}<{@link DynamicQueryBasePowerLineWellheadViewOutput}>
*/
private List<DynamicQueryBasePowerLineWellheadViewOutput> getPowerLineWellheadListByPlant(XContext context, List<String> plantIds) {
IBasePowerLineCloudService service = context.getBean(IBasePowerLineCloudService.class);
XListResult<DynamicQueryBasePowerLineWellheadViewOutput> result = service.getPowerLineWellheadListByPlant(context, DynamicQueryBasePowerLineWellheadInput.builder()
.plantIds(plantIds)
.build());
result.throwIfFail();
return result.getResult();
}
/**
* 获取区域路径
*
......@@ -684,12 +720,14 @@ public class HomePageService {
*
* @param context 上下文
* @param stationId 工作站id
* @param plantId 电站id
* @return {@link List}<{@link GetBasePhotovoltaicPlantCloudOutput}>
*/
private List<GetBasePhotovoltaicPlantCloudOutput> getPlantList(XContext context, String stationId) {
private List<GetBasePhotovoltaicPlantCloudOutput> getPlantList(XContext context, String stationId, String plantId) {
BasePhotovoltaicPlantCloudService service = context.getBean(BasePhotovoltaicPlantCloudService.class);
XListResult<GetBasePhotovoltaicPlantCloudOutput> result = service.getBasePhotovoltaicPlantList(context, GetBasePhotovoltaicPlantCloudInput.builder()
.ouId(stationId)
.id(plantId)
.build());
result.throwIfFail();
return result.getResult();
......
......@@ -49,4 +49,34 @@
)
</foreach>
</insert>
<resultMap id="ExtBaseResultMap" type="pps.core.prediction.entity.ThirdWellAvgActivePowerView"
extends="BaseResultMap">
<result column="hour_number" property="hourNumber" jdbcType="INTEGER"/>
</resultMap>
<select id="selectMeterPower" parameterType="pps.core.prediction.entity.ThirdWellAvgActivePowerView"
resultMap="BaseResultMap">
SELECT
hour_str AS hour_number,
IFNULL( AVG( avg_active_power ), 0 ) AS avg_active_power
FROM
( SELECT well_number, HOUR ( input_time ) AS hour_str, avg_active_power FROM third_well_avg_active_power
<where>
<if test="inputTime != null">
AND DATE ( input_time ) = #{inputTime}
</if>
<if test="wellNumbers != null">
AND well_number IN
<foreach collection="wellNumbers" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
) z
GROUP BY
hour_str
ORDER BY
hour_str
</select>
</mapper>
\ No newline at end of file
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