From 6bc5d130aa5b30aa6ea32f6c53bebe6fb9dc05f7 Mon Sep 17 00:00:00 2001
From: lizijie <lzjiiie@163.com>
Date: Wed, 16 Dec 2020 09:21:32 +0800
Subject: [PATCH] 热力图
---
src/main/java/com/moral/service/impl/HistoryServiceImpl.java | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/moral/service/impl/HistoryServiceImpl.java b/src/main/java/com/moral/service/impl/HistoryServiceImpl.java
index 8007e0a..08137c7 100644
--- a/src/main/java/com/moral/service/impl/HistoryServiceImpl.java
+++ b/src/main/java/com/moral/service/impl/HistoryServiceImpl.java
@@ -406,14 +406,17 @@
String timeUnits = startTime.substring(0, 10).replace("-", "");
Map<String, Object> map = historyMapper.getAVGValueByMacAndTimeslot(mac, startTime, endTime, timeUnits);
Map<String, Object> returnMap = new HashMap<>();
- if (map.isEmpty()) {
- returnMap.put("AQI", "N/V");
+ if (ObjectUtils.isEmpty(map) || map.isEmpty()) {
+ returnMap.put("AQI", "N/V");
+ return returnMap;
} else {
Map<String, Double> AQIMap = new HashMap<>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
String key = entry.getKey();
- Double value = Double.parseDouble(entry.getValue().toString());
- AQIMap.put(key, value);
+ if (entry.getValue() != null) {
+ Double value = Double.parseDouble(entry.getValue().toString());
+ AQIMap.put(key, value);
+ }
}
returnMap = AQICalculation.hourlyAQI(AQIMap);
}
--
Gitblit v1.8.0