wangyangyang преди 4 години
родител
ревизия
205a693e12
променени са 1 файла, в които са добавени 19 реда и са изтрити 20 реда
  1. 19 20
      sms_water/src/main/java/com/huaxu/controller/MonitorInfoController.java

+ 19 - 20
sms_water/src/main/java/com/huaxu/controller/MonitorInfoController.java

@@ -120,7 +120,7 @@ public class MonitorInfoController {
         if (imageType != null) {
             monitorInfoEntity.setImageType(imageType);
         }
-        if(type!=null&&type.length>0) {
+        if (type != null && type.length > 0) {
             monitorInfoEntity.setType(type[0]);
         }
         if (deviceId != null) {
@@ -151,25 +151,24 @@ public class MonitorInfoController {
                         DeviceAttributeSpecsEntity deviceAttributeSpecsEntity = new DeviceAttributeSpecsEntity();
                         deviceAttributeSpecsEntity.setAttributeId(item.getAttributeId());
                         List<DeviceAttributeSpecsEntity> deviceAttributeSpecsEntities = deviceAttributeSpecsService.findList(deviceAttributeSpecsEntity);
-                       if(map.containsKey(item.getAttributeId())) {
-                           Double value = map.get(item.getAttributeId()).getDataValue();
-                           if (deviceAttributeSpecsEntities.size() > 0) {
-                               if (value != null) {
-                                   for (DeviceAttributeSpecsEntity specsEntity : deviceAttributeSpecsEntities)
-                                       if (Integer.valueOf(specsEntity.getSpecsValue()) == value.intValue()) {
-                                           item.setMonitorValue(specsEntity.getSpecsName());
-                                       }
-                               }
-                           } else {
-                               if (value != null) {
-                                   DeviceAttributeEntity deviceAttributeEntity = deviceAttributeService.getById(item.getAttributeId());
-                                   String unit = "";
-                                   if (deviceAttributeEntity != null && deviceAttributeEntity.getUnit() != null)
-                                       unit = deviceAttributeEntity.getUnit();
-                                   item.setMonitorValue(String.format("%.3f", map.get(item.getAttributeId()).getDataValue()) + unit);
-                               }
-                           }
-                       }
+                        if (map.containsKey(item.getAttributeId())) {
+                            Double value = map.get(item.getAttributeId()).getDataValue();
+                            if (value != null) {
+                                if (deviceAttributeSpecsEntities.size() > 0) {
+                                    for (DeviceAttributeSpecsEntity specsEntity : deviceAttributeSpecsEntities)
+                                        if (Integer.valueOf(specsEntity.getSpecsValue()) == value.intValue()) {
+                                            item.setMonitorValue(specsEntity.getSpecsName());
+                                        }
+
+                                } else {
+                                    DeviceAttributeEntity deviceAttributeEntity = deviceAttributeService.getById(item.getAttributeId());
+                                    String unit = "";
+                                    if (deviceAttributeEntity != null && deviceAttributeEntity.getUnit() != null)
+                                        unit = deviceAttributeEntity.getUnit();
+                                    item.setMonitorValue(String.format("%.3f", map.get(item.getAttributeId()).getDataValue()) + unit);
+                                }
+                            }
+                        }
                         //判断是否报警
                         if (mapAlarm.containsKey(item.getAttributeId().intValue()))
                             item.setIsAlarm(1);