Browse Source

水质修改

wangyangyang 4 years ago
parent
commit
77baae55bc

+ 28 - 1
sms_water/src/main/java/com/huaxu/service/SecSupplyService.java

@@ -195,6 +195,7 @@ public class SecSupplyService {
         waterPieDto.setWaterQuality(waterPieStateDto4);
 
 
+
         List<ParmTypeCountDto> list = deviceParmService.findAlarmCount(deviceParmEntity);
         //余氯11 浊度9  PH8  cod 15   15,8,9,11,18,19
         for(ParmTypeCountDto item : list)
@@ -209,7 +210,7 @@ public class SecSupplyService {
                     waterPieStateDto1.setPercentage((double) (Math.round((Double.valueOf(listTotal.get(0).getTotalCount()- item.getNbnormalCount())/Double.valueOf(listTotal.get(0).getTotalCount()))*100)));
                     waterPieDto.setPh(waterPieStateDto1);
                     break;
-                case 9:
+                case 10:
                     WaterPieStateDto waterPieStateDto2 = new WaterPieStateDto();
                     waterPieStateDto2.setNormalCount(listTotal.get(0).getTotalCount()- item.getNbnormalCount());
                     waterPieStateDto2.setNbnormalCount(item.getNbnormalCount());
@@ -227,6 +228,32 @@ public class SecSupplyService {
             }
         }
 
+        if(waterPieDto.getPh()==null)
+        {
+            WaterPieStateDto waterPieStateDto1 = new WaterPieStateDto();
+            waterPieStateDto1.setNormalCount(listTotal.get(0).getTotalCount());
+            waterPieStateDto1.setNbnormalCount(0);
+            DecimalFormat df1 = new DecimalFormat("#.00");
+            waterPieStateDto1.setPercentage((double) (Math.round((Double.valueOf(listTotal.get(0).getTotalCount())/Double.valueOf(listTotal.get(0).getTotalCount()))*100)));
+            waterPieDto.setPh(waterPieStateDto1);
+        }
+        if(waterPieDto.getTurbidity()==null)
+        {
+            WaterPieStateDto waterPieStateDto2 = new WaterPieStateDto();
+            waterPieStateDto2.setNormalCount(listTotal.get(0).getTotalCount());
+            waterPieStateDto2.setNbnormalCount(0);
+            DecimalFormat df2 = new DecimalFormat("#.00");
+            waterPieStateDto2.setPercentage((double) (Math.round((Double.valueOf(listTotal.get(0).getTotalCount())/Double.valueOf(listTotal.get(0).getTotalCount()))*100)));
+            waterPieDto.setTurbidity(waterPieStateDto2);
+        }
+        if(waterPieDto.getResidualChlorine()==null)
+        {
+            WaterPieStateDto waterPieStateDto3 = new WaterPieStateDto();
+            waterPieStateDto3.setNormalCount(listTotal.get(0).getTotalCount());
+            waterPieStateDto3.setNbnormalCount(0);
+            waterPieStateDto3.setPercentage((double) (Math.round((Double.valueOf(listTotal.get(0).getTotalCount())/Double.valueOf(listTotal.get(0).getTotalCount()))*100)));
+            waterPieDto.setResidualChlorine(waterPieStateDto3);
+        }
         return waterPieDto;
     }
 }

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

@@ -255,12 +255,12 @@
         </foreach>
     </select>
     <select id="findAlarmCount" resultType="com.huaxu.dto.ParmTypeCountDto">
-        select tab.parmType,sum(tab.nbnormalCount) as "nbnormalCount" from(
+        select tab.parmType,sum(ifnull(tab.nbnormalCount,0)) as "nbnormalCount" from(
         select  b.PARENT_SCENE_ID,b.PARM_TYPE as "parmType",
         case when count(c.id)>0 then 1 else 0 end  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 (15,8,9,11,18,19) and b.`STATUS`=1
+               and a.PARENT_SCENE_ID=b.PARENT_SCENE_ID and b.PARM_TYPE in (15,8,10,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