wwh 2 anni fa
parent
commit
46fff42efb

+ 202 - 197
huimv-admin/src/main/java/com/huimv/admin/timer/GasTimer.java

@@ -27,7 +27,7 @@ public class GasTimer {
     @Autowired
     private GasThresholdMapper thresholdMapper;
 
-    @Scheduled(cron = "0 0/10 * * * ? ")
+    @Scheduled(cron = "0 0 */1 * * ? ")
     private void getShenChan() throws Exception {
 
         String type = NumberUtils.getNum(1, 5, 0);//loc_type
@@ -41,207 +41,212 @@ public class GasTimer {
         String sja = NumberUtils.getNum(10, 20, 1);//sja
         String cq = NumberUtils.getNum(10, 20, 1);//cq
 
-        GasData gasData = new GasData();
-        gasData.setLoctionType(Integer.parseInt(type));
-        gasData.setNh3N(nh3n);
-        gasData.setJlm(jlm);
-        gasData.setElht(elht);
-        gasData.setEjel(ejel);
-        gasData.setH2s(h2s);
-        gasData.setByx(byx);
-        gasData.setCh3sh(ch3);
-        gasData.setSja(sja);
-        gasData.setCq(cq);
-        gasData.setFarmId(21);
-        gasData.setCreateTime(new Date());
-        gasDataMapper.insert(gasData);
-
-        GasWarningInfo warningInfo = new GasWarningInfo();
 
-        QueryWrapper<GasThreshold> queryWrapper = new QueryWrapper<>();
-        if ("1".equals(type)) {
-            queryWrapper.eq("farm_id", 21).eq("gas_type", 1);
-            GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
-            if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
-                warningInfo.setWarningContent(nh3n + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(0);
-            }
-            if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
-                warningInfo.setWarningContent(jlm + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(1);
-            }
-            if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
-                warningInfo.setWarningContent(elht + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(2);
-            }
-            if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
-                warningInfo.setWarningContent(ejel + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(3);
-            }
-            if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
-                warningInfo.setWarningContent(h2s + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(4);
-            }
-            if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
-                warningInfo.setWarningContent(byx + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(5);
-            }
-            if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
-                warningInfo.setWarningContent(ch3 + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(6);
-            }
-            if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
-                warningInfo.setWarningContent(sja + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(7);
-            }
-            if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
-                warningInfo.setWarningContent(cq + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(8);
-            }
-
-            warningInfo.setBuildLocation("屋顶");
-            warningInfo.setDate(new Date());
-            warningInfo.setFarmId(gasThreshold.getFarmId());
-            warningInfo.setUserIds(gasThreshold.getUserIds());
-            warningInfoMapper.insert(warningInfo);
-
-        } else if ("2".equals(type)) {
-            queryWrapper.eq("farm_id", 21).eq("gas_type", 2);
-            GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
-            if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
-                warningInfo.setWarningContent(nh3n + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(0);
-            }
-            if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
-                warningInfo.setWarningContent(jlm + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(1);
-            }
-            if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
-                warningInfo.setWarningContent(elht + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(2);
-            }
-            if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
-                warningInfo.setWarningContent(ejel + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(3);
-            }
-            if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
-                warningInfo.setWarningContent(h2s + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(4);
-
-            }
-            if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
-                warningInfo.setWarningContent(byx + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(5);
-            }
-            if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
-                warningInfo.setWarningContent(ch3 + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(6);
-            }
-            if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
-                warningInfo.setWarningContent(sja + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(7);
-            }
-            if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
-                warningInfo.setWarningContent(cq + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(8);
-            }
 
-            warningInfo.setBuildLocation("厂界上");
-            warningInfo.setDate(new Date());
-            warningInfo.setFarmId(gasThreshold.getFarmId());
-            warningInfo.setUserIds(gasThreshold.getUserIds());
-            warningInfoMapper.insert(warningInfo);
-        } else if ("3".equals(type)) {
-            queryWrapper.eq("farm_id", 21).eq("gas_type", 3);
-            GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
-            if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
-                warningInfo.setWarningContent(nh3n + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(0);
-            }
-            if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
-                warningInfo.setWarningContent(jlm + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(1);
-            }
-            if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
-                warningInfo.setWarningContent(elht + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(2);
-            }
-            if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
-                warningInfo.setWarningContent(ejel + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(3);
-            }
-            if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
-                warningInfo.setWarningContent(h2s + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(4);
 
-            }
-            if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
-                warningInfo.setWarningContent(byx + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(5);
-            }
-            if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
-                warningInfo.setWarningContent(ch3 + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(6);
-            }
-            if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
-                warningInfo.setWarningContent(sja + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(7);
-            }
-            if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
-                warningInfo.setWarningContent(cq + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(8);
-            }
 
-            warningInfo.setBuildLocation("厂界下");
-            warningInfo.setDate(new Date());
-            warningInfo.setFarmId(gasThreshold.getFarmId());
-            warningInfo.setUserIds(gasThreshold.getUserIds());
-            warningInfoMapper.insert(warningInfo);
-        } else if ("4".equals(type)) {
-            queryWrapper.eq("farm_id", 21).eq("gas_type", 4);
-            GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
-            if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
-                warningInfo.setWarningContent(nh3n + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(0);
-            }
-            if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
-                warningInfo.setWarningContent(jlm + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(1);
-            }
-            if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
-                warningInfo.setWarningContent(elht + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(2);
-            }
-            if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
-                warningInfo.setWarningContent(ejel + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(3);
-            }
-            if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
-                warningInfo.setWarningContent(h2s + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(4);
-            }
-            if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
-                warningInfo.setWarningContent(byx + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(5);
-            }
-            if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
-                warningInfo.setWarningContent(ch3 + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(6);
-            }
-            if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
-                warningInfo.setWarningContent(sja + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(7);
-            }
-            if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
-                warningInfo.setWarningContent(cq + "超过阈值,系统预警提醒");
-                warningInfo.setWarningType(8);
+        QueryWrapper<GasThreshold> queryWrapper = new QueryWrapper<>();
+        for (int i = 1; i < 5; i++) {
+            GasData gasData = new GasData();
+            gasData.setLoctionType(i);
+            gasData.setNh3N(nh3n);
+            gasData.setJlm(jlm);
+            gasData.setElht(elht);
+            gasData.setEjel(ejel);
+            gasData.setH2s(h2s);
+            gasData.setByx(byx);
+            gasData.setCh3sh(ch3);
+            gasData.setSja(sja);
+            gasData.setCq(cq);
+            gasData.setFarmId(21);
+            gasData.setCreateTime(new Date());
+            gasDataMapper.insert(gasData);
+
+            GasWarningInfo warningInfo = new GasWarningInfo();
+            if ("1".equals(i)) {
+                queryWrapper.eq("farm_id", 21).eq("gas_type", 1);
+                GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
+                if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
+                    warningInfo.setWarningContent(nh3n + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(0);
+                }
+                if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
+                    warningInfo.setWarningContent(jlm + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(1);
+                }
+                if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
+                    warningInfo.setWarningContent(elht + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(2);
+                }
+                if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
+                    warningInfo.setWarningContent(ejel + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(3);
+                }
+                if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
+                    warningInfo.setWarningContent(h2s + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(4);
+                }
+                if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
+                    warningInfo.setWarningContent(byx + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(5);
+                }
+                if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
+                    warningInfo.setWarningContent(ch3 + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(6);
+                }
+                if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
+                    warningInfo.setWarningContent(sja + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(7);
+                }
+                if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
+                    warningInfo.setWarningContent(cq + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(8);
+                }
+
+                warningInfo.setBuildLocation("屋顶");
+                warningInfo.setDate(new Date());
+                warningInfo.setFarmId(gasThreshold.getFarmId());
+                warningInfo.setUserIds(gasThreshold.getUserIds());
+                warningInfoMapper.insert(warningInfo);
+
+            } else if ("2".equals(i)) {
+                queryWrapper.eq("farm_id", 21).eq("gas_type", 2);
+                GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
+                if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
+                    warningInfo.setWarningContent(nh3n + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(0);
+                }
+                if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
+                    warningInfo.setWarningContent(jlm + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(1);
+                }
+                if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
+                    warningInfo.setWarningContent(elht + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(2);
+                }
+                if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
+                    warningInfo.setWarningContent(ejel + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(3);
+                }
+                if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
+                    warningInfo.setWarningContent(h2s + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(4);
+
+                }
+                if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
+                    warningInfo.setWarningContent(byx + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(5);
+                }
+                if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
+                    warningInfo.setWarningContent(ch3 + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(6);
+                }
+                if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
+                    warningInfo.setWarningContent(sja + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(7);
+                }
+                if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
+                    warningInfo.setWarningContent(cq + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(8);
+                }
+
+                warningInfo.setBuildLocation("厂界上");
+                warningInfo.setDate(new Date());
+                warningInfo.setFarmId(gasThreshold.getFarmId());
+                warningInfo.setUserIds(gasThreshold.getUserIds());
+                warningInfoMapper.insert(warningInfo);
+            } else if ("3".equals(i)) {
+                queryWrapper.eq("farm_id", 21).eq("gas_type", 3);
+                GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
+                if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
+                    warningInfo.setWarningContent(nh3n + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(0);
+                }
+                if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
+                    warningInfo.setWarningContent(jlm + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(1);
+                }
+                if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
+                    warningInfo.setWarningContent(elht + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(2);
+                }
+                if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
+                    warningInfo.setWarningContent(ejel + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(3);
+                }
+                if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
+                    warningInfo.setWarningContent(h2s + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(4);
+
+                }
+                if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
+                    warningInfo.setWarningContent(byx + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(5);
+                }
+                if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
+                    warningInfo.setWarningContent(ch3 + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(6);
+                }
+                if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
+                    warningInfo.setWarningContent(sja + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(7);
+                }
+                if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
+                    warningInfo.setWarningContent(cq + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(8);
+                }
+
+                warningInfo.setBuildLocation("厂界下");
+                warningInfo.setDate(new Date());
+                warningInfo.setFarmId(gasThreshold.getFarmId());
+                warningInfo.setUserIds(gasThreshold.getUserIds());
+                warningInfoMapper.insert(warningInfo);
+            } else if ("4".equals(i)) {
+                queryWrapper.eq("farm_id", 21).eq("gas_type", 4);
+                GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
+                if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
+                    warningInfo.setWarningContent(nh3n + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(0);
+                }
+                if (Double.parseDouble(jlm) > Double.parseDouble(gasThreshold.getJlm())) {
+                    warningInfo.setWarningContent(jlm + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(1);
+                }
+                if (Double.parseDouble(elht) > Double.parseDouble(gasThreshold.getElht())) {
+                    warningInfo.setWarningContent(elht + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(2);
+                }
+                if (Double.parseDouble(ejel) > Double.parseDouble(gasThreshold.getEjel())) {
+                    warningInfo.setWarningContent(ejel + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(3);
+                }
+                if (Double.parseDouble(h2s) > Double.parseDouble(gasThreshold.getH2s())) {
+                    warningInfo.setWarningContent(h2s + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(4);
+                }
+                if (Double.parseDouble(byx) > Double.parseDouble(gasThreshold.getByx())) {
+                    warningInfo.setWarningContent(byx + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(5);
+                }
+                if (Double.parseDouble(ch3) > Double.parseDouble(gasThreshold.getCh3sh())) {
+                    warningInfo.setWarningContent(ch3 + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(6);
+                }
+                if (Double.parseDouble(sja) > Double.parseDouble(gasThreshold.getSja())) {
+                    warningInfo.setWarningContent(sja + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(7);
+                }
+                if (Double.parseDouble(cq) > Double.parseDouble(gasThreshold.getCq())) {
+                    warningInfo.setWarningContent(cq + "超过阈值,系统预警提醒");
+                    warningInfo.setWarningType(8);
+                }
+
+                warningInfo.setBuildLocation("厂界居民");
+                warningInfo.setDate(new Date());
+                warningInfo.setFarmId(gasThreshold.getFarmId());
+                warningInfo.setUserIds(gasThreshold.getUserIds());
+                warningInfoMapper.insert(warningInfo);
             }
-
-            warningInfo.setBuildLocation("厂界居民");
-            warningInfo.setDate(new Date());
-            warningInfo.setFarmId(gasThreshold.getFarmId());
-            warningInfo.setUserIds(gasThreshold.getUserIds());
-            warningInfoMapper.insert(warningInfo);
         }
     }
 }

+ 157 - 152
huimv-admin/src/main/java/com/huimv/admin/timer/ProtTimer.java

@@ -31,7 +31,7 @@ public class ProtTimer {
     private ProtWarningInfoMapper warningInfoMapper;
 
     //    环保数据
-    @Scheduled(cron = "0 0/10 * * * ? ")
+    @Scheduled(cron = "0 0 */1 * * ? ")
     private void getShenChan() throws Exception {
 
         //假设已经拿到了数据
@@ -43,161 +43,166 @@ public class ProtTimer {
         String num5 = NumberUtils.getNum(90, 210, 0);//flow
         String num6 = NumberUtils.getNum(1, 4, 0);//loc_type
 
-        ProtWarningInfo protWarningInfo = new ProtWarningInfo();
 
-        ProtData protData = new ProtData();
-        protData.setLoctionType(Integer.parseInt(num6));
-        protData.setCreateDate(new Date());
-        protData.setFarmId(21);
-        protData.setCod(num1);
-        protData.setPh(num);
-        protData.setNh3n(num2);
-        protData.setTp(num3);
-        protData.setTn(num4);
-        protData.setFlow(num5);
-        protDataMapper.insert(protData);
 
         QueryWrapper<ProtThreshold> queryWrapper = new QueryWrapper<>();
-        if ("1".equals(num6)) {
-            queryWrapper.eq("farm_id", 21).eq("prot_type", 1);
-            ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
-            if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2())) {
-                protWarningInfo.setWarningContent("进污口ph值为" + num + "达到红色预警");
-                protWarningInfo.setWarningType(1);
-            } else if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1())) {
-                protWarningInfo.setWarningContent("进污口ph值为" + num + "达到橙色预警");
-                protWarningInfo.setWarningType(1);
-            } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod2())) {
-                protWarningInfo.setWarningContent("进污口cod值为" + num1 + "达到红色预警");
-                protWarningInfo.setWarningType(0);
-            } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod1())) {
-                protWarningInfo.setWarningContent("进污口cod值为" + num1 + "达到橙色预警");
-                protWarningInfo.setWarningType(0);
-            } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n2())) {
-                protWarningInfo.setWarningContent("进污口NH3N值为" + num2 + "达到红色预警");
-                protWarningInfo.setWarningType(2);
-            } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n1())) {
-                protWarningInfo.setWarningContent("进污口NH3N值为" + num2 + "达到橙色预警");
-                protWarningInfo.setWarningType(2);
-            } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp2())) {
-                protWarningInfo.setWarningContent("进污口TP值为" + num3 + "达到红色预警");
-                protWarningInfo.setWarningType(3);
-            } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp1())) {
-                protWarningInfo.setWarningContent("进污口TP值为" + num3 + "达到橙色预警");
-                protWarningInfo.setWarningType(3);
-            } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn2())) {
-                protWarningInfo.setWarningContent("进污口TN值为" + num4 + "达到红色预警");
-                protWarningInfo.setWarningType(4);
-            } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn1())) {
-                protWarningInfo.setWarningContent("进污口TN值为" + num4 + "达到橙色预警");
-                protWarningInfo.setWarningType(4);
-            } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow2())) {
-                protWarningInfo.setWarningContent("进污口累计流量值为" + num5 + "达到红色预警");
-                protWarningInfo.setWarningType(5);
-            } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow1())) {
-                protWarningInfo.setWarningContent("进污口累计流量值为" + num5 + "达到橙色预警");
-                protWarningInfo.setWarningType(5);
-            }
-            protWarningInfo.setFarmId(protThreshold.getFarmId());
-            protWarningInfo.setDate(new Date());
-            protWarningInfo.setUserIds(protThreshold.getUserIds());
-            protWarningInfo.setDeviceId(Integer.parseInt(num6));
-            protWarningInfo.setBuildLocation("进污口");
-            warningInfoMapper.insert(protWarningInfo);
-        } else if ("2".equals(num6)) {
-            queryWrapper.eq("farm_id", 21).eq("prot_type", 2);
-            ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//污口
-            if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2())) {
-                protWarningInfo.setWarningContent("处理口ph值为" + num + "达到红色预警");
-                protWarningInfo.setWarningType(1);
-            } else if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1())) {
-                protWarningInfo.setWarningContent("处理口ph值为" + num + "达到橙色预警");
-                protWarningInfo.setWarningType(1);
-            } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod2())) {
-                protWarningInfo.setWarningContent("处理口cod值为" + num1 + "达到红色预警");
-                protWarningInfo.setWarningType(0);
-            } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod1())) {
-                protWarningInfo.setWarningContent("处理口cod值为" + num1 + "达到橙色预警");
-                protWarningInfo.setWarningType(0);
-            } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n2())) {
-                protWarningInfo.setWarningContent("处理口NH3N值为" + num2 + "达到红色预警");
-                protWarningInfo.setWarningType(2);
-            } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n1())) {
-                protWarningInfo.setWarningContent("处理口NH3N值为" + num2 + "达到橙色预警");
-                protWarningInfo.setWarningType(2);
-            } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp2())) {
-                protWarningInfo.setWarningContent("处理口TP值为" + num3 + "达到红色预警");
-                protWarningInfo.setWarningType(3);
-            } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp1())) {
-                protWarningInfo.setWarningContent("处理口TP值为" + num3 + "达到橙色预警");
-                protWarningInfo.setWarningType(3);
-            } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn2())) {
-                protWarningInfo.setWarningContent("处理口TN值为" + num4 + "达到红色预警");
-                protWarningInfo.setWarningType(4);
-            } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn1())) {
-                protWarningInfo.setWarningContent("处理口TN值为" + num4 + "达到橙色预警");
-                protWarningInfo.setWarningType(4);
-            } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow2())) {
-                protWarningInfo.setWarningContent("处理口累计流量值为" + num5 + "达到红色预警");
-                protWarningInfo.setWarningType(5);
-            } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow1())) {
-                protWarningInfo.setWarningContent("处理口累计流量值为" + num5 + "达到橙色预警");
-                protWarningInfo.setWarningType(5);
-            }
-            protWarningInfo.setFarmId(protThreshold.getFarmId());
-            protWarningInfo.setWarningType(Integer.parseInt(num6));
-            protWarningInfo.setDate(new Date());
-            protWarningInfo.setUserIds(protThreshold.getUserIds());
-            protWarningInfo.setDeviceId(Integer.parseInt(num6));
-            protWarningInfo.setBuildLocation("处理口");
-            warningInfoMapper.insert(protWarningInfo);
-        } else if ("3".equals(num6)) {
-            queryWrapper.eq("farm_id", 21).eq("prot_type", 3);
-            ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
-            if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2())) {
-                protWarningInfo.setWarningContent("排污口ph值为" + num + "达到红色预警");
-                protWarningInfo.setWarningType(1);
-            } else if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1())) {
-                protWarningInfo.setWarningContent("排污口ph值为" + num + "达到橙色预警");
-                protWarningInfo.setWarningType(1);
-            } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod2())) {
-                protWarningInfo.setWarningContent("排污口cod值为" + num1 + "达到红色预警");
-                protWarningInfo.setWarningType(0);
-            } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod1())) {
-                protWarningInfo.setWarningContent("排污口cod值为" + num1 + "达到橙色预警");
-                protWarningInfo.setWarningType(0);
-            } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n2())) {
-                protWarningInfo.setWarningContent("排污口NH3N值为" + num2 + "达到红色预警");
-                protWarningInfo.setWarningType(2);
-            } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n1())) {
-                protWarningInfo.setWarningContent("排污口NH3N值为" + num2 + "达到橙色预警");
-                protWarningInfo.setWarningType(2);
-            } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp2())) {
-                protWarningInfo.setWarningContent("排污口TP值为" + num3 + "达到红色预警");
-                protWarningInfo.setWarningType(3);
-            } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp1())) {
-                protWarningInfo.setWarningContent("排污口TP值为" + num3 + "达到橙色预警");
-                protWarningInfo.setWarningType(3);
-            } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn2())) {
-                protWarningInfo.setWarningContent("排污口TN值为" + num4 + "达到红色预警");
-                protWarningInfo.setWarningType(4);
-            } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn1())) {
-                protWarningInfo.setWarningContent("排污口TN值为" + num4 + "达到橙色预警");
-                protWarningInfo.setWarningType(4);
-            } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow2())) {
-                protWarningInfo.setWarningContent("排污口累计流量值为" + num5 + "达到红色预警");
-                protWarningInfo.setWarningType(5);
-            } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow1())) {
-                protWarningInfo.setWarningContent("排污口累计流量值为" + num5 + "达到橙色预警");
-                protWarningInfo.setWarningType(5);
+        for (int i = 1; i < 4; i++) {
+
+            ProtWarningInfo protWarningInfo = new ProtWarningInfo();
+
+            ProtData protData = new ProtData();
+            protData.setLoctionType(i);
+            protData.setCreateDate(new Date());
+            protData.setFarmId(21);
+            protData.setCod(num1);
+            protData.setPh(num);
+            protData.setNh3n(num2);
+            protData.setTp(num3);
+            protData.setTn(num4);
+            protData.setFlow(num5);
+            protDataMapper.insert(protData);
+
+            if ("1".equals(i)) {
+                queryWrapper.eq("farm_id", 21).eq("prot_type", 1);
+                ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
+                if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2())) {
+                    protWarningInfo.setWarningContent("进污口ph值为" + num + "达到红色预警");
+                    protWarningInfo.setWarningType(1);
+                } else if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1())) {
+                    protWarningInfo.setWarningContent("进污口ph值为" + num + "达到橙色预警");
+                    protWarningInfo.setWarningType(1);
+                } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod2())) {
+                    protWarningInfo.setWarningContent("进污口cod值为" + num1 + "达到红色预警");
+                    protWarningInfo.setWarningType(0);
+                } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod1())) {
+                    protWarningInfo.setWarningContent("进污口cod值为" + num1 + "达到橙色预警");
+                    protWarningInfo.setWarningType(0);
+                } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n2())) {
+                    protWarningInfo.setWarningContent("进污口NH3N值为" + num2 + "达到红色预警");
+                    protWarningInfo.setWarningType(2);
+                } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n1())) {
+                    protWarningInfo.setWarningContent("进污口NH3N值为" + num2 + "达到橙色预警");
+                    protWarningInfo.setWarningType(2);
+                } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp2())) {
+                    protWarningInfo.setWarningContent("进污口TP值为" + num3 + "达到红色预警");
+                    protWarningInfo.setWarningType(3);
+                } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp1())) {
+                    protWarningInfo.setWarningContent("进污口TP值为" + num3 + "达到橙色预警");
+                    protWarningInfo.setWarningType(3);
+                } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn2())) {
+                    protWarningInfo.setWarningContent("进污口TN值为" + num4 + "达到红色预警");
+                    protWarningInfo.setWarningType(4);
+                } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn1())) {
+                    protWarningInfo.setWarningContent("进污口TN值为" + num4 + "达到橙色预警");
+                    protWarningInfo.setWarningType(4);
+                } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow2())) {
+                    protWarningInfo.setWarningContent("进污口累计流量值为" + num5 + "达到红色预警");
+                    protWarningInfo.setWarningType(5);
+                } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow1())) {
+                    protWarningInfo.setWarningContent("进污口累计流量值为" + num5 + "达到橙色预警");
+                    protWarningInfo.setWarningType(5);
+                }
+                protWarningInfo.setFarmId(protThreshold.getFarmId());
+                protWarningInfo.setDate(new Date());
+                protWarningInfo.setUserIds(protThreshold.getUserIds());
+                protWarningInfo.setDeviceId(i);
+                protWarningInfo.setBuildLocation("进污口");
+                warningInfoMapper.insert(protWarningInfo);
+            } else if ("2".equals(i)) {
+                queryWrapper.eq("farm_id", 21).eq("prot_type", 2);
+                ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//污口
+                if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2())) {
+                    protWarningInfo.setWarningContent("处理口ph值为" + num + "达到红色预警");
+                    protWarningInfo.setWarningType(1);
+                } else if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1())) {
+                    protWarningInfo.setWarningContent("处理口ph值为" + num + "达到橙色预警");
+                    protWarningInfo.setWarningType(1);
+                } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod2())) {
+                    protWarningInfo.setWarningContent("处理口cod值为" + num1 + "达到红色预警");
+                    protWarningInfo.setWarningType(0);
+                } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod1())) {
+                    protWarningInfo.setWarningContent("处理口cod值为" + num1 + "达到橙色预警");
+                    protWarningInfo.setWarningType(0);
+                } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n2())) {
+                    protWarningInfo.setWarningContent("处理口NH3N值为" + num2 + "达到红色预警");
+                    protWarningInfo.setWarningType(2);
+                } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n1())) {
+                    protWarningInfo.setWarningContent("处理口NH3N值为" + num2 + "达到橙色预警");
+                    protWarningInfo.setWarningType(2);
+                } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp2())) {
+                    protWarningInfo.setWarningContent("处理口TP值为" + num3 + "达到红色预警");
+                    protWarningInfo.setWarningType(3);
+                } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp1())) {
+                    protWarningInfo.setWarningContent("处理口TP值为" + num3 + "达到橙色预警");
+                    protWarningInfo.setWarningType(3);
+                } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn2())) {
+                    protWarningInfo.setWarningContent("处理口TN值为" + num4 + "达到红色预警");
+                    protWarningInfo.setWarningType(4);
+                } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn1())) {
+                    protWarningInfo.setWarningContent("处理口TN值为" + num4 + "达到橙色预警");
+                    protWarningInfo.setWarningType(4);
+                } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow2())) {
+                    protWarningInfo.setWarningContent("处理口累计流量值为" + num5 + "达到红色预警");
+                    protWarningInfo.setWarningType(5);
+                } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow1())) {
+                    protWarningInfo.setWarningContent("处理口累计流量值为" + num5 + "达到橙色预警");
+                    protWarningInfo.setWarningType(5);
+                }
+                protWarningInfo.setFarmId(protThreshold.getFarmId());
+                protWarningInfo.setWarningType(i);
+                protWarningInfo.setDate(new Date());
+                protWarningInfo.setUserIds(protThreshold.getUserIds());
+                protWarningInfo.setDeviceId(i);
+                protWarningInfo.setBuildLocation("处理口");
+                warningInfoMapper.insert(protWarningInfo);
+            } else if ("3".equals(i)) {
+                queryWrapper.eq("farm_id", 21).eq("prot_type", 3);
+                ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
+                if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2())) {
+                    protWarningInfo.setWarningContent("排污口ph值为" + num + "达到红色预警");
+                    protWarningInfo.setWarningType(1);
+                } else if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1())) {
+                    protWarningInfo.setWarningContent("排污口ph值为" + num + "达到橙色预警");
+                    protWarningInfo.setWarningType(1);
+                } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod2())) {
+                    protWarningInfo.setWarningContent("排污口cod值为" + num1 + "达到红色预警");
+                    protWarningInfo.setWarningType(0);
+                } else if (Double.parseDouble(num1) > Double.parseDouble(protThreshold.getCod1())) {
+                    protWarningInfo.setWarningContent("排污口cod值为" + num1 + "达到橙色预警");
+                    protWarningInfo.setWarningType(0);
+                } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n2())) {
+                    protWarningInfo.setWarningContent("排污口NH3N值为" + num2 + "达到红色预警");
+                    protWarningInfo.setWarningType(2);
+                } else if (Double.parseDouble(num2) > Double.parseDouble(protThreshold.getNh3n1())) {
+                    protWarningInfo.setWarningContent("排污口NH3N值为" + num2 + "达到橙色预警");
+                    protWarningInfo.setWarningType(2);
+                } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp2())) {
+                    protWarningInfo.setWarningContent("排污口TP值为" + num3 + "达到红色预警");
+                    protWarningInfo.setWarningType(3);
+                } else if (Double.parseDouble(num3) > Double.parseDouble(protThreshold.getTp1())) {
+                    protWarningInfo.setWarningContent("排污口TP值为" + num3 + "达到橙色预警");
+                    protWarningInfo.setWarningType(3);
+                } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn2())) {
+                    protWarningInfo.setWarningContent("排污口TN值为" + num4 + "达到红色预警");
+                    protWarningInfo.setWarningType(4);
+                } else if (Double.parseDouble(num4) > Double.parseDouble(protThreshold.getTn1())) {
+                    protWarningInfo.setWarningContent("排污口TN值为" + num4 + "达到橙色预警");
+                    protWarningInfo.setWarningType(4);
+                } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow2())) {
+                    protWarningInfo.setWarningContent("排污口累计流量值为" + num5 + "达到红色预警");
+                    protWarningInfo.setWarningType(5);
+                } else if (Double.parseDouble(num5) > Double.parseDouble(protThreshold.getFlow1())) {
+                    protWarningInfo.setWarningContent("排污口累计流量值为" + num5 + "达到橙色预警");
+                    protWarningInfo.setWarningType(5);
+                }
+                protWarningInfo.setFarmId(protThreshold.getFarmId());
+                protWarningInfo.setWarningType(i);
+                protWarningInfo.setDate(new Date());
+                protWarningInfo.setUserIds(protThreshold.getUserIds());
+                protWarningInfo.setDeviceId(i);
+                protWarningInfo.setBuildLocation("排污口");
+                warningInfoMapper.insert(protWarningInfo);
             }
-            protWarningInfo.setFarmId(protThreshold.getFarmId());
-            protWarningInfo.setWarningType(Integer.parseInt(num6));
-            protWarningInfo.setDate(new Date());
-            protWarningInfo.setUserIds(protThreshold.getUserIds());
-            protWarningInfo.setDeviceId(Integer.parseInt(num6));
-            protWarningInfo.setBuildLocation("排污口");
-            warningInfoMapper.insert(protWarningInfo);
         }
     }
 }