修改设备getRealTimeDataByDevicerId实时数据接口

This commit is contained in:
wyw 2024-09-10 20:19:21 +08:00
parent 5ae93c94d2
commit 81c0fd6bae

View File

@ -182,10 +182,14 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
if (deviceLogs1.size() > 0) { if (deviceLogs1.size() > 0) {
if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) { if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) {
if (deviceLogs1.size() > 1) { if (deviceLogs1.size() > 1) {
if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == Float.parseFloat(deviceLogs1.get(1).getLogValue())) { try{
hashMap.put("upType", 1); if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
} else if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) < Float.parseFloat(deviceLogs1.get(1).getLogValue())) { hashMap.put("upType", 1);
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 { } else {
hashMap.put("upType", 0); hashMap.put("upType", 0);
@ -247,7 +251,8 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
put("upType", 0); put("upType", 0);
put("identifier", "三菱FX2N_1_lock1Con"); put("identifier", "三菱FX2N_1_lock1Con");
put("unit", ""); 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", "内门上锁"); put("name", "内门上锁");
}}; }};
rMap.put("内门上锁", hashMap1); rMap.put("内门上锁", hashMap1);
@ -256,7 +261,8 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
put("upType", 0); put("upType", 0);
put("identifier", "三菱FX2N_1_lock2Con"); put("identifier", "三菱FX2N_1_lock2Con");
put("unit", ""); 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", "内门下锁"); put("name", "内门下锁");
}}; }};
rMap.put("内门下锁", hashMap1); rMap.put("内门下锁", hashMap1);