Browse Source

能耗修改2.0

wwh 2 years ago
parent
commit
a57fb47f0e

+ 3 - 3
huimv-admin/src/main/java/com/huimv/admin/controller/ProtThresholdController.java

@@ -43,9 +43,9 @@ public class ProtThresholdController {
         ProtThreshold protThreshold = protThresholdVo.getIn().setFarmId(Integer.parseInt(farmId));
         ProtThreshold protThreshold1 = protThresholdVo.getDeal().setFarmId(Integer.parseInt(farmId));
         ProtThreshold protThreshold2 = protThresholdVo.getOut().setFarmId(Integer.parseInt(farmId));
-        protThreshold.setProtType(1);
-        protThreshold1.setProtType(2);
-        protThreshold2.setProtType(3);
+         protThreshold.setProtType(1);
+         protThreshold1.setProtType(2);
+         protThreshold2.setProtType(3);
         List<ProtThreshold> protThresholdList = new LinkedList<>();
         protThresholdList.add(protThreshold);
         protThresholdList.add(protThreshold1);

+ 1 - 1
huimv-admin/src/main/java/com/huimv/admin/service/impl/ProtThresholdServiceImpl.java

@@ -97,7 +97,7 @@ public class ProtThresholdServiceImpl extends ServiceImpl<ProtThresholdMapper, P
                 Integer farmId = protThreshold.getFarmId();
                 String userIds = protThreshold.getUserIds();
                 QueryWrapper<ProtThreshold> queryWrapper = new QueryWrapper<>();
-                queryWrapper.eq("farm_id", protThreshold.getFarmId()).eq("prot_type",protThreshold.getProtType());
+                 queryWrapper.eq("farm_id", protThreshold.getFarmId()).eq("prot_type",protThreshold.getProtType());
                 ProtThreshold threshold = protThresholdMapper.selectOne(queryWrapper);
                 //去掉属于该人物的id
                 Integer userId = TokenSign.getMemberIdByJwtToken(httpServletRequest);

+ 27 - 14
huimv-admin/src/main/java/com/huimv/admin/timer/ProtTimer.java

@@ -60,7 +60,7 @@ public class ProtTimer {
             protDataMapper.insert(protData);
 
             QueryWrapper<ProtThreshold> queryWrapper = new QueryWrapper<>();
-            if (i==1) {
+            if (i == 1) {
                 queryWrapper.eq("farm_id", 21).eq("prot_type", 1);
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
                 if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2())) {
@@ -184,7 +184,8 @@ public class ProtTimer {
                     protWarningInfo.setBuildLocation("进污口");
                     warningInfoMapper.insert(protWarningInfo);
                 }
-            } else if (i==2) {
+            }
+            if (i == 2) {
                 queryWrapper.eq("farm_id", 21).eq("prot_type", 2);
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//污口
                 if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2())) {
@@ -198,7 +199,8 @@ public class ProtTimer {
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("处理口");
                     warningInfoMapper.insert(protWarningInfo);
-                } else if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1())) {
+                }
+                if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口ph值为" + num + "达到橙色预警");
                     protWarningInfo.setWarningType(1);
@@ -209,7 +211,8 @@ public class ProtTimer {
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("处理口");
                     warningInfoMapper.insert(protWarningInfo);
-                } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod2())) {
+                }
+                if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod2())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口cod值为" + num1 + "达到红色预警");
                     protWarningInfo.setWarningType(0);
@@ -220,7 +223,8 @@ public class ProtTimer {
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("处理口");
                     warningInfoMapper.insert(protWarningInfo);
-                } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod1())) {
+                }
+                if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod1())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口cod值为" + num1 + "达到橙色预警");
                     protWarningInfo.setWarningType(0);
@@ -231,7 +235,8 @@ public class ProtTimer {
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("处理口");
                     warningInfoMapper.insert(protWarningInfo);
-                } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n2())) {
+                }
+                if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n2())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口NH3N值为" + num2 + "达到红色预警");
                     protWarningInfo.setWarningType(2);
@@ -242,7 +247,8 @@ public class ProtTimer {
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("处理口");
                     warningInfoMapper.insert(protWarningInfo);
-                } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n1())) {
+                }
+                if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n1())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口NH3N值为" + num2 + "达到橙色预警");
                     protWarningInfo.setWarningType(2);
@@ -253,7 +259,8 @@ public class ProtTimer {
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("处理口");
                     warningInfoMapper.insert(protWarningInfo);
-                } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp2())) {
+                }
+                if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp2())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口TP值为" + num3 + "达到红色预警");
                     protWarningInfo.setWarningType(3);
@@ -264,7 +271,8 @@ public class ProtTimer {
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("处理口");
                     warningInfoMapper.insert(protWarningInfo);
-                } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp1())) {
+                }
+                if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp1())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口TP值为" + num3 + "达到橙色预警");
                     protWarningInfo.setWarningType(3);
@@ -275,7 +283,8 @@ public class ProtTimer {
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("处理口");
                     warningInfoMapper.insert(protWarningInfo);
-                } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn2())) {
+                }
+                if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn2())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口TN值为" + num4 + "达到红色预警");
                     protWarningInfo.setWarningType(4);
@@ -286,7 +295,8 @@ public class ProtTimer {
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("处理口");
                     warningInfoMapper.insert(protWarningInfo);
-                } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn1())) {
+                }
+                if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn1())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口TN值为" + num4 + "达到橙色预警");
                     protWarningInfo.setWarningType(4);
@@ -297,7 +307,8 @@ public class ProtTimer {
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("处理口");
                     warningInfoMapper.insert(protWarningInfo);
-                } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow2())) {
+                }
+                if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow2())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口累计流量值为" + num5 + "达到红色预警");
                     protWarningInfo.setWarningType(5);
@@ -308,7 +319,8 @@ public class ProtTimer {
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("处理口");
                     warningInfoMapper.insert(protWarningInfo);
-                } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow1())) {
+                }
+                if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow1())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口累计流量值为" + num5 + "达到橙色预警");
                     protWarningInfo.setWarningType(5);
@@ -321,7 +333,8 @@ public class ProtTimer {
                     warningInfoMapper.insert(protWarningInfo);
                 }
 
-            } else if (i==3) {
+            }
+            if (i == 3) {
                 queryWrapper.eq("farm_id", 21).eq("prot_type", 3);
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
                 if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2())) {