Browse Source

1、监视界面优化;

dev_gh_ers
3067418132@qq.com 3 weeks ago
parent
commit
441e1848ee
  1. 2
      mh-admin/src/main/java/com/mh/web/controller/device/ChillersParamsController.java
  2. 31
      mh-system/src/main/java/com/mh/system/service/device/impl/CoolingSystemMonitorServiceImpl.java

2
mh-admin/src/main/java/com/mh/web/controller/device/ChillersParamsController.java

@ -59,7 +59,7 @@ public class ChillersParamsController extends BaseController {
String otherName = item.getOtherName();
// 使用正则表达式去掉“号主机”及之前的内容
String result = otherName != null ? otherName.replaceFirst(".*号主机", "") : otherName;
result = result != null ? result.replace("-", "") : result;
result = result != null ? result.replace("_", "") : result;
item.setOtherName(result);
});
// list中的CollectionParamsManage对象赋值到CollectionParamsManageVO2形成List<CollectionParamsManageVO2>

31
mh-system/src/main/java/com/mh/system/service/device/impl/CoolingSystemMonitorServiceImpl.java

@ -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();
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()) {
// 遍历获取数据,其中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()) {
// 室外温度
int temperature = weatherData.getTemperature();
result.putIfAbsent("temperature", temperature + "");
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()) {
// 室外湿度
int humidity = weatherData.getHumidity();
result.putIfAbsent("humidity", humidity + "");
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";

Loading…
Cancel
Save