Commit 4918950d authored by ZWT's avatar ZWT

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

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

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 66b5aa86
...@@ -96,12 +96,27 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -96,12 +96,27 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
return null; return null;
} }
//按照cityCode分组 //按照cityCode分组
Map<String, List<BasePhotovoltaicPlantView>> collect = plantList.stream() Map<String, List<BasePhotovoltaicPlantView>> plantMap = plantList.stream()
.collect(Collectors.groupingBy(BasePhotovoltaicPlantView::getCityCode)); .collect(Collectors.groupingBy(BasePhotovoltaicPlantView::getCityCode));
//读取附件 //读取附件
for (Message message : messageList) { // for (Message message : messageList) {
String tempFilePath = this.saveAttachment(message); // String tempFilePath = this.saveAttachment(message);
FileReader fileReader = new FileReader(tempFilePath); // FileReader fileReader = new FileReader(tempFilePath);
// String jsonString = fileReader.readString();
// JSONObject jsonObject = JSONObject.parseObject(jsonString);
// 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));
// }
// }
//
//
// FileUtil.del(tempFilePath);
// }
FileReader fileReader = new FileReader("D:\\home\\weather\\temp\\receive\\20231114\\1699943400000.json");
String jsonString = fileReader.readString(); String jsonString = fileReader.readString();
JSONObject jsonObject = JSONObject.parseObject(jsonString); JSONObject jsonObject = JSONObject.parseObject(jsonString);
Map<String, List<DailyData>> cityDataMap = new HashMap<>(16); Map<String, List<DailyData>> cityDataMap = new HashMap<>(16);
...@@ -112,15 +127,27 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService { ...@@ -112,15 +127,27 @@ public class BaseWeatherCloudServiceImpl implements IBaseWeatherCloudService {
cityDataMap.put(key, ((JSONArray) value).toJavaList(DailyData.class)); cityDataMap.put(key, ((JSONArray) value).toJavaList(DailyData.class));
} }
} }
for (String cityCode : cityDataMap.keySet()) {
if (!plantMap.containsKey(cityCode)) {
continue;
}
List<DailyData> dailyDataList = cityDataMap.get(cityCode);
List<BasePhotovoltaicPlantView> plantViewList = plantMap.get(cityCode);
//遍历预测数据列表
for (DailyData dailyData : dailyDataList) {
Date dateTime = dailyData.getDateTime();
for (BasePhotovoltaicPlantView plant : plantViewList) {
for (int i = 0; i < 8; i++) {
}
}
FileUtil.del(tempFilePath); }
} }
} }
} catch (MessagingException e) { } catch (MessagingException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
} finally { } finally {
IoUtil.close(folder); IoUtil.close(folder);
IoUtil.close(store); IoUtil.close(store);
......
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