Commit b702602f authored by ZWT's avatar ZWT

feat(零碳): 长庆演示系统新增功能

1.修改第三方日累计数据推送表表结构,增加日累计储能放电量字段,同时修改代码对应实体及mapper文件,修改相关接口增加储能日累计放电量接收逻辑;
2.修改首页井场收益分析模块接口,修改获取储能累计放电量逻辑;
3.设计并创建井口日用电趋势表,生成对应实体类及mapper文件;
4.统计分析模块,新增本月累计节电经济效益查询接口,添加线上接口文档并完成接口冒烟测试;
5.统计分析模块,新增本月累计减碳量查询接口,添加线上接口文档并完成接口冒烟测试;
6.统计分析模块,新增光伏发电趋势查询接口,添加线上接口文档并完成接口冒烟测试;
7.统计分析模块,新增月度总览查询接口,添加线上接口文档并完成接口冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent ce196d93
package pps.core.prediction.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import xstartup.annotation.XText;
import java.io.Serializable;
import java.util.Date;
/**
* 演示用配置表
*
* @author ZWT
* @date 2024/06/03
*/
@Data
@TableName("config_show")
public class ConfigShowEnt implements Serializable {
@XText("ID")
@TableId(type = IdType.AUTO)
private Long id;
@XText("是否启用(1_否,0_是)")
@TableField
private Boolean isEnable;
@XText("日期选择")
@TableField
private Date choiceDate;
}
package pps.core.prediction.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import xstartup.annotation.XText;
import java.io.Serializable;
import java.util.Date;
/**
* 演示用配置表
*
* @author ZWT
* @date 2024/06/03
*/
@Data
public class ConfigShowView implements Serializable {
@XText("ID")
@TableId(type = IdType.AUTO)
private Long id;
@XText("是否启用(1_否,0_是)")
@TableField
private Boolean isEnable;
@XText("日期选择")
@TableField
private Date choiceDate;
}
package pps.core.prediction.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import pps.core.prediction.entity.ConfigShowEnt;
/**
* 演示用配置表
*
* @author ZWT
* @date 2024/06/03
*/
@Repository(value = "pps.core.prediction.mapper.ConfigShowMapper")
public interface ConfigShowMapper extends BaseMapper<ConfigShowEnt> {
}
package pps.core.prediction.mapper;
import org.springframework.stereotype.Repository;
import pps.core.prediction.entity.ConfigShowView;
import java.util.List;
/**
* 演示用配置表
*
* @author ZWT
* @date 2024/06/03
*/
@Repository(value = "pps.core.prediction.mapper.ConfigShowViewMapper")
public interface ConfigShowViewMapper {
/**
* 选择一个
*
* @param record 记录
* @return {@link ConfigShowView }
*/
ConfigShowView selectOne(ConfigShowView record);
/**
* 选择列表
*
* @param record 记录
* @return {@link List }<{@link ConfigShowView }>
*/
List<ConfigShowView> selectList(ConfigShowView record);
}
......@@ -339,7 +339,7 @@ public class HomePageService {
* @return {@link XSingleResult}<{@link GetPowerPredictionOutput}>
*/
@XText("首页模块--光伏实时监控")
@XApiGet
@XApiGet(anonymous = true)
public XListResult<GetPowerPredictionOutput> getPowerPrediction(XContext context, GetStationViewInput input) {
String plantId = input.getPlantId();
List<GetBasePhotovoltaicPlantCloudOutput> plantList;
......@@ -370,29 +370,12 @@ 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++) {
BigDecimal predictPower = BigDecimal.ZERO;
BigDecimal actualPower = BigDecimal.ZERO;
BigDecimal meterPower = BigDecimal.ZERO;
String value = String.valueOf(i);
if (shortPowerMap.containsKey(value)) {
predictPower = shortPowerMap.get(value).setScale(2, RoundingMode.HALF_UP);
......@@ -401,15 +384,11 @@ public class HomePageService {
powerDaily = powerMap.get(i);
actualPower = powerDaily.getPhotovoltaicPower().setScale(2, RoundingMode.HALF_UP);
}
if (avgMap.containsKey(i)) {
meterPower = avgMap.get(i).setScale(2, RoundingMode.HALF_UP);
}
outputs.add(
GetPowerPredictionOutput.builder()
.hourNumber(i)
.predictPower(predictPower)
.actualPower(actualPower)
.meterPower(meterPower)
.build()
);
}
......
......@@ -28,7 +28,4 @@ public class GetPowerPredictionOutput {
@XText("实际功率")
private BigDecimal actualPower;
@XText("井场负荷")
private BigDecimal meterPower;
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.ConfigShowViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.ConfigShowView">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="is_enable" property="isEnable" jdbcType="TINYINT"/>
<result column="choice_date" property="choiceDate" jdbcType="DATE"/>
</resultMap>
<sql id="Base_Column_List">
id
,
is_enable,
choice_date
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.ConfigShowView" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from config_show
where
id=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.ConfigShowView" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from config_show
where
id=#{id}
</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