Browse Source

设备运行监控

lipenghui 5 ngày trước cách đây
mục cha
commit
242cf2276d

+ 20 - 15
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/IotDeviceServiceImpl.java

@@ -310,24 +310,29 @@ public class IotDeviceServiceImpl implements IotDeviceService {
         List<String> identifiers = rows.stream().map(ThingsModelDTO::getIdentifier).collect(Collectors.toList());
         //有数采
         List<String> carCodes = zhbdmapper.carList().stream().map(DeviceZHBDDO::getDeviceCode).collect(Collectors.toList());
-        if (!identifiers.contains(zhbds.get(2))||!identifiers.contains(zhbds.get(4))&&carCodes.contains(iotDeviceDO.getDeviceCode())) {
+        if (carCodes.contains(iotDeviceDO.getDeviceCode())) {
             for (String s : split1) {
                 String[] split = s.split("~~");
-                Object o = redisTemplate.opsForHash().get("TSLV:" + iotDeviceDO.getDeviceCode(), split[0]);
-                if (Objects.nonNull(o)) {
-                    JSONObject jsonObject = JSON.parseObject(o.toString());
-                    ThingsModelDTO modelDTO = new ThingsModelDTO();
-                    modelDTO.setIdentifier(split[0]);
-                    modelDTO.setModelName(split[1]);
-                    if ("online".equals(split[0])){
-                        String value = String.valueOf(jsonObject.get("value"));
-                        modelDTO.setValue("true".equals(value)?"是":"否");
-                    } else {
-                        String value = String.valueOf(jsonObject.get("value"));
-                        modelDTO.setValue(value);
-                    }
-                    rows.add(modelDTO);
+//                if (!identifiers.contains(zhbds.get(2))||!identifiers.contains(zhbds.get(4))){
+                if (split[0].equals(zhbds.get(2))) {
+
                 }
+                    Object o = redisTemplate.opsForHash().get("TSLV:" + iotDeviceDO.getDeviceCode(), split[0]);
+                    if (Objects.nonNull(o)) {
+                        JSONObject jsonObject = JSON.parseObject(o.toString());
+                        ThingsModelDTO modelDTO = new ThingsModelDTO();
+                        modelDTO.setIdentifier(split[0]);
+                        modelDTO.setModelName(split[1]);
+                        if ("online".equals(split[0])){
+                            String value = String.valueOf(jsonObject.get("value"));
+                            modelDTO.setValue("true".equals(value)?"是":"否");
+                        } else {
+                            String value = String.valueOf(jsonObject.get("value"));
+                            modelDTO.setValue(value);
+                        }
+                        rows.add(modelDTO);
+                    }
+//                }
             }
         } else {
             rows.forEach(e ->{