From e20989d3c8f87c1831e608999c4c859cf4970012 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Fri, 11 Dec 2020 17:29:59 +0800
Subject: [PATCH] update

---
 src/main/java/com/moral/service/impl/HistoryServiceImpl.java |    8 +++++---
 1 files changed, 5 insertions(+), 3 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..40556d1 100644
--- a/src/main/java/com/moral/service/impl/HistoryServiceImpl.java
+++ b/src/main/java/com/moral/service/impl/HistoryServiceImpl.java
@@ -406,14 +406,16 @@
         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()) {
+        if (ObjectUtils.isEmpty(map) || map.isEmpty()) {
             returnMap.put("AQI", "N/V");
         } 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