From 6dc7dc3670300ec7949f8134ab80166107b2f705 Mon Sep 17 00:00:00 2001
From: cjl <276999030@qq.com>
Date: Wed, 30 Aug 2023 09:30:36 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/cjl' into qa
---
screen-api/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/screen-api/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java b/screen-api/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java
index 74d4260..bd62813 100644
--- a/screen-api/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java
+++ b/screen-api/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java
@@ -359,8 +359,14 @@
Map<String,Object> historyHourlyMap = new HashMap<>();
historyHourlyMap.put("mac",mac);
JSONObject value = JSONObject.parseObject(historyFiveMinutely.getValue());
- Double sensorValue = Double.parseDouble(value.get(sensorCode).toString());
- historyHourlyMap.put(sensorCode,sensorValue);
+ if (value.get(sensorCode)==null){
+ historyHourlyMap.put(sensorCode,0.0);
+ }else {
+ Double sensorValue = Double.parseDouble(value.get(sensorCode).toString());
+ historyHourlyMap.put(sensorCode,sensorValue);
+ }
+// Double sensorValue = Double.parseDouble(value.get(sensorCode).toString());
+// historyHourlyMap.put(sensorCode,sensorValue);
Date time = historyFiveMinutely.getTime();
String timeStr = DateUtils.dateToDateString(time, DateUtils.yyyy_MM_dd_HH_mm_ss_EN);
historyHourlyMap.put("time",timeStr);
--
Gitblit v1.8.0