From 42f9c8cf31cc8a694c6478b12c832c1991bf35b7 Mon Sep 17 00:00:00 2001
From: jinpengyong <jpy123456>
Date: Mon, 21 Aug 2023 15:58:10 +0800
Subject: [PATCH] chore:测试提交
---
screen-api/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java | 12 +++++++++---
1 files changed, 9 insertions(+), 3 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 f49fa12..0a1b3c9 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
@@ -295,7 +295,7 @@
}
middleDate = DateUtils.addDays(middleDate,1);
}
- } else if ("monthly".equals(type)){
+ } else if ("month".equals(type)){
end = DateUtils.getDateAddMonth(endTime, 1);
timeUnits = "monthly";
dateFormat = "%Y-%m";
@@ -349,8 +349,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