Commit 477f40fd authored by ZWT's avatar ZWT

feat(零碳): 长庆

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

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent f1719057
......@@ -54,4 +54,12 @@ public class ThirdWellAvgActivePowerView implements Serializable {
@XText("井号列表")
@TableField(exist = false)
private List<String> wellNumbers;
@XText("开始时间")
@TableField(exist = false)
private Date startTime;
@XText("结束时间")
@TableField(exist = false)
private Date endTime;
}
......@@ -33,4 +33,12 @@ public interface ThirdWellAvgActivePowerViewMapper {
* @return {@link List}<{@link ThirdWellAvgActivePowerView}>
*/
List<ThirdWellAvgActivePowerView> selectMeterPower(ThirdWellAvgActivePowerView record);
/**
* 每小时用电功率
*
* @param record 记录
* @return {@link List}<{@link ThirdWellAvgActivePowerView}>
*/
List<ThirdWellAvgActivePowerView> selectPowerConsumptionHour(ThirdWellAvgActivePowerView record);
}
......@@ -44,7 +44,6 @@ import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.data.XListResult;
import xstartup.data.XSingleResult;
import xstartup.feature.api.annotation.XApiAnonymous;
import xstartup.feature.api.annotation.XApiGet;
import java.math.BigDecimal;
......@@ -211,7 +210,6 @@ public class HomePageService {
* @param input 输入
* @return {@link XListResult}<{@link DynamicQueryEnergyConsumptionAnalysisViewOutput}>
*/
@XApiAnonymous
@XText("首页模块--用能分析")
@XApiGet
public XListResult<GetPowerAnalyseOutput> getPowerAnalyse(XContext context, GetStationViewInput input) {
......@@ -222,17 +220,15 @@ public class HomePageService {
DateTime endTime = DateUtil.beginOfDay(DateUtil.yesterday());
DateTime startTime = DateUtil.offsetDay(endTime, -6);
//用电功率
ThirdWellAvgActivePowerMapper mapper = context.getBean(ThirdWellAvgActivePowerMapper.class);
Map<Date, BigDecimal> avgMap = mapper.selectList(new QueryWrapper<ThirdWellAvgActivePowerEnt>()
.select("IFNULL( AVG( avg_active_power ), 0 ) AS avg_active_power", "DATE_FORMAT( input_time, '%Y-%m-%d %H:00:00' ) AS input_time")
.lambda()
.in(ThirdWellAvgActivePowerEnt::getWellNumber, wellList.stream()
ThirdWellAvgActivePowerViewMapper mapper = context.getBean(ThirdWellAvgActivePowerViewMapper.class);
Map<Date, BigDecimal> avgMap = mapper.selectPowerConsumptionHour(ThirdWellAvgActivePowerView.builder()
.wellNumbers(wellList.stream()
.map(DynamicQueryBaseWellheadOutput::getWellNumber)
.collect(Collectors.toList()))
.between(ThirdWellAvgActivePowerEnt::getInputTime, startTime, endTime)
.last("GROUP BY DATE_FORMAT( input_time, '%Y-%m-%d %H:00:00' )")
).stream()
.collect(Collectors.toMap(ThirdWellAvgActivePowerEnt::getInputTime, ThirdWellAvgActivePowerEnt::getAvgActivePower));
.startTime(startTime)
.endTime(endTime)
.build()).stream()
.collect(Collectors.toMap(ThirdWellAvgActivePowerView::getInputTime, ThirdWellAvgActivePowerView::getAvgActivePower));
//查组织下所有电站
List<GetBasePhotovoltaicPlantCloudOutput> plantList = this.getPlantList(context, stationId, null);
//发电功率
......
......@@ -4,7 +4,7 @@
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.ThirdWellAvgActivePowerView">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="well_number" property="wellNumber" jdbcType="VARCHAR"/>
<result column="input_time" property="inputTime" jdbcType="DATE"/>
<result column="input_time" property="inputTime" jdbcType="VARCHAR"/>
<result column="avg_active_power" property="avgActivePower" jdbcType="DECIMAL"/>
<result column="system_source" property="systemSource" jdbcType="VARCHAR"/>
<result column="save_date" property="saveDate" jdbcType="DATE"/>
......@@ -79,4 +79,35 @@
ORDER BY
hour_str
</select>
<select id="selectPowerConsumptionHour" parameterType="pps.core.prediction.entity.ThirdWellAvgActivePowerView"
resultMap="BaseResultMap">
SELECT
SUM( avg_active_power ) AS avg_active_power,
input_time
FROM
(
SELECT
IFNULL( AVG( avg_active_power ), 0 ) AS avg_active_power,
DATE_FORMAT( input_time, '%Y-%m-%d %H:00:00' ) AS input_time,
well_number
FROM
third_well_avg_active_power
WHERE
(
<if test="wellNumbers != null">
well_number IN
<foreach collection="wellNumbers" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
AND input_time BETWEEN #{startTime}
AND #{endTime} )
GROUP BY
well_number,
DATE_FORMAT( input_time, '%Y-%m-%d %H:00:00' )
) z
GROUP BY
input_time
</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