Commit 1749b9bf authored by ZWT's avatar ZWT

feat(吉林演示): 松原

1.修改天气数据抽取定时任务,解决部分历史数据丢失问题;
2.修改第三方风机电站真实数据定时任务,修改代码逻辑,解决时间未按照15分钟间隔推送问题;
3.修改第三方风机电站模拟数据定时任务,解决时间日期格式错误导致数据重复问题;
4.新建第三方风力发电数据(每日最新数据)表,同时生成对应代码,修改第三方风机电站模拟数据定时任务,增加每日最新数据更新逻辑;
5.修改风资源监控页面场站发电量统计接口,增加模拟数据查询逻辑,修改代码完成冒烟测试;
6.修改风资源监控页面历史风速接口,增加模拟数据查询逻辑,修改代码完成冒烟测试;
7.修改风资源监控页面历史风向接口,增加模拟数据查询逻辑,修改代码完成冒烟测试;
8.修改模拟数据历史表和每日最新数据表,增加发电量字段,同时修改对应代码增加字段并修改模拟数据生成定时任务,增加生成发电量逻辑并添加插入历史表和最新数据表逻辑;
9.修改风资源监控页面风电站运行状态接口,增加模拟数据查询逻辑,修改代码完成冒烟测试;
10.修改风资源监控页面发电功率列表接口,增加模拟数据查询逻辑,修改代码完成冒烟测试;
11.修改风资源监控页面风机运行情况接口,增加模拟数据查询逻辑,修改代码完成冒烟测试;
12.修改风资源监控页面发电趋势列表接口,增加模拟数据查询逻辑,修改代码完成冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 82ab448e
...@@ -20,6 +20,18 @@ public interface ThirdWindPowerGenerationUpdateViewMapper { ...@@ -20,6 +20,18 @@ public interface ThirdWindPowerGenerationUpdateViewMapper {
List<ThirdWindPowerGenerationUpdateView> selectList(ThirdWindPowerGenerationUpdateView record); List<ThirdWindPowerGenerationUpdateView> selectList(ThirdWindPowerGenerationUpdateView record);
/**
* 电站月平均发电量
*
* @param list 列表
* @param beginOfYear 年初
* @param endOfYear 年终
* @return {@link List }<{@link ThirdWindPowerGenerationUpdateView }>
*/
List<ThirdWindPowerGenerationUpdateView> stationMonthAvgPowerGeneration(@Param(value = "list") List<String> list,
@Param(value = "beginOfYear") DateTime beginOfYear,
@Param(value = "endOfYear") DateTime endOfYear);
/** /**
* 批量插入 * 批量插入
* *
......
...@@ -568,15 +568,67 @@ public class WindPredictionFutureService { ...@@ -568,15 +568,67 @@ public class WindPredictionFutureService {
if (ObjectUtil.isNull(turbineView)) { if (ObjectUtil.isNull(turbineView)) {
return XListResult.success(Collections.emptyList()); return XListResult.success(Collections.emptyList());
} }
//todo 通过电站名查实际发电量 DateTime beginOfYear = DateUtil.beginOfYear(DateUtil.date());
DateTime endOfYear = DateUtil.endOfYear(beginOfYear);
//查本年发电
ThirdWindPowerGenerationUpdateMapper generationMapper = context.getBean(ThirdWindPowerGenerationUpdateMapper.class);
List<ThirdWindPowerGenerationUpdateEnt> list = generationMapper.selectList(new QueryWrapper<ThirdWindPowerGenerationUpdateEnt>()
.select("IFNULL( SUM( actual_generation ), 0 ) AS actual_generation", "MONTH ( collect_time ) AS actual_wind_direction")
.groupBy("MONTH ( collect_time )")
.lambda()
.eq(ThirdWindPowerGenerationUpdateEnt::getStationId, input.getStationId())
.between(ThirdWindPowerGenerationUpdateEnt::getCollectTime, beginOfYear, endOfYear)
);
Map<Integer, BigDecimal> nowMap;
if (CollUtil.isNotEmpty(list)) {
nowMap = list.stream()
.collect(Collectors.toMap(ThirdWindPowerGenerationUpdateEnt::getActualWindDirection, ThirdWindPowerGenerationUpdateEnt::getActualGeneration));
} else {
nowMap = Collections.emptyMap();
}
//油厂平均
Map<Integer, BigDecimal> ouMap;
List<BaseWindTurbineEnt> turbineList = this.getWindTurbineList(context, turbineView.getOuId());
if (CollUtil.isEmpty(turbineList)) {
ouMap = Collections.emptyMap();
} else {
ThirdWindPowerGenerationUpdateViewMapper viewMapper = context.getBean(ThirdWindPowerGenerationUpdateViewMapper.class);
List<ThirdWindPowerGenerationUpdateView> viewList = viewMapper.stationMonthAvgPowerGeneration(turbineList.stream()
.map(BaseModel::getId)
.collect(Collectors.toList()), beginOfYear, endOfYear);
if (CollUtil.isEmpty(viewList)) {
ouMap = Collections.emptyMap();
} else {
ouMap = viewList.stream()
.collect(Collectors.toMap(ThirdWindPowerGenerationUpdateView::getActualWindDirection, ThirdWindPowerGenerationUpdateView::getActualGeneration));
}
}
//查去年发电
beginOfYear = DateUtil.offset(beginOfYear, DateField.YEAR, -1);
endOfYear = DateUtil.offset(endOfYear, DateField.YEAR, -1);
list = generationMapper.selectList(new QueryWrapper<ThirdWindPowerGenerationUpdateEnt>()
.select("IFNULL( SUM( actual_generation ), 0 ) AS actual_generation", "MONTH ( collect_time ) AS actual_wind_direction")
.groupBy("MONTH ( collect_time )")
.lambda()
.eq(ThirdWindPowerGenerationUpdateEnt::getStationId, input.getStationId())
.between(ThirdWindPowerGenerationUpdateEnt::getCollectTime, beginOfYear, endOfYear)
);
Map<Integer, BigDecimal> lastMap;
if (CollUtil.isNotEmpty(list)) {
lastMap = list.stream()
.collect(Collectors.toMap(ThirdWindPowerGenerationUpdateEnt::getActualWindDirection, ThirdWindPowerGenerationUpdateEnt::getActualGeneration));
} else {
lastMap = Collections.emptyMap();
}
//匹配数据
List<GetWindPowerTrendOutput> outputs = new ArrayList<>(12); List<GetWindPowerTrendOutput> outputs = new ArrayList<>(12);
for (int i = 1; i <= 12; i++) { for (int i = 1; i <= 12; i++) {
outputs.add( outputs.add(
GetWindPowerTrendOutput.builder() GetWindPowerTrendOutput.builder()
.month(i) .month(i)
.activePower(BigDecimal.ZERO) .activePower(nowMap.getOrDefault(i, BigDecimal.ZERO))
.lastActivePower(BigDecimal.ZERO) .lastActivePower(lastMap.getOrDefault(i, BigDecimal.ZERO))
.avgActivePower(BigDecimal.ZERO) .avgActivePower(ouMap.getOrDefault(i, BigDecimal.ZERO))
.build() .build()
); );
} }
......
...@@ -69,6 +69,7 @@ ...@@ -69,6 +69,7 @@
<select id="selectOne" parameterType="pps.core.base.entity.BaseWindTurbineView" resultMap="ExtResultMap"> <select id="selectOne" parameterType="pps.core.base.entity.BaseWindTurbineView" resultMap="ExtResultMap">
SELECT t.id, SELECT t.id,
t.ou_id,
t.station_name, t.station_name,
t.total_power, t.total_power,
t.diameter, t.diameter,
......
...@@ -43,6 +43,32 @@ ...@@ -43,6 +43,32 @@
id=#{id} id=#{id}
</select> </select>
<select id="stationMonthAvgPowerGeneration" resultMap="BaseResultMap">
SELECT
ROUND( AVG( actual_generation ), 2 ) AS actual_generation,
actual_wind_direction
FROM
(
SELECT
station_id,
IFNULL( SUM( actual_generation ), 0 ) AS actual_generation,
MONTH ( collect_time ) AS actual_wind_direction
FROM
third_wind_power_generation_update
WHERE
station_id IN
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
AND collect_time BETWEEN #{beginOfYear} AND #{endOfYear}
GROUP BY
station_id,
MONTH ( collect_time )
) z
GROUP BY
actual_wind_direction
</select>
<insert id="batchInsert" parameterType="list"> <insert id="batchInsert" parameterType="list">
INSERT INTO third_wind_power_generation_update (station_name, station_id, collect_time, actual_wind_speed, INSERT INTO third_wind_power_generation_update (station_name, station_id, collect_time, actual_wind_speed,
actual_power, actual_generation, actual_wind_direction, input_time, system_source) VALUES actual_power, actual_generation, actual_wind_direction, input_time, system_source) VALUES
......
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