|
|
|
|
@ -278,16 +278,33 @@ public class CoolingSystemMonitorServiceImpl implements ICoolingSystemMonitorSer
|
|
|
|
|
public Map<String, String> getWeatherData() { |
|
|
|
|
Map<String, String> result = new HashMap<>(); |
|
|
|
|
// 查询跟当前时间yyyy-MM-dd HH相同的数据
|
|
|
|
|
WeatherData weatherData = weatherDataMapper.selectWeatherDataByDate(DateUtils.getTime()); |
|
|
|
|
if (weatherData != null) { |
|
|
|
|
WeatherUtil weatherUtil = new WeatherUtil(); |
|
|
|
|
// 室外温度
|
|
|
|
|
int temperature = weatherData.getTemperature(); |
|
|
|
|
result.putIfAbsent("temperature", temperature + ""); |
|
|
|
|
Date now = new Date(); |
|
|
|
|
Date startOfDay = DateUtils.getStartOfDay(now); |
|
|
|
|
Date endOfDay = DateUtils.getEndOfDay(now); |
|
|
|
|
// 查询跟当前时间yyyy-MM-dd HH相同的数据
|
|
|
|
|
List<CollectionParamsManage> collectionParamsManages = collectionParamsManageMapper.selectList( |
|
|
|
|
new QueryWrapper<CollectionParamsManage>() |
|
|
|
|
.in("mt_num", Arrays.asList("DB200000", "DB200040")) |
|
|
|
|
.between("cur_time", startOfDay, endOfDay)); |
|
|
|
|
if (collectionParamsManages != null && !collectionParamsManages.isEmpty()) { |
|
|
|
|
|
|
|
|
|
// 室外湿度
|
|
|
|
|
int humidity = weatherData.getHumidity(); |
|
|
|
|
result.putIfAbsent("humidity", humidity + ""); |
|
|
|
|
// 遍历获取数据,其中mt_num为DB200000是室外温度,mt_num为DB200040是室外湿度
|
|
|
|
|
Optional<CollectionParamsManage> first = collectionParamsManages.stream().filter(value -> "DB200000".equals(value.getMtNum())).findFirst(); |
|
|
|
|
double temperature = 0.00; |
|
|
|
|
if (first.isPresent()) { |
|
|
|
|
// 室外温度
|
|
|
|
|
temperature = first.get().getCurValue().doubleValue(); |
|
|
|
|
result.putIfAbsent("temperature", first.get().getCurValue().setScale(1, RoundingMode.HALF_UP) + ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Optional<CollectionParamsManage> second = collectionParamsManages.stream().filter(value -> "DB200040".equals(value.getMtNum())).findFirst(); |
|
|
|
|
double humidity = 0.00; |
|
|
|
|
if (second.isPresent()) { |
|
|
|
|
// 室外湿度
|
|
|
|
|
humidity = second.get().getCurValue().doubleValue(); |
|
|
|
|
result.putIfAbsent("humidity", second.get().getCurValue().setScale(1, RoundingMode.HALF_UP) + ""); |
|
|
|
|
} |
|
|
|
|
WeatherUtil weatherUtil = new WeatherUtil(); |
|
|
|
|
|
|
|
|
|
// 室外压力,采用标准大气压 101325 Pa
|
|
|
|
|
String pressure = "101.325"; |
|
|
|
|
|