Commit 21684802 authored by ZWT's avatar ZWT

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

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

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 5824f859
...@@ -175,8 +175,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -175,8 +175,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
new BigDecimal(CharSequenceUtil.replace(dailyData.getHumidityArray().get(i), "%", "")), new BigDecimal(CharSequenceUtil.replace(dailyData.getHumidityArray().get(i), "%", "")),
String.valueOf(dateTime.year()), String.valueOf(dateTime.year()),
this.int2Str(dateTime.month() + 1), this.int2Str(dateTime.month() + 1),
this.int2Str(dateTime.dayOfMonth()), this.int2Str(dateTime.dayOfMonth())
BusinessConstant.START_OF_DAY_TIME
); );
// 5.执行SQL // 5.执行SQL
mapper.delete(new LambdaQueryWrapper<PlantPredictedPowerDataEnt>() mapper.delete(new LambdaQueryWrapper<PlantPredictedPowerDataEnt>()
...@@ -227,8 +226,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -227,8 +226,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
this.compute(dataEnt.getHumidity(), nextData.getHumidity(), valueOf), this.compute(dataEnt.getHumidity(), nextData.getHumidity(), valueOf),
String.valueOf(date.year()), String.valueOf(date.year()),
this.int2Str(date.month() + 1), this.int2Str(date.month() + 1),
this.int2Str(date.dayOfMonth()), this.int2Str(date.dayOfMonth())
BusinessConstant.START_OF_DAY_TIME
); );
// 5.执行SQL // 5.执行SQL
mapper.delete(new LambdaQueryWrapper<PlantPredictedPowerDataEnt>() mapper.delete(new LambdaQueryWrapper<PlantPredictedPowerDataEnt>()
...@@ -252,15 +250,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -252,15 +250,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
for (int y = 0; y < timeList.size(); y++) { for (int y = 0; y < timeList.size(); y++) {
PlantPredictedPowerDataEnt dao = XCopyUtils.copyNewObject(item); PlantPredictedPowerDataEnt dao = XCopyUtils.copyNewObject(item);
dao.setMinTime(timeList.get(y)); dao.setMinTime(timeList.get(y));
dao.setDataDate(new StringBuilder(dao.getYearTime()) dao.setDataDate(dao.getYearTime() + '-' + dao.getMonthTime() + '-' + dao.getDayTime() + ' ' + dao.getHourTime() + ':' + dao.getMinTime());
.append('-')
.append(dao.getMonthTime())
.append('-')
.append(dao.getDayTime())
.append(' ')
.append(dao.getHourTime())
.append(':')
.append(dao.getMinTime()).toString());
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));
dao.setTemperature(this.compute(Objects.isNull(item.getTemperature()) ? BigDecimal.ZERO : item.getTemperature(), dao.setTemperature(this.compute(Objects.isNull(item.getTemperature()) ? BigDecimal.ZERO : item.getTemperature(),
...@@ -324,11 +314,10 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -324,11 +314,10 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
* @param yearTime 年时间 * @param yearTime 年时间
* @param monthTime 月份时间 * @param monthTime 月份时间
* @param dayTime 白天 * @param dayTime 白天
* @param minTime 分钟
* @return {@link PlantPredictedPowerDataEnt} * @return {@link PlantPredictedPowerDataEnt}
*/ */
private PlantPredictedPowerDataEnt getPlantPredictedPowerEnt(String plantId, String hourTime, BigDecimal temperature, BigDecimal windSpeed, BigDecimal windDirection, private PlantPredictedPowerDataEnt getPlantPredictedPowerEnt(String plantId, String hourTime, BigDecimal temperature, BigDecimal windSpeed, BigDecimal windDirection,
BigDecimal pressure, BigDecimal humidity, String yearTime, String monthTime, String dayTime, String minTime) { BigDecimal pressure, BigDecimal humidity, String yearTime, String monthTime, String dayTime) {
PlantPredictedPowerDataEnt dao = new PlantPredictedPowerDataEnt(); PlantPredictedPowerDataEnt dao = new PlantPredictedPowerDataEnt();
dao.setCreateTime(new Date()); dao.setCreateTime(new Date());
dao.setPlantId(plantId); dao.setPlantId(plantId);
...@@ -341,16 +330,8 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -341,16 +330,8 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
dao.setYearTime(yearTime); dao.setYearTime(yearTime);
dao.setMonthTime(monthTime); dao.setMonthTime(monthTime);
dao.setDayTime(dayTime); dao.setDayTime(dayTime);
dao.setMinTime(minTime); dao.setMinTime(BusinessConstant.START_OF_DAY_TIME);
dao.setDataDate(dao.getYearTime() + dao.setDataDate(dao.getYearTime() + '-' + dao.getMonthTime() + '-' + dao.getDayTime() + ' ' + dao.getHourTime() + ':' + dao.getMinTime());
'-' +
dao.getMonthTime() +
'-' +
dao.getDayTime() +
' ' +
dao.getHourTime() +
':' +
dao.getMinTime());
return dao; return dao;
} }
...@@ -397,7 +378,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -397,7 +378,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
String disposition = mPart.getDisposition(); String disposition = mPart.getDisposition();
if (Part.ATTACHMENT.equals(disposition) || Part.INLINE.equals(disposition)) { if (Part.ATTACHMENT.equals(disposition) || Part.INLINE.equals(disposition)) {
fileName = mPart.getFileName(); fileName = mPart.getFileName();
if (CharSequenceUtil.isNotEmpty(fileName) && StringUtils.lowerCase(fileName).indexOf("GB2312") != -1) { if (CharSequenceUtil.isNotEmpty(fileName) && StringUtils.lowerCase(fileName).contains("GB2312")) {
fileName = MimeUtility.decodeText(fileName); fileName = MimeUtility.decodeText(fileName);
} }
fileName = CharSequenceUtil.replace(fileName, "\\?|=", ""); fileName = CharSequenceUtil.replace(fileName, "\\?|=", "");
...@@ -406,7 +387,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -406,7 +387,7 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
this.saveAttachment(mPart); this.saveAttachment(mPart);
} else { } else {
fileName = mPart.getFileName(); fileName = mPart.getFileName();
if (CharSequenceUtil.isNotEmpty(fileName) && (StringUtils.lowerCase(fileName).indexOf("GB2312") != -1)) { if (CharSequenceUtil.isNotEmpty(fileName) && StringUtils.lowerCase(fileName).contains("GB2312")) {
fileName = MimeUtility.decodeText(fileName); fileName = MimeUtility.decodeText(fileName);
filePath = this.saveTempFile(fileName, mPart.getInputStream()); filePath = this.saveTempFile(fileName, mPart.getInputStream());
} }
......
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