From 81c0fd6baecc83d3c4ba2ab78109bc384c14a13c Mon Sep 17 00:00:00 2001 From: wyw <373811525@qq.com> Date: Tue, 10 Sep 2024 20:19:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=BE=E5=A4=87getRealTime?= =?UTF-8?q?DataByDevicerId=E5=AE=9E=E6=97=B6=E6=95=B0=E6=8D=AE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/gis/impl/GisDeviceServiceImpl.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/fastbee-open-api/src/main/java/com/fastbee/data/service/gis/impl/GisDeviceServiceImpl.java b/fastbee-open-api/src/main/java/com/fastbee/data/service/gis/impl/GisDeviceServiceImpl.java index 08bd86f..5d06d58 100644 --- a/fastbee-open-api/src/main/java/com/fastbee/data/service/gis/impl/GisDeviceServiceImpl.java +++ b/fastbee-open-api/src/main/java/com/fastbee/data/service/gis/impl/GisDeviceServiceImpl.java @@ -182,10 +182,14 @@ public class GisDeviceServiceImpl implements IGisDeviceService { if (deviceLogs1.size() > 0) { if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) { if (deviceLogs1.size() > 1) { - if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == Float.parseFloat(deviceLogs1.get(1).getLogValue())) { - hashMap.put("upType", 1); - } else if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) < Float.parseFloat(deviceLogs1.get(1).getLogValue())) { - hashMap.put("upType", -1); + try{ + if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == Float.parseFloat(deviceLogs1.get(1).getLogValue())) { + hashMap.put("upType", 1); + } else if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) < Float.parseFloat(deviceLogs1.get(1).getLogValue())) { + hashMap.put("upType", -1); + } + }catch (Exception e){ + hashMap.put("upType", 0); } } else { hashMap.put("upType", 0); @@ -247,7 +251,8 @@ public class GisDeviceServiceImpl implements IGisDeviceService { put("upType", 0); put("identifier", "三菱FX2N_1_lock1Con"); put("unit", ""); - put("value", Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"正常":"异常"); + put("value", NumberUtils.isNumeric(haiWeiPropertyVo.getValue().toString())?( + Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"正常":"异常"):"正常"); put("name", "内门上锁"); }}; rMap.put("内门上锁", hashMap1); @@ -256,7 +261,8 @@ public class GisDeviceServiceImpl implements IGisDeviceService { put("upType", 0); put("identifier", "三菱FX2N_1_lock2Con"); put("unit", ""); - put("value", Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"正常":"异常"); + put("value", NumberUtils.isNumeric(haiWeiPropertyVo.getValue().toString())?( + Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 1f?"正常":"异常"):"正常"); put("name", "内门下锁"); }}; rMap.put("内门下锁", hashMap1);