Commit 8c373afd authored by ZWT's avatar ZWT

feat(吉林演示): 松原

1.天气数据接收定时任务,解决代码扫描问题,修改文件读取相关代码,解决资源未关流问题;
2.修改登录验证码生成工具类,解决代码扫描问题,修复随机数不安全问题;
3.删除除主程序启动类外其他启动类模块,解决代码扫描问题;
4.删除自定义httputlis类,解决代码扫描问题,替换部分代码远程调用方法;
5.重构光伏预测模块下载电站实际发电数据导入模板接口,解决代码扫描问题;
6.重构光伏预测模块导入电站实际发电数据接口,解决代码扫描问题;
7.删除公用excel导入导出工具类及poi相关pom依赖,解决代码扫描问题;
8.光伏功率预测模块,增加查询线路列表接口,解决页面接口报错问题;
9.增加测试用历史数据导入接口;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent c3503163
......@@ -90,4 +90,16 @@ public class PlantPredictedPowerDataEnt implements Serializable {
@XText("结束时间")
@TableField(exist = false)
private Date endTime;
@XText("电站名称")
@TableField
private String plantName;
@XText("天气类型")
@TableField
private String weatherType;
@XText("降水量")
@TableField
private BigDecimal precipitation;
}
package pps.core.base.enums;
import cn.hutool.core.text.CharSequenceUtil;
/**
* 天气图标枚举
*
* @author ZWT
* @date 2024/10/17
*/
public enum WeatherIconEnum {
w0("static/img/w/icon/w0.png", 0),
w1("static/img/w/icon/w1.png", 1),
w3("static/img/w/icon/w3.png", 1),
w29("static/img/w/icon/w29.png", 1),
w13("static/img/w/icon/w13.png", 1),
w2("static/img/w/icon/w2.png", 2),
w4("static/img/w/icon/w4.png", 2),
w5("static/img/w/icon/w5.png", 2),
w20("static/img/w/icon/w20.png", 2),
w6("static/img/w/icon/w6.png", 3),
w7("static/img/w/icon/w7.png", 3),
w8("static/img/w/icon/w8.png", 3),
w9("static/img/w/icon/w9.png", 3),
w10("static/img/w/icon/w10.png", 3),
w11("static/img/w/icon/w11.png", 3),
w12("static/img/w/icon/w12.png", 3),
w14("static/img/w/icon/w14.png", 3),
w15("static/img/w/icon/w15.png", 3),
w16("static/img/w/icon/w16.png", 3),
w17("static/img/w/icon/w17.png", 3),
w19("static/img/w/icon/w19.png", 3),
w21("static/img/w/icon/w21.png", 3),
w22("static/img/w/icon/w22.png", 3),
w23("static/img/w/icon/w23.png", 3),
w24("static/img/w/icon/w24.png", 3),
w25("static/img/w/icon/w25.png", 3),
w26("static/img/w/icon/w26.png", 3),
w27("static/img/w/icon/w27.png", 3),
w28("static/img/w/icon/w28.png", 3),
w30("static/img/w/icon/w30.png", 3),
w31("static/img/w/icon/w31.png", 3),
w32("static/img/w/icon/w32.png", 3),
w33("static/img/w/icon/w33.png", 3),
w34("static/img/w/icon/w34.png", 3),
w35("static/img/w/icon/w35.png", 3),
w36("static/img/w/icon/w36.png", 3),
w18("static/img/w/icon/w18.png", 4),
w99("-", 99),
;
private String icon;
private Integer type;
WeatherIconEnum(String icon, Integer type) {
this.icon = icon;
this.type = type;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
/**
* 按值查找
*
* @param icon 图标
* @return {@link WeatherIconEnum }
*/
public static WeatherIconEnum findByValue(String icon) {
for (WeatherIconEnum item : values()) {
if (CharSequenceUtil.equals(item.getIcon(), icon)) {
return item;
}
}
return WeatherIconEnum.w99;
}
}
\ No newline at end of file
......@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils;
import pps.cloud.base.service.IBaseWeatherCloudService;
import pps.core.base.entity.*;
import pps.core.base.enums.WeatherIconEnum;
import pps.core.base.enums.WindDirection;
import pps.core.base.mapper.*;
import pps.core.base.service.data.third_weather_data.DailyData;
......@@ -865,6 +866,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
List<PlantPredictedPowerDataEnt> allList = new ArrayList<>(32);
List<PlantPredictedPowerDataEnt> objList = new ArrayList<>(16);
String plantId = plant.getId();
String stationName = plant.getStationName();
DateTime date;
int flag = 0;
for (int i = 0; i < 8; i++) {
......@@ -876,7 +878,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
dateTime = DateUtil.offsetDay(dateTime, 1);
flag++;
}
PlantPredictedPowerDataEnt dao = this.getPlantPredictedPowerEnt(plantId,
PlantPredictedPowerDataEnt dao = this.getPlantPredictedPowerEnt(plantId, stationName,
this.int2Str(hour),
this.stringToBigDecimal(dailyData.getTemperatureArray(), i, "℃"),
this.stringToBigDecimal(dailyData.getWindSpeedArray(), i, "m/s"),
......@@ -885,7 +887,9 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
this.stringToBigDecimal(dailyData.getHumidityArray(), i, "%"),
String.valueOf(parse.year()),
this.int2Str(parse.monthBaseOne()),
this.int2Str(parse.dayOfMonth())
this.int2Str(parse.dayOfMonth()),
this.getWeatherType(dailyData.getWeatherArray(), i),
this.getPrecipitation(dailyData.getPrecipitationArray(), i)
);
// 5.执行SQL
allList.add(dao);
......@@ -921,7 +925,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
}
PlantPredictedPowerDataEnt nextData = objList.get(i + 1);
BigDecimal valueOf = BigDecimal.valueOf(0.3 * y);
PlantPredictedPowerDataEnt dao = this.getPlantPredictedPowerEnt(plantId,
PlantPredictedPowerDataEnt dao = this.getPlantPredictedPowerEnt(plantId, stationName,
hourString,
this.compute(dataEnt.getTemperature(), nextData.getTemperature(), valueOf),
this.compute(dataEnt.getWindSpeed(), nextData.getWindSpeed(), valueOf),
......@@ -930,7 +934,9 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
this.compute(dataEnt.getHumidity(), nextData.getHumidity(), valueOf),
String.valueOf(date.year()),
this.int2Str(date.month() + 1),
this.int2Str(date.dayOfMonth())
this.int2Str(date.dayOfMonth()),
dataEnt.getWeatherType(),
this.compute(dataEnt.getPrecipitation(), nextData.getPrecipitation(), valueOf)
);
// 5.执行SQL
allList.add(dao);
......@@ -971,6 +977,9 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
dao.setPower(this.compute(Objects.isNull(item.getPower()) ? BigDecimal.ZERO : item.getPower(),
Objects.isNull(nextData.getPower()) ? BigDecimal.ZERO : nextData.getPower(),
valueOf));
dao.setPrecipitation(this.compute(Objects.isNull(item.getPrecipitation()) ? BigDecimal.ZERO : item.getPrecipitation(),
Objects.isNull(nextData.getPrecipitation()) ? BigDecimal.ZERO : nextData.getPrecipitation(),
valueOf));
batchList.add(dao);
}
}
......@@ -984,6 +993,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
* 获取电厂预测功率ent
*
* @param plantId 电站ID
* @param stationName 电站名称
* @param hourTime 小时
* @param temperature 温度
* @param windSpeed 风速
......@@ -993,11 +1003,14 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
* @param yearTime 年时间
* @param monthTime 月份时间
* @param dayTime 白天
* @param weatherType 天气类型
* @param precipitation 降水量
* @return {@link PlantPredictedPowerDataEnt}
*/
private PlantPredictedPowerDataEnt getPlantPredictedPowerEnt(String plantId, String hourTime, BigDecimal temperature, BigDecimal windSpeed, BigDecimal windDirection,
BigDecimal pressure, BigDecimal humidity, String yearTime, String monthTime, String dayTime) {
private PlantPredictedPowerDataEnt getPlantPredictedPowerEnt(String plantId, String stationName, String hourTime, BigDecimal temperature, BigDecimal windSpeed, BigDecimal windDirection,
BigDecimal pressure, BigDecimal humidity, String yearTime, String monthTime, String dayTime, String weatherType, BigDecimal precipitation) {
PlantPredictedPowerDataEnt dao = new PlantPredictedPowerDataEnt();
dao.setPlantName(stationName);
dao.setCreateTime(DateUtil.date());
dao.setPlantId(plantId);
dao.setHourTime(hourTime);
......@@ -1011,6 +1024,8 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
dao.setDayTime(dayTime);
dao.setMinTime(BusinessConstant.START_OF_DAY_TIME);
dao.setDataDate(dao.getYearTime() + '-' + dao.getMonthTime() + '-' + dao.getDayTime() + ' ' + dao.getHourTime() + ':' + dao.getMinTime());
dao.setWeatherType(weatherType);
dao.setPrecipitation(precipitation);
return dao;
}
......@@ -1100,6 +1115,41 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
return result;
}
/**
* 获取天气类型
*
* @param stringList 字符串列表
* @param i 我
* @return {@link String }
*/
private String getWeatherType(List<String> stringList, int i) {
String result;
if (CollUtil.isNotEmpty(stringList) && i < stringList.size() && CharSequenceUtil.isNotBlank(stringList.get(i))) {
result = WeatherIconEnum.findByValue(stringList.get(i)).getType().toString();
} else {
result = "99";
}
return result;
}
/**
* 获得降水
*
* @param stringList 字符串列表
* @param i 我
* @return {@link BigDecimal }
*/
private BigDecimal getPrecipitation(List<String> stringList, int i) {
BigDecimal result;
if (CollUtil.isNotEmpty(stringList) && i < stringList.size() &&
CharSequenceUtil.isNotBlank(stringList.get(i)) && CharSequenceUtil.equals(stringList.get(i), "无降水")) {
result = new BigDecimal(CharSequenceUtil.replace(stringList.get(i), "mm", ""));
} else {
result = BigDecimal.ZERO;
}
return result;
}
/**
* 按索引位置取字符串
*
......
......@@ -18,7 +18,10 @@
plane_irradiance,
horizontal_irradiance,
power,
create_time) VALUES
create_time,
plant_name,
weather_type,
precipitation) VALUES
<foreach collection="list" separator="," item="item">
(#{item.plantId},
#{item.dataDate},
......@@ -35,7 +38,11 @@
#{item.planeIrradiance},
#{item.horizontalIrradiance},
#{item.power},
#{item.createTime})
#{item.createTime},
#{item.plantName},
#{item.weatherType},
#{item.precipitation}
)
</foreach>
</insert>
</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