Commit dee28bf7 authored by ZWT's avatar ZWT

feat(能源管理系统): 邮件接收

1.添加天气数据邮件方式接收定时任务;
2.修改配置文件,增加新建定时任务,同时增加自定义参数;
3.创建天气邮件数据接收处理实现类,同时验证获取自定义参数方法;
4.添加收件工具类,验证是否能正常接收邮件;
5.天气邮件数据接收定时任务增加获取未读天气数据逻辑,增加附件文件临时存储方法并验证是否能正常读取文件数据同时转换为json数据;
6.增加查询运行中电站列表方法;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent db984fe2
...@@ -150,9 +150,10 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -150,9 +150,10 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
DateTime dateTime = DateTime.of(dailyData.getDateTime()); DateTime dateTime = DateTime.of(dailyData.getDateTime());
int hours = 0; int hours = 0;
String dayTime = dateTime.toString("yyyy-MM-dd"); String dayTime = dateTime.toString("yyyy-MM-dd");
String plantId = plant.getId();
DateTime date;
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
String hourTime = dailyData.getHourTimeArray().get(i); String hourTime = dailyData.getHourTimeArray().get(i);
String plantId = plant.getId();
PlantPredictedPowerDataEnt dao = new PlantPredictedPowerDataEnt(); PlantPredictedPowerDataEnt dao = new PlantPredictedPowerDataEnt();
dao.setCreateTime(new Date()); dao.setCreateTime(new Date());
dao.setPlantId(plantId); dao.setPlantId(plantId);
...@@ -170,10 +171,8 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -170,10 +171,8 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
dayTime = dateTime.toString("yyyy-MM-dd"); dayTime = dateTime.toString("yyyy-MM-dd");
} }
dao.setYearTime(String.valueOf(dateTime.year())); dao.setYearTime(String.valueOf(dateTime.year()));
int month = dateTime.month() + 1; dao.setMonthTime(this.int2Str(dateTime.month() + 1));
dao.setMonthTime(this.int2Str(month)); dao.setDayTime(this.int2Str(dateTime.dayOfMonth()));
int dayOfMonth = dateTime.dayOfMonth();
dao.setDayTime(this.int2Str(dayOfMonth));
hours = hour; hours = hour;
dao.setHourTime(this.int2Str(hours)); dao.setHourTime(this.int2Str(hours));
// 5.执行SQL // 5.执行SQL
...@@ -209,7 +208,58 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -209,7 +208,58 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
} }
// 原站点时间结构为:08:00 11:00 14:00 17:00 20:00 23:00 02:00 05:00 // 原站点时间结构为: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++) {
PlantPredictedPowerDataEnt dao = new PlantPredictedPowerDataEnt();
dao.setCreateTime(new Date());
dao.setPlantId(plantId);
int nextIndex = i + 1;
dao.setTemperature(this.compute(objList.get(i).getTemperature(), objList.get(nextIndex).getTemperature(), y));
dao.setWindSpeed(this.compute(objList.get(i).getWindSpeed(), objList.get(nextIndex).getWindSpeed(), y));
dao.setWindDirection(objList.get(i).getWindDirection());
dao.setPressure(this.compute(objList.get(i).getPressure(), objList.get(nextIndex).getPressure(), y));
dao.setHumidity(this.compute(objList.get(i).getHumidity(), objList.get(nextIndex).getHumidity(), y));
date = DateUtil.parseDate(objList.get(i).getDataDate());
String hourString;
Integer hourTime = Integer.valueOf(objList.get(i).getHourTime());
if (hourTime.equals(23)) {
date = DateUtil.offsetDay(date, 1);
hourString = "0" + (y - 1);
} else {
if ((hourTime + y) < 10) {
hourString = "0" + (hourTime + y);
} else {
hourString = String.valueOf(hourTime + y);
}
}
dayTime = date.toString("yyyy-MM-dd");
dao.setYearTime(String.valueOf(date.year()));
dao.setMonthTime(this.int2Str(date.month() + 1));
dao.setDayTime(this.int2Str(date.dayOfMonth()));
dao.setHourTime(hourString);
// 5.执行SQL
mapper.delete(new LambdaQueryWrapper<PlantPredictedPowerDataEnt>()
.eq(PlantPredictedPowerDataEnt::getPlantId, plantId)
.eq(PlantPredictedPowerDataEnt::getYearTime, dao.getYearTime())
.eq(PlantPredictedPowerDataEnt::getMonthTime, dao.getMonthTime())
.eq(PlantPredictedPowerDataEnt::getDayTime, dao.getDayTime())
.eq(PlantPredictedPowerDataEnt::getHourTime, dao.getHourTime())
);
dao.setMinTime("00:00");
dao.setDataDate(new StringBuilder(dao.getYearTime())
.append('-')
.append(dao.getMonthTime())
.append('-')
.append(dao.getDayTime())
.append(' ')
.append(dao.getHourTime())
.append(':')
.append(dao.getMinTime()).toString());
PlantPredictedPowerDataEnt insertDao = XCopyUtils.copyNewObject(dao, PlantPredictedPowerDataEnt.class);
allList.add(insertDao);
}
}
//入库
} }
...@@ -226,6 +276,10 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -226,6 +276,10 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
return XServiceResult.OK; return XServiceResult.OK;
} }
private BigDecimal compute(BigDecimal a, BigDecimal b, int y) {
return a.add(b.subtract(a).multiply(new BigDecimal(0.3 * y)));
}
/** /**
* int转String * int转String
* *
......
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