Browse Source

设备参数修改

wangyangyang 4 years ago
parent
commit
0e3ade1f92

+ 10 - 8
sms_water/src/main/java/com/huaxu/service/SecSupplyService.java

@@ -190,9 +190,13 @@ public class SecSupplyService {
         DeviceParmEntity deviceParmEntity = new DeviceParmEntity();
         deviceParmEntity.setSceneEntities(sceneEntities);
         List<ParmTypeCountDto> list = deviceParmService.findAlarmCount(deviceParmEntity);
-        //余氯11 浊度9  PH7  cod 15
+        //余氯11 浊度9  PH7  cod 15   15,7,9,11,18,19
+        Integer totalCount = 0;
+        Integer nbNormalCount = 0;
         for(ParmTypeCountDto item : list)
         {
+            totalCount +=item.getTotalCount();
+            nbNormalCount+=item.getNbnormalCount();
             switch(item.getParmType())
             {
                 case 7:
@@ -218,15 +222,13 @@ public class SecSupplyService {
                     waterPieStateDto3.setPercentage((double) (Math.round((Double.valueOf(item.getTotalCount()- item.getNbnormalCount())/Double.valueOf(item.getTotalCount()))*100)));
                     waterPieDto.setResidualChlorine(waterPieStateDto3);
                     break;
-                case 15:
-                    WaterPieStateDto waterPieStateDto4 = new WaterPieStateDto();
-                    waterPieStateDto4.setNormalCount(item.getTotalCount()- item.getNbnormalCount());
-                    waterPieStateDto4.setNbnormalCount(item.getNbnormalCount());
-                    waterPieStateDto4.setPercentage((double) (Math.round((Double.valueOf(item.getTotalCount()- item.getNbnormalCount())/Double.valueOf(item.getTotalCount()))*100)));
-                    waterPieDto.setWaterQuality(waterPieStateDto4);
-                    break;
             }
         }
+        WaterPieStateDto waterPieStateDto4 = new WaterPieStateDto();
+        waterPieStateDto4.setNormalCount(totalCount- nbNormalCount);
+        waterPieStateDto4.setNbnormalCount(nbNormalCount);
+        waterPieStateDto4.setPercentage((double) (Math.round((Double.valueOf(totalCount- nbNormalCount)/Double.valueOf(totalCount))*100)));
+        waterPieDto.setWaterQuality(waterPieStateDto4);
         return waterPieDto;
     }
 }

+ 1 - 1
sms_water/src/main/resources/mapper/DeviceParmMapper.xml

@@ -253,7 +253,7 @@
         select b.PARM_TYPE as "parmType",count(a.DEVICE_ID) as "totalCount",count(c.id) as "nbnormalCount"
         from sms_device_scene a
         INNER JOIN sms_device_parm b on a.DEVICE_ID=b.DEVICE_ID
-               and a.PARENT_SCENE_ID=b.PARENT_SCENE_ID and b.PARM_TYPE in (7,9,11,15) and b.`STATUS`=1
+               and a.PARENT_SCENE_ID=b.PARENT_SCENE_ID and b.PARM_TYPE in (15,7,9,11,18,19) and b.`STATUS`=1
         LEFT JOIN  sms_alarm_details c on c.PARENT_SCENE_ID=b.PARENT_SCENE_ID
                and c.ATTRIBUTE_ID=b.ATTRIBUTE_ID and c.STATE=1
         where a.PARENT_SCENE_ID in

+ 1 - 1
sms_water/src/main/resources/mapper/MonitorDataReportMapper.xml

@@ -632,7 +632,7 @@
     left join sms_scene s on s.SCENE_TYPE_ID =st.id
     left join sms_device_scene ds on ds.SCENE_ID=s.ID
     left join sms_device d on d.id=ds.DEVICE_ID
-    where st.SCENE_TYPE_NAME=#{sceneTypeName} and d.`STATUS`= 1 and  d.ENABLE_STATE = 1
+    where st.SCENE_TYPE_NAME=#{sceneTypeName} and d.`STATUS`= 1 and  d.ENABLE_STATE = 1 and  ds.status=1
     <if test="tenantId != null and tenantId != '' ">
         and d.tenant_id = #{tenantId}
     </if>