Commit 078abd09 authored by ZWT's avatar ZWT

feat(吉林演示): 松原

1.基础信息配置模块创建风资源历史数据表和风资源预测数据表,同时生成对应代码;
2.修改天气数据获取处理定时任务,修改光伏预测数据插入逻辑,同时增加风资源数据插入逻辑,完成功能测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 3fc4e7d9
package pps.core.common.constant; package pps.core.common.constant;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List;
/** /**
* 业务操作常量 * 业务操作常量
...@@ -18,6 +20,11 @@ public class BusinessConstant { ...@@ -18,6 +20,11 @@ public class BusinessConstant {
*/ */
public static final Long LOGIN_FLAG_SIMULATE = 1000000L; public static final Long LOGIN_FLAG_SIMULATE = 1000000L;
/**
* 时间表
*/
public static final List<String> TIME_LIST = CollUtil.newArrayList("15:00", "30:00", "45:00");
/** /**
* 权重数组 * 权重数组
*/ */
...@@ -220,6 +227,11 @@ public class BusinessConstant { ...@@ -220,6 +227,11 @@ public class BusinessConstant {
*/ */
public static final String DATE_FORMAT_HOUR = "yyyy-MM-dd HH:00:00"; public static final String DATE_FORMAT_HOUR = "yyyy-MM-dd HH:00:00";
/**
* 日期格式到小时2
*/
public static final String DATE_FORMAT_HOUR2 = "yyyy-MM-dd HH";
/** /**
* 日期格式化到天(年月日) * 日期格式化到天(年月日)
*/ */
......
package pps.core.base.entity; package pps.core.base.entity;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import pps.core.common.entity.BaseModel; import pps.core.common.entity.BaseModel;
import xstartup.annotation.XText; import xstartup.annotation.XText;
...@@ -16,6 +19,9 @@ import java.util.List; ...@@ -16,6 +19,9 @@ import java.util.List;
* @date 2024/08/28 * @date 2024/08/28
*/ */
@Data @Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class BaseWindTurbineView extends BaseModel implements Serializable { public class BaseWindTurbineView extends BaseModel implements Serializable {
@XText("组织机构ID") @XText("组织机构ID")
...@@ -68,4 +74,11 @@ public class BaseWindTurbineView extends BaseModel implements Serializable { ...@@ -68,4 +74,11 @@ public class BaseWindTurbineView extends BaseModel implements Serializable {
@XText("组织ID集合") @XText("组织ID集合")
@TableField(exist = false) @TableField(exist = false)
private List<String> ouList; private List<String> ouList;
/**
* 城市代码
*/
@XText("城市编码")
@TableField(exist = false)
private String cityCode;
} }
package pps.core.base.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.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import xstartup.annotation.XText;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 风预测数据
*
* @author ZWT
* @date 2024/08/29
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("wind_prediction_future")
public class WindPredictionFutureEnt implements Serializable {
@XText("ID")
@TableId(type = IdType.AUTO)
private Long id;
@XText("风电站ID")
@TableField
private String stationId;
@XText("记录时间")
@TableField
private Date dataTime;
@XText("风向")
@TableField
private Integer windDirection;
@XText("预报风速(m/s)")
@TableField
private BigDecimal windSpeed;
@XText("气温(℃)")
@TableField
private BigDecimal airTemperature;
@XText("湿度(%)")
@TableField
private BigDecimal humidity;
@XText("气压(hPa)")
@TableField
private BigDecimal pressure;
@XText("实际风速(m/s)")
@TableField
private BigDecimal actualWindSpeed;
@XText("实际功率(kw)")
@TableField
private BigDecimal actualPower;
@XText("预测功率(kw)")
@TableField
private BigDecimal predictedPower;
}
package pps.core.base.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import xstartup.annotation.XText;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 风预测数据
*
* @author ZWT
* @date 2024/08/29
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class WindPredictionFutureView implements Serializable {
@XText("ID")
@TableField
private Long id;
@XText("风电站ID")
@TableField
private String stationId;
@XText("记录时间")
@TableField
private Date dataTime;
@XText("风向")
@TableField
private Integer windDirection;
@XText("预报风速(m/s)")
@TableField
private BigDecimal windSpeed;
@XText("气温(℃)")
@TableField
private BigDecimal airTemperature;
@XText("湿度(%)")
@TableField
private BigDecimal humidity;
@XText("气压(hPa)")
@TableField
private BigDecimal pressure;
@XText("实际风速(m/s)")
@TableField
private BigDecimal actualWindSpeed;
@XText("实际功率(kw)")
@TableField
private BigDecimal actualPower;
@XText("预测功率(kw)")
@TableField
private BigDecimal predictedPower;
@XText("创建时间")
@TableField(exist = false)
private Date createTime;
@XText("结束时间")
@TableField(exist = false)
private Date endTime;
}
package pps.core.base.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.math.BigDecimal;
import java.util.Date;
/**
* 风预测历史数据
*
* @author ZWT
* @date 2024/08/29
*/
@Data
@TableName("wind_prediction_history")
public class WindPredictionHistoryEnt implements Serializable {
@XText("ID")
@TableId(type = IdType.AUTO)
private Long id;
@XText("风电站ID")
@TableField
private String stationId;
@XText("记录时间")
@TableField
private Date dataTime;
@XText("风向")
@TableField
private Integer windDirection;
@XText("预报风速(m/s)")
@TableField
private BigDecimal windSpeed;
@XText("气温(℃)")
@TableField
private BigDecimal airTemperature;
@XText("湿度(%)")
@TableField
private BigDecimal humidity;
@XText("气压(hPa)")
@TableField
private BigDecimal pressure;
@XText("实际风速(m/s)")
@TableField
private BigDecimal actualWindSpeed;
@XText("实际功率(kw)")
@TableField
private BigDecimal actualPower;
@XText("预测功率(kw)")
@TableField
private BigDecimal predictedPower;
}
package pps.core.base.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import xstartup.annotation.XText;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 风预测历史数据
*
* @author ZWT
* @date 2024/08/29
*/
@Data
public class WindPredictionHistoryView implements Serializable {
@XText("ID")
@TableField
private Long id;
@XText("风电站ID")
@TableField
private String stationId;
@XText("记录时间")
@TableField
private Date dataTime;
@XText("风向")
@TableField
private Integer windDirection;
@XText("预报风速(m/s)")
@TableField
private BigDecimal windSpeed;
@XText("气温(℃)")
@TableField
private BigDecimal airTemperature;
@XText("湿度(%)")
@TableField
private BigDecimal humidity;
@XText("气压(hPa)")
@TableField
private BigDecimal pressure;
@XText("实际风速(m/s)")
@TableField
private BigDecimal actualWindSpeed;
@XText("实际功率(kw)")
@TableField
private BigDecimal actualPower;
@XText("预测功率(kw)")
@TableField
private BigDecimal predictedPower;
}
...@@ -16,4 +16,12 @@ public interface BaseWindTurbineViewMapper { ...@@ -16,4 +16,12 @@ public interface BaseWindTurbineViewMapper {
BaseWindTurbineView selectOne(BaseWindTurbineView record); BaseWindTurbineView selectOne(BaseWindTurbineView record);
List<BaseWindTurbineView> selectList(BaseWindTurbineView record); List<BaseWindTurbineView> selectList(BaseWindTurbineView record);
/**
* 风机列表
*
* @param record 记录
* @return {@link List }<{@link BaseWindTurbineView }>
*/
List<BaseWindTurbineView> selectWindTurbineList(BaseWindTurbineView record);
} }
package pps.core.base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import pps.core.base.entity.WindPredictionFutureEnt;
/**
* 风预测数据
*
* @author ZWT
* @date 2024/08/29
*/
@Repository(value = "pps.core.base.mapper.WindPredictionFutureMapper")
public interface WindPredictionFutureMapper extends BaseMapper<WindPredictionFutureEnt> {
}
package pps.core.base.mapper;
import cn.hutool.core.date.DateTime;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import pps.core.base.entity.WindPredictionFutureView;
import java.util.List;
/**
* 风预测数据
*
* @author ZWT
* @date 2024/08/29
*/
@Repository(value = "pps.core.base.mapper.WindPredictionFutureViewMapper")
public interface WindPredictionFutureViewMapper {
WindPredictionFutureView selectOne(WindPredictionFutureView record);
List<WindPredictionFutureView> selectList(WindPredictionFutureView record);
/**
* 批量删除
*
* @param deleteList 删除列表
* @param create 创造
* @param end 结束
* @return int
*/
int deleteBatch(@Param(value = "list") List<String> deleteList, @Param(value = "create") DateTime create, @Param(value = "end") DateTime end);
/**
* 批量新增
*
* @param list 列表
* @return int
*/
int insertBatch(List<WindPredictionFutureView> list);
}
package pps.core.base.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import pps.core.base.entity.WindPredictionHistoryEnt;
/**
* 风预测历史数据
*
* @author ZWT
* @date 2024/08/29
*/
@Repository(value = "pps.core.base.mapper.WindPredictionHistoryMapper")
public interface WindPredictionHistoryMapper extends BaseMapper<WindPredictionHistoryEnt> {
}
package pps.core.base.mapper;
import org.springframework.stereotype.Repository;
import pps.core.base.entity.WindPredictionHistoryView;
import java.util.List;
/**
* 风预测历史数据
*
* @author ZWT
* @date 2024/08/29
*/
@Repository(value = "pps.core.base.mapper.WindPredictionHistoryViewMapper")
public interface WindPredictionHistoryViewMapper {
WindPredictionHistoryView selectOne(WindPredictionHistoryView record);
List<WindPredictionHistoryView> selectList(WindPredictionHistoryView record);
}
...@@ -29,10 +29,10 @@ import java.util.List; ...@@ -29,10 +29,10 @@ import java.util.List;
@XService @XService
public class BaseLineService { public class BaseLineService {
@XText("天气") @XText("天气")
@XApiGet @XApiGet(anonymous = true)
public XServiceResult test(XContext context) { public XServiceResult test(XContext context) {
BaseWeatherCloudServiceImpl bean = context.getBean(BaseWeatherCloudServiceImpl.class); BaseWeatherCloudServiceImpl bean = context.getBean(BaseWeatherCloudServiceImpl.class);
bean.weatherDataProcess(context, "CQ"); bean.weatherDataProcess(context, "SY");
return XServiceResult.OK; return XServiceResult.OK;
} }
......
...@@ -8,16 +8,14 @@ import cn.hutool.core.io.IoUtil; ...@@ -8,16 +8,14 @@ import cn.hutool.core.io.IoUtil;
import cn.hutool.core.io.NioUtil; import cn.hutool.core.io.NioUtil;
import cn.hutool.core.io.file.FileReader; import cn.hutool.core.io.file.FileReader;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import pps.cloud.base.service.IBaseWeatherCloudService; import pps.cloud.base.service.IBaseWeatherCloudService;
import pps.core.base.entity.BasePhotovoltaicPlantView; import pps.core.base.entity.*;
import pps.core.base.entity.PlantPredictedPowerDataEnt;
import pps.core.base.entity.ThirdWeatherDataEnt;
import pps.core.base.entity.ThirdWeatherDataView;
import pps.core.base.enums.WindDirection; import pps.core.base.enums.WindDirection;
import pps.core.base.mapper.*; import pps.core.base.mapper.*;
import pps.core.base.service.data.third_weather_data.DailyData; import pps.core.base.service.data.third_weather_data.DailyData;
...@@ -72,13 +70,6 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -72,13 +70,6 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
@Override @Override
public XServiceResult weatherDataProcess(XContext context, String oilFieldCode) { public XServiceResult weatherDataProcess(XContext context, String oilFieldCode) {
XLoggerTool logger = context.getLogger(); XLoggerTool logger = context.getLogger();
//取电站(排除第二采油厂)
BasePhotovoltaicPlantViewMapper viewMapper = context.getBean(BasePhotovoltaicPlantViewMapper.class);
List<BasePhotovoltaicPlantView> plantList = viewMapper.selectPlantList(new BasePhotovoltaicPlantView());
if (CollUtil.isEmpty(plantList)) {
logger.info("------ weatherDataProcess plantList is empty ------");
return XServiceResult.OK;
}
//取未读邮件 //取未读邮件
Store store = null; Store store = null;
Folder folder = null; Folder folder = null;
...@@ -122,33 +113,13 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -122,33 +113,13 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
} }
logger.info("------ weatherDataProcess jsonObjectList size: {}", jsonObjectList.size()); logger.info("------ weatherDataProcess jsonObjectList size: {}", jsonObjectList.size());
if (CollUtil.isNotEmpty(jsonObjectList)) { if (CollUtil.isNotEmpty(jsonObjectList)) {
logger.info("------ weatherDataProcess dataFractionation"); //风机预测数据处理
List<PlantPredictedPowerDataEnt> deleteList = new ArrayList<>(32);
List<PlantPredictedPowerDataEnt> batchList = new ArrayList<>(13312);
List<String> timeList = Arrays.asList("15:00", "30:00", "45:00");
DateTime create = DateUtil.offsetMinute(DateTime.of(DateUtil.now(), "yyyy-MM-dd HH"), -5);
DateTime end = DateUtil.offsetDay(create, 16);
//按照cityCode分组
Map<String, List<BasePhotovoltaicPlantView>> plantMap = plantList.stream()
.collect(Collectors.groupingBy(BasePhotovoltaicPlantView::getCityCode));
int count = 0;
for (JSONObject jsonObject : jsonObjectList) {
this.dataFractionation(jsonObject, plantMap, deleteList, create, end, batchList, timeList);
count++;
if (BusinessConstant.FIVE.equals(count)) {
this.deletePlantPredictedPowerList(context, deleteList);
this.insertBatchPlantPredictedPowerList(context, batchList);
logger.info("------ weatherDataProcess clear size d {} b {}", deleteList.size(), batchList.size());
CollUtil.clear(deleteList, batchList);
count = 0;
}
}
logger.info("------ weatherDataProcess delete and insertBatch");
XThreadHelper.async(() -> { XThreadHelper.async(() -> {
this.deletePlantPredictedPowerList(context, deleteList); this.windTurbineDataProcess(context, jsonObjectList);
this.insertBatchPlantPredictedPowerList(context, batchList); });
logger.info("------ weatherDataProcess delete and insertBatch finish"); //光伏预测数据处理
CollUtil.clear(deleteList, batchList); XThreadHelper.async(() -> {
this.photovoltaicDataProcess(context, jsonObjectList);
}); });
} }
return XServiceResult.OK; return XServiceResult.OK;
...@@ -349,6 +320,360 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -349,6 +320,360 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
.build()); .build());
} }
/**
* 计算
*
* @param a 一
* @param b b
* @param c c
* @return {@link BigDecimal}
*/
private BigDecimal compute(BigDecimal a, BigDecimal b, BigDecimal c) {
return a.add(b.subtract(a).multiply(c));
}
/**
* int转String
*
* @param num 数字
* @return {@link String}
*/
private String int2Str(int num) {
return num < 10 ? "0" + num : String.valueOf(num);
}
/**
* 保存附件
*
* @param part 部分
* @return {@link String}
* @throws MessagingException 消息传递异常
* @throws IOException IOException
*/
private String saveAttachment(Part part) throws MessagingException, IOException {
String fileName;
String filePath = null;
if (part.isMimeType("multipart/*")) {
Multipart mp = (Multipart) part.getContent();
BodyPart mPart;
for (int i = 0; i < mp.getCount(); i++) {
mPart = mp.getBodyPart(i);
String disposition = mPart.getDisposition();
if (Part.ATTACHMENT.equals(disposition) || Part.INLINE.equals(disposition)) {
fileName = mPart.getFileName();
if (CharSequenceUtil.isNotEmpty(fileName) && StringUtils.lowerCase(fileName).contains("GB2312")) {
fileName = MimeUtility.decodeText(fileName);
}
fileName = CharSequenceUtil.replace(fileName, "\\?|=", "");
filePath = this.saveTempFile(fileName, mPart.getInputStream());
} else if (mPart.isMimeType("multipart/*")) {
this.saveAttachment(mPart);
} else {
fileName = mPart.getFileName();
if (CharSequenceUtil.isNotEmpty(fileName) && StringUtils.lowerCase(fileName).contains("GB2312")) {
fileName = MimeUtility.decodeText(fileName);
filePath = this.saveTempFile(fileName, mPart.getInputStream());
}
}
}
} else if (part.isMimeType("message/rfc822")) {
this.saveAttachment((Part) part.getContent());
}
return filePath;
}
/**
* 保存临时文件
*
* @param fileName 文件名
* @param in 在里面
* @return {@link String}
*/
private String saveTempFile(String fileName, InputStream in) {
String storeDir = XStartup.getCurrent().getProperty("weather.file.temp.path");
StringBuilder stringBuilder = new StringBuilder(storeDir)
.append(File.separator)
.append(DateTime.now().toString("yyyyMMdd"));
String filePath = stringBuilder.append(File.separator).append(fileName).toString();
FileUtil.touch(filePath);
FileUtil.writeFromStream(in, filePath);
IoUtil.close(in);
return filePath;
}
/**
* 零填充
*
* @param number 数字
* @return {@link String}
*/
private String zeroFill(int number) {
if (number < 10) {
return "0" + number;
}
return String.valueOf(number);
}
/**
* 风机预测数据处理
*
* @param context 上下文
* @param jsonObjectList json对象列表
*/
private void windTurbineDataProcess(XContext context, List<JSONObject> jsonObjectList) {
context.getLogger().info("------ weatherDataProcess windTurbineDataProcess begin ------");
BaseWindTurbineViewMapper mapper = context.getBean(BaseWindTurbineViewMapper.class);
List<BaseWindTurbineView> turbineList = mapper.selectWindTurbineList(new BaseWindTurbineView());
if (CollUtil.isEmpty(turbineList)) {
context.getLogger().info("------ weatherDataProcess turbineList is empty ------");
return;
}
context.getLogger().info("------ weatherDataProcess dataFractionation");
List<String> deleteList = new ArrayList<>(32);
List<WindPredictionFutureView> batchList = new ArrayList<>(13312);
DateTime create = DateUtil.offsetMinute(DateTime.of(DateUtil.now(), "yyyy-MM-dd HH"), -5);
DateTime end = DateUtil.offsetDay(create, 16);
//按照cityCode分组
Map<String, List<BaseWindTurbineView>> turbineMap = turbineList.stream()
.collect(Collectors.groupingBy(BaseWindTurbineView::getCityCode));
int count = 0;
for (JSONObject jsonObject : jsonObjectList) {
this.dataFractionation(jsonObject, turbineMap, deleteList, batchList);
count++;
if (BusinessConstant.FIVE.equals(count)) {
this.deleteWindTurbineList(context, deleteList, create, end);
this.insertWindTurbineList(context, batchList);
context.getLogger().info("------ weatherDataProcess clear size d {} b {}", deleteList.size(), batchList.size());
CollUtil.clear(deleteList, batchList);
count = 0;
}
}
context.getLogger().info("------ weatherDataProcess delete and insertBatch");
if (CollUtil.isNotEmpty(deleteList)) {
this.deleteWindTurbineList(context, deleteList, create, end);
}
if (CollUtil.isNotEmpty(batchList)) {
this.insertWindTurbineList(context, batchList);
}
CollUtil.clear(deleteList, batchList);
context.getLogger().info("------ weatherDataProcess windTurbineDataProcess end ------");
}
/**
* 插入间歇装置预测功率列表
*
* @param context 上下文
* @param batchList 批处理列表
*/
private void insertWindTurbineList(XContext context, List<WindPredictionFutureView> batchList) {
if (CollUtil.isNotEmpty(batchList)) {
WindPredictionFutureViewMapper dataViewMapper = context.getBean(WindPredictionFutureViewMapper.class);
int size = batchList.size();
context.getLogger().info("------ insertWindTurbineList batchList insert size: {}", size);
if (size > BaseUtils.BATCH_SIZE) {
List<List<WindPredictionFutureView>> subList = BaseUtils.getSubList(batchList);
subList.forEach(dataViewMapper::insertBatch);
} else {
dataViewMapper.insertBatch(batchList);
}
}
}
/**
* 条件删除预测数据
*
* @param context 上下文
* @param deleteList 删除列表
* @param create 创造
* @param end 结束
*/
private void deleteWindTurbineList(XContext context, List<String> deleteList, DateTime create, DateTime end) {
if (CollUtil.isNotEmpty(deleteList)) {
WindPredictionFutureViewMapper mapper = context.getBean(WindPredictionFutureViewMapper.class);
int size = deleteList.size();
context.getLogger().info("------ deleteWindTurbineList batchDelete delete size: {}", size);
if (size > BaseUtils.BATCH_SIZE) {
List<List<String>> subList = BaseUtils.getSubList(deleteList);
for (List<String> list : subList) {
mapper.deleteBatch(list, create, end);
}
} else {
mapper.deleteBatch(deleteList, create, end);
}
}
}
/**
* 风机电站数据处理
*
* @param jsonObject json对象
* @param turbineMap 涡轮机图
* @param deleteList 删除列表
* @param batchList 批次列表
*/
private void dataFractionation(JSONObject jsonObject, Map<String, List<BaseWindTurbineView>> turbineMap, List<String> deleteList,
List<WindPredictionFutureView> batchList) {
Map<String, List<DailyData>> cityDataMap = new HashMap<>(16);
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
if (value instanceof JSONArray) {
cityDataMap.put(key, ((JSONArray) value).toJavaList(DailyData.class));
}
}
for (String cityCode : cityDataMap.keySet()) {
if (!turbineMap.containsKey(cityCode)) {
continue;
}
List<DailyData> dailyDataList = cityDataMap.get(cityCode);
List<BaseWindTurbineView> turbineList = turbineMap.get(cityCode);
//删除数据
for (BaseWindTurbineView turbine : turbineList) {
deleteList.add(turbine.getId());
}
//遍历预测数据列表
for (DailyData dailyData : dailyDataList) {
for (BaseWindTurbineView turbine : turbineList) {
List<WindPredictionFutureView> allList = new ArrayList<>(32);
List<WindPredictionFutureView> objList = new ArrayList<>(16);
DateTime dateTime = DateTime.of(dailyData.getDateTime());
int hours = 0;
String turbineId = turbine.getId();
DateTime date;
for (int i = 0; i < 8; i++) {
//判断小时数与查到的小时数,如果查到的小时数小,判断为第二天
int hour = LocalTime.parse(dailyData.getHourTimeArray().get(i)).getHour();
if (hours >= hour) {
dateTime = DateUtil.offsetDay(dateTime, 1);
}
hours = hour;
int wind = 0;
if (CollUtil.isNotEmpty(dailyData.getWindDirectionArray())) {
if (i < dailyData.getWindDirectionArray().size()) {
WindDirection windDirection = WindDirection.findByValue(dailyData.getWindDirectionArray().get(i));
if (Objects.nonNull(windDirection)) {
wind = windDirection.getValue();
}
}
}
WindPredictionFutureView build = WindPredictionFutureView.builder()
.stationId(turbineId)
.dataTime(dateTime)
.windDirection(wind)
.windSpeed(new BigDecimal(CharSequenceUtil.replace(dailyData.getWindSpeedArray().get(i), "m/s", "")))
.airTemperature(new BigDecimal(CharSequenceUtil.replace(dailyData.getTemperatureArray().get(i), "℃", "")))
.humidity(new BigDecimal(CharSequenceUtil.replace(dailyData.getHumidityArray().get(i), "%", "")))
.pressure(new BigDecimal(CharSequenceUtil.replace(dailyData.getPressureArray().get(i), "hPa", "")))
.build();
// 5.执行SQL
allList.add(build);
WindPredictionFutureView isExit = objList.stream()
.filter(item -> item.getDataTime().compareTo(build.getDataTime()) == 0)
.findFirst()
.orElse(null);
if (ObjectUtil.isNull(isExit)) {
objList.add(build);
}
}
// 原站点时间结构为:08:00 11:00 14:00 17:00 20:00 23:00 02:00 05:00
// 两条数据中间差了两个小时,使用上下两条数据推算出中间差掉的两个小时
for (int i = 0; i < objList.size() - 1; i++) {
for (int y = 1; y < 3; y++) {
WindPredictionFutureView dataEnt = objList.get(i);
date = DateUtil.beginOfSecond(dataEnt.getDataTime());
WindPredictionFutureView nextData = objList.get(i + 1);
BigDecimal valueOf = BigDecimal.valueOf(0.3 * y);
WindPredictionFutureView build = WindPredictionFutureView.builder()
.stationId(turbineId)
.dataTime(dateTime)
.windDirection(dataEnt.getWindDirection())
.windSpeed(this.compute(dataEnt.getWindSpeed(), nextData.getWindSpeed(), valueOf))
.airTemperature(this.compute(dataEnt.getAirTemperature(), nextData.getAirTemperature(), valueOf))
.humidity(this.compute(dataEnt.getHumidity(), nextData.getHumidity(), valueOf))
.pressure(this.compute(dataEnt.getPressure(), nextData.getPressure(), valueOf))
.build();
// 5.执行SQL
allList.add(build);
}
}
//入库
allList.sort(Comparator.comparing(WindPredictionFutureView::getDataTime));
for (int i = 0; i < allList.size(); i++) {
WindPredictionFutureView item = allList.get(i);
batchList.add(item);
if (i < allList.size() - 1) {
for (int y = 0; y < BusinessConstant.TIME_LIST.size(); y++) {
WindPredictionFutureView dao = XCopyUtils.copyNewObject(item);
dao.setDataTime(DateUtil.parse(DateUtil.format(dao.getDataTime(), BusinessConstant.DATE_FORMAT_HOUR2) + ':' + BusinessConstant.TIME_LIST.get(y)));
WindPredictionFutureView nextData = allList.get(i + 1);
BigDecimal valueOf = BigDecimal.valueOf(0.3 * (y + 1));
dao.setAirTemperature(this.compute(Objects.isNull(item.getAirTemperature()) ? BigDecimal.ZERO : item.getAirTemperature(),
Objects.isNull(nextData.getAirTemperature()) ? BigDecimal.ZERO : nextData.getAirTemperature(),
valueOf));
dao.setHumidity(this.compute(Objects.isNull(item.getHumidity()) ? BigDecimal.ZERO : item.getHumidity(),
Objects.isNull(nextData.getHumidity()) ? BigDecimal.ZERO : nextData.getHumidity(),
valueOf));
dao.setWindSpeed(this.compute(Objects.isNull(item.getWindSpeed()) ? BigDecimal.ZERO : item.getWindSpeed(),
Objects.isNull(nextData.getWindSpeed()) ? BigDecimal.ZERO : nextData.getWindSpeed(),
valueOf));
dao.setPressure(this.compute(Objects.isNull(item.getPressure()) ? BigDecimal.ZERO : item.getPressure(),
Objects.isNull(nextData.getPressure()) ? BigDecimal.ZERO : nextData.getPressure(),
valueOf));
batchList.add(dao);
}
}
}
}
}
}
}
/**
* 光伏数据处理
*
* @param context 上下文
* @param jsonObjectList json对象列表
*/
private void photovoltaicDataProcess(XContext context, List<JSONObject> jsonObjectList) {
context.getLogger().info("------ weatherDataProcess photovoltaicDataProcess begin ------");
//取电站(排除第二采油厂)
BasePhotovoltaicPlantViewMapper viewMapper = context.getBean(BasePhotovoltaicPlantViewMapper.class);
List<BasePhotovoltaicPlantView> plantList = viewMapper.selectPlantList(new BasePhotovoltaicPlantView());
if (CollUtil.isEmpty(plantList)) {
context.getLogger().info("------ weatherDataProcess plantList is empty ------");
return;
}
context.getLogger().info("------ weatherDataProcess dataFractionation");
List<PlantPredictedPowerDataEnt> deleteList = new ArrayList<>(32);
List<PlantPredictedPowerDataEnt> batchList = new ArrayList<>(13312);
DateTime create = DateUtil.offsetMinute(DateTime.of(DateUtil.now(), "yyyy-MM-dd HH"), -5);
DateTime end = DateUtil.offsetDay(create, 16);
//按照cityCode分组
Map<String, List<BasePhotovoltaicPlantView>> plantMap = plantList.stream()
.collect(Collectors.groupingBy(BasePhotovoltaicPlantView::getCityCode));
int count = 0;
for (JSONObject jsonObject : jsonObjectList) {
this.dataFractionation(jsonObject, plantMap, deleteList, create, end, batchList);
count++;
if (BusinessConstant.FIVE.equals(count)) {
this.deletePlantPredictedPowerList(context, deleteList);
this.insertBatchPlantPredictedPowerList(context, batchList);
context.getLogger().info("------ weatherDataProcess clear size d {} b {}", deleteList.size(), batchList.size());
CollUtil.clear(deleteList, batchList);
count = 0;
}
}
context.getLogger().info("------ weatherDataProcess delete and insertBatch");
if (CollUtil.isNotEmpty(deleteList)) {
this.deletePlantPredictedPowerList(context, deleteList);
}
if (CollUtil.isNotEmpty(batchList)) {
this.insertBatchPlantPredictedPowerList(context, batchList);
}
CollUtil.clear(deleteList, batchList);
context.getLogger().info("------ weatherDataProcess photovoltaicDataProcess end ------");
}
/** /**
* 数据拆分 * 数据拆分
* *
...@@ -358,10 +683,9 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -358,10 +683,9 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
* @param create 创造 * @param create 创造
* @param end 结束 * @param end 结束
* @param batchList 批次列表 * @param batchList 批次列表
* @param timeList 时间表
*/ */
private void dataFractionation(JSONObject jsonObject, Map<String, List<BasePhotovoltaicPlantView>> plantMap, List<PlantPredictedPowerDataEnt> deleteList, private void dataFractionation(JSONObject jsonObject, Map<String, List<BasePhotovoltaicPlantView>> plantMap, List<PlantPredictedPowerDataEnt> deleteList,
DateTime create, DateTime end, List<PlantPredictedPowerDataEnt> batchList, List<String> timeList) { DateTime create, DateTime end, List<PlantPredictedPowerDataEnt> batchList) {
Map<String, List<DailyData>> cityDataMap = new HashMap<>(16); Map<String, List<DailyData>> cityDataMap = new HashMap<>(16);
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) { for (Map.Entry<String, Object> entry : jsonObject.entrySet()) {
String key = entry.getKey(); String key = entry.getKey();
...@@ -477,9 +801,9 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -477,9 +801,9 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
PlantPredictedPowerDataEnt item = sortList.get(i); PlantPredictedPowerDataEnt item = sortList.get(i);
batchList.add(item); batchList.add(item);
if (i < sortList.size() - 1) { if (i < sortList.size() - 1) {
for (int y = 0; y < timeList.size(); y++) { for (int y = 0; y < BusinessConstant.TIME_LIST.size(); y++) {
PlantPredictedPowerDataEnt dao = XCopyUtils.copyNewObject(item); PlantPredictedPowerDataEnt dao = XCopyUtils.copyNewObject(item);
dao.setMinTime(timeList.get(y)); dao.setMinTime(BusinessConstant.TIME_LIST.get(y));
dao.setDataDate(dao.getYearTime() + '-' + dao.getMonthTime() + '-' + dao.getDayTime() + ' ' + dao.getHourTime() + ':' + dao.getMinTime()); dao.setDataDate(dao.getYearTime() + '-' + dao.getMonthTime() + '-' + dao.getDayTime() + ' ' + dao.getHourTime() + ':' + dao.getMinTime());
PlantPredictedPowerDataEnt nextData = sortList.get(i + 1); PlantPredictedPowerDataEnt nextData = sortList.get(i + 1);
BigDecimal valueOf = BigDecimal.valueOf(0.3 * (y + 1)); BigDecimal valueOf = BigDecimal.valueOf(0.3 * (y + 1));
...@@ -547,87 +871,6 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -547,87 +871,6 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
return dao; return dao;
} }
/**
* 计算
*
* @param a 一
* @param b b
* @param c c
* @return {@link BigDecimal}
*/
private BigDecimal compute(BigDecimal a, BigDecimal b, BigDecimal c) {
return a.add(b.subtract(a).multiply(c));
}
/**
* int转String
*
* @param num 数字
* @return {@link String}
*/
private String int2Str(int num) {
return num < 10 ? "0" + num : String.valueOf(num);
}
/**
* 保存附件
*
* @param part 部分
* @return {@link String}
* @throws MessagingException 消息传递异常
* @throws IOException IOException
*/
private String saveAttachment(Part part) throws MessagingException, IOException {
String fileName;
String filePath = null;
if (part.isMimeType("multipart/*")) {
Multipart mp = (Multipart) part.getContent();
BodyPart mPart;
for (int i = 0; i < mp.getCount(); i++) {
mPart = mp.getBodyPart(i);
String disposition = mPart.getDisposition();
if (Part.ATTACHMENT.equals(disposition) || Part.INLINE.equals(disposition)) {
fileName = mPart.getFileName();
if (CharSequenceUtil.isNotEmpty(fileName) && StringUtils.lowerCase(fileName).contains("GB2312")) {
fileName = MimeUtility.decodeText(fileName);
}
fileName = CharSequenceUtil.replace(fileName, "\\?|=", "");
filePath = this.saveTempFile(fileName, mPart.getInputStream());
} else if (mPart.isMimeType("multipart/*")) {
this.saveAttachment(mPart);
} else {
fileName = mPart.getFileName();
if (CharSequenceUtil.isNotEmpty(fileName) && StringUtils.lowerCase(fileName).contains("GB2312")) {
fileName = MimeUtility.decodeText(fileName);
filePath = this.saveTempFile(fileName, mPart.getInputStream());
}
}
}
} else if (part.isMimeType("message/rfc822")) {
this.saveAttachment((Part) part.getContent());
}
return filePath;
}
/**
* 保存临时文件
*
* @param fileName 文件名
* @param in 在里面
* @return {@link String}
*/
private String saveTempFile(String fileName, InputStream in) {
String storeDir = XStartup.getCurrent().getProperty("weather.file.temp.path");
StringBuilder stringBuilder = new StringBuilder(storeDir)
.append(File.separator)
.append(DateTime.now().toString("yyyyMMdd"));
String filePath = stringBuilder.append(File.separator).append(fileName).toString();
FileUtil.touch(filePath);
FileUtil.writeFromStream(in, filePath);
IoUtil.close(in);
return filePath;
}
/** /**
* 条件删除预测数据 * 条件删除预测数据
* *
...@@ -681,17 +924,4 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -681,17 +924,4 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
} }
} }
} }
}
/** \ No newline at end of file
* 零填充
*
* @param number 数字
* @return {@link String}
*/
private String zeroFill(int number) {
if (number < 10) {
return "0" + number;
}
return String.valueOf(number);
}
}
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
p.area_code, p.area_code,
a.city_code a.city_code
FROM base_photovoltaic_plant p FROM base_photovoltaic_plant p
LEFT JOIN sys_area a ON a.id = p.area_code JOIN sys_area a ON a.id = p.area_code
WHERE p.is_deleted = 1 WHERE p.is_deleted = 1
AND p.area_code IS NOT NULL AND p.area_code IS NOT NULL
<if test="ouIdNotIn != null and ouIdNotIn.size() > 0"> <if test="ouIdNotIn != null and ouIdNotIn.size() > 0">
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.base.mapper.BaseWindTurbineViewMapper"> <mapper namespace="pps.core.base.mapper.BaseWindTurbineViewMapper">
<resultMap id="BaseResultMap" type="pps.core.base.entity.BaseWindTurbineView"> <resultMap id="BaseResultMap" type="pps.core.base.entity.BaseWindTurbineView">
<id column="id" property="id" jdbcType="VARCHAR" /> <id column="id" property="id" jdbcType="VARCHAR"/>
<result column="is_deleted" property="isDeleted" jdbcType="INTEGER" /> <result column="is_deleted" property="isDeleted" jdbcType="INTEGER"/>
<result column="create_by_id" property="createById" jdbcType="VARCHAR" /> <result column="create_by_id" property="createById" jdbcType="VARCHAR"/>
<result column="create_by_name" property="createByName" jdbcType="VARCHAR" /> <result column="create_by_name" property="createByName" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="DATE" /> <result column="create_time" property="createTime" jdbcType="DATE"/>
<result column="modify_by_id" property="modifyById" jdbcType="VARCHAR" /> <result column="modify_by_id" property="modifyById" jdbcType="VARCHAR"/>
<result column="modify_by_name" property="modifyByName" jdbcType="VARCHAR" /> <result column="modify_by_name" property="modifyByName" jdbcType="VARCHAR"/>
<result column="modify_time" property="modifyTime" jdbcType="DATE" /> <result column="modify_time" property="modifyTime" jdbcType="DATE"/>
<result column="ou_id" property="ouId" jdbcType="VARCHAR" /> <result column="ou_id" property="ouId" jdbcType="VARCHAR"/>
<result column="ou_name" property="ouName" jdbcType="VARCHAR" /> <result column="ou_name" property="ouName" jdbcType="VARCHAR"/>
<result column="station_name" property="stationName" jdbcType="VARCHAR" /> <result column="station_name" property="stationName" jdbcType="VARCHAR"/>
<result column="total_power" property="totalPower" jdbcType="DECIMAL" /> <result column="total_power" property="totalPower" jdbcType="DECIMAL"/>
<result column="diameter" property="diameter" jdbcType="DECIMAL" /> <result column="diameter" property="diameter" jdbcType="DECIMAL"/>
<result column="vane_length" property="vaneLength" jdbcType="DECIMAL" /> <result column="vane_length" property="vaneLength" jdbcType="DECIMAL"/>
<result column="hub_height" property="hubHeight" jdbcType="DECIMAL" /> <result column="hub_height" property="hubHeight" jdbcType="DECIMAL"/>
<result column="longitude" property="longitude" jdbcType="DECIMAL" /> <result column="longitude" property="longitude" jdbcType="DECIMAL"/>
<result column="latitude" property="latitude" jdbcType="DECIMAL" /> <result column="latitude" property="latitude" jdbcType="DECIMAL"/>
<result column="elevation" property="elevation" jdbcType="DECIMAL" /> <result column="elevation" property="elevation" jdbcType="DECIMAL"/>
<result column="area_code" property="areaCode" jdbcType="INTEGER" /> <result column="area_code" property="areaCode" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, id
,
is_deleted, is_deleted,
create_by_id, create_by_id,
create_by_name, create_by_name,
...@@ -42,28 +43,63 @@ ...@@ -42,28 +43,63 @@
latitude, latitude,
elevation, elevation,
area_code area_code
</sql> </sql>
<select id="selectOne" parameterType="pps.core.base.entity.BaseWindTurbineView" resultMap="BaseResultMap"> <select id="selectOne" parameterType="pps.core.base.entity.BaseWindTurbineView" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from base_wind_turbine from base_wind_turbine
where where
id=#{id} id=#{id}
</select> </select>
<select id="selectList" parameterType="pps.core.base.entity.BaseWindTurbineView" resultMap="BaseResultMap"> <select id="selectList" parameterType="pps.core.base.entity.BaseWindTurbineView" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from base_wind_turbine from base_wind_turbine
where where
is_deleted = 1 is_deleted = 1
AND ou_id in AND ou_id in
<foreach collection="ouList" open="(" close=")" separator="," item="item"> <foreach collection="ouList" open="(" close=")" separator="," item="item">
#{item} #{item}
</foreach> </foreach>
<if test="stationName != null and stationName != ''"> <if test="stationName != null and stationName != ''">
AND station_name LIKE CONCAT( '%', #{stationName}, '%' ) AND station_name LIKE CONCAT( '%', #{stationName}, '%' )
</if> </if>
ORDER BY ORDER BY
station_name ASC station_name ASC
</select> </select>
<resultMap id="ExtResultMap" type="pps.core.base.entity.BaseWindTurbineView" extends="BaseResultMap">
<result column="city_code" property="cityCode" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectWindTurbineList" resultMap="ExtResultMap">
SELECT p.id,
p.is_deleted,
p.create_by_id,
p.create_by_name,
p.create_time,
p.modify_by_id,
p.modify_by_name,
p.modify_time,
p.ou_id,
p.ou_name,
p.station_name,
p.total_power,
p.diameter,
p.vane_length,
p.hub_height,
p.longitude,
p.latitude,
p.elevation,
p.area_code,
a.city_code
FROM base_wind_turbine p
JOIN sys_area a ON a.id = p.area_code
WHERE p.is_deleted = 1
AND p.area_code IS NOT NULL
<if test="ouId != null and ouId != ''">
AND p.ou_id = #{ouId}
</if>
ORDER BY modify_time DESC
</select>
</mapper> </mapper>
\ 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.base.mapper.WindPredictionFutureViewMapper">
<resultMap id="BaseResultMap" type="pps.core.base.entity.WindPredictionFutureView">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="station_id" property="stationId" jdbcType="VARCHAR"/>
<result column="data_time" property="dataTime" jdbcType="DATE"/>
<result column="wind_direction" property="windDirection" jdbcType="INTEGER"/>
<result column="wind_speed" property="windSpeed" jdbcType="DECIMAL"/>
<result column="air_temperature" property="airTemperature" jdbcType="DECIMAL"/>
<result column="humidity" property="humidity" jdbcType="DECIMAL"/>
<result column="pressure" property="pressure" jdbcType="DECIMAL"/>
<result column="actual_wind_speed" property="actualWindSpeed" jdbcType="DECIMAL"/>
<result column="actual_power" property="actualPower" jdbcType="DECIMAL"/>
<result column="predicted_power" property="predictedPower" jdbcType="DECIMAL"/>
</resultMap>
<sql id="Base_Column_List">
id
,
station_id,
data_time,
wind_direction,
wind_speed,
air_temperature,
humidity,
pressure,
actual_wind_speed,
actual_power,
predicted_power
</sql>
<select id="selectOne" parameterType="pps.core.base.entity.WindPredictionFutureView" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from wind_prediction_future
where
id=#{id}
</select>
<select id="selectList" parameterType="pps.core.base.entity.WindPredictionFutureView" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from wind_prediction_future
where
id=#{id}
</select>
<delete id="deleteBatch" parameterType="list">
DELETE FROM wind_prediction_future
WHERE
station_id IN
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
AND data_time BETWEEN #{create}
AND #{end}
</delete>
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO wind_prediction_future (station_id, data_time, wind_direction, wind_speed, air_temperature,
humidity, pressure ) VALUES
<foreach collection="list" separator="," item="item">
(
#{item.stationId},
#{item.dataTime},
#{item.windDirection},
#{item.windSpeed},
#{item.airTemperature},
#{item.humidity},
#{item.pressure}
)
</foreach>
</insert>
</mapper>
\ 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.base.mapper.WindPredictionHistoryViewMapper">
<resultMap id="BaseResultMap" type="pps.core.base.entity.WindPredictionHistoryView">
<id column="id" property="id" jdbcType="BIGINT" />
<result column="station_id" property="stationId" jdbcType="VARCHAR" />
<result column="data_time" property="dataTime" jdbcType="DATE" />
<result column="wind_direction" property="windDirection" jdbcType="INTEGER" />
<result column="wind_speed" property="windSpeed" jdbcType="DECIMAL" />
<result column="air_temperature" property="airTemperature" jdbcType="DECIMAL" />
<result column="humidity" property="humidity" jdbcType="DECIMAL" />
<result column="pressure" property="pressure" jdbcType="DECIMAL" />
<result column="actual_wind_speed" property="actualWindSpeed" jdbcType="DECIMAL" />
<result column="actual_power" property="actualPower" jdbcType="DECIMAL" />
<result column="predicted_power" property="predictedPower" jdbcType="DECIMAL" />
</resultMap>
<sql id="Base_Column_List">
id
,
station_id,
data_time,
wind_direction,
wind_speed,
air_temperature,
humidity,
pressure,
actual_wind_speed,
actual_power,
predicted_power
</sql>
<select id="selectOne" parameterType="pps.core.base.entity.WindPredictionHistoryView" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from wind_prediction_history
where
id=#{id}
</select>
<select id="selectList" parameterType="pps.core.base.entity.WindPredictionHistoryView" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from wind_prediction_history
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