Explorar el Código

添加设备在线率统计

523096025 hace 2 años
padre
commit
ec357a53f8

+ 4 - 0
huimv-admin/src/main/java/com/huimv/admin/common/token/TokenSign.java

@@ -1,5 +1,6 @@
 package com.huimv.admin.common.token;
 
+import cn.hutool.core.util.ObjectUtil;
 import io.jsonwebtoken.*;
 import org.apache.commons.lang.StringUtils;
 
@@ -80,6 +81,9 @@ public class TokenSign {
             return null;
         }
         Claims claims = getClaims(jwtToken);
+        if(ObjectUtil.isEmpty(claims)||ObjectUtil.isEmpty(claims.get("id"))){
+
+        }
         return (Integer) claims.get("id");
     }
 

+ 0 - 4
huimv-admin/src/main/java/com/huimv/admin/common/utils/NumberUtils.java

@@ -25,7 +25,6 @@ public class NumberUtils {
         }
         return  result+"";
     }
-
     // 是小数位数
     public static String getNumFloat(Double min, Double max) {
         double v = Math.random() * (max - min) + min;
@@ -33,7 +32,4 @@ public class NumberUtils {
         return df.format(v);
     }
 
-    public static void main(String[] args) {
-        System.out.println(getNumFloat(0.00, 0.006));
-    }
 }

+ 1 - 1
huimv-admin/src/main/java/com/huimv/admin/entity/EnvDeviceOnline.java

@@ -3,7 +3,7 @@ package com.huimv.admin.entity;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
+import java.util.Date;
 import java.io.Serializable;
 import java.util.Date;
 

+ 1 - 1
huimv-admin/src/main/java/com/huimv/admin/entity/GasData.java

@@ -3,7 +3,7 @@ package com.huimv.admin.entity;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
+import java.util.Date;
 import java.io.Serializable;
 import java.util.Date;
 

+ 1 - 1
huimv-admin/src/main/java/com/huimv/admin/entity/GasWarningInfo.java

@@ -3,7 +3,7 @@ package com.huimv.admin.entity;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
+import java.util.Date;
 import java.io.Serializable;
 import java.util.Date;
 

+ 1 - 1
huimv-admin/src/main/java/com/huimv/admin/entity/ProdAnalysis.java

@@ -3,7 +3,7 @@ package com.huimv.admin.entity;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
+import java.util.Date;
 import java.io.Serializable;
 import java.util.Date;
 

+ 1 - 1
huimv-admin/src/main/java/com/huimv/admin/entity/ProdProduction.java

@@ -3,7 +3,7 @@ package com.huimv.admin.entity;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
+import java.util.Date;
 import java.io.Serializable;
 import java.util.Date;
 

+ 2 - 2
huimv-admin/src/main/java/com/huimv/admin/entity/ProdSale.java

@@ -3,8 +3,8 @@ package com.huimv.admin.entity;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
 import java.io.Serializable;
+import java.util.Date;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
@@ -41,7 +41,7 @@ public class ProdSale implements Serializable {
     private Integer saleQuantity;
 
     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
-    private LocalDateTime creatTime;
+    private Date creatTime;
 
     private Integer farmId;
 

+ 2 - 2
huimv-admin/src/main/java/com/huimv/admin/entity/ProdStock.java

@@ -3,7 +3,7 @@ package com.huimv.admin.entity;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.time.LocalDateTime;
+import java.util.Date;
 import java.io.Serializable;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -95,7 +95,7 @@ public class ProdStock implements Serializable {
     private Integer zcl;
 
     @JsonFormat(pattern = "yyyy-MM",timezone = "GMT+8")
-    private LocalDateTime creatTime;
+    private Date creatTime;
 
     private Integer farmId;
 

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

@@ -321,7 +321,7 @@ public class EnvDeviceServiceImpl extends ServiceImpl<EnvDeviceMapper, EnvDevice
         String farmId = params.get("farmId");
         //获取所有栏舍
         Map<String, Object> map = new HashMap<String, Object>();
-        String s = HttpClientSSLUtils.doPost("https://yzwlw.loongk.com/mobile/login?username=江西增鑫&password=21218cca77804d2ba1922c33e0151105", JSON.toJSONString(map));
+        String s = HttpClientSSLUtils.doPost("https://yzwlw.loongk.com/mobile/login?username=华统&password=21218cca77804d2ba1922c33e0151105", JSON.toJSONString(map));
         System.out.println("登录带栏舍:"+s);
         LoginDto loginDto = JSONUtil.toBean(s, LoginDto.class);
         DataToken token = loginDto.getData().getToken();

+ 1 - 1
huimv-admin/src/main/java/com/huimv/admin/timer/CarmeraTimer.java

@@ -86,7 +86,7 @@ public class CarmeraTimer {
 
     public static void main(String[] args) throws Exception {
         Map<String, Object> map = new HashMap<String, Object>();
-        String s = HttpClientSSLUtils.doPost("https://yzwlw.loongk.com/mobile/loginO?username=江西增鑫&password=21218cca77804d2ba1922c33e0151105",JSON.toJSONString(map));
+        String s = HttpClientSSLUtils.doPost("https://yzwlw.loongk.com/mobile/loginO?username=华统&password=21218cca77804d2ba1922c33e0151105",JSON.toJSONString(map));
         LoginDto loginDto = JSONUtil.toBean(s, LoginDto.class);
         DataToken token = loginDto.getData().getToken();
         String encode = Base64.encode(token.getUserId() + "_" + token.getToken());

+ 4 - 6
huimv-admin/src/main/java/com/huimv/admin/timer/EnvTimer.java

@@ -7,11 +7,9 @@ import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.huimv.admin.common.utils.HttpClientSSLUtils;
-import com.huimv.admin.common.utils.Result;
 import com.huimv.admin.entity.*;
 import com.huimv.admin.entity.zengxindto.LoginOnlyDto;
 import com.huimv.admin.entity.zengxindto.LonginOnlyDtoToken;
@@ -57,14 +55,14 @@ public class EnvTimer {
     @Autowired
     private IEnvWarningInfoService envWarningInfoService;
     //环控数据
-    String username = "江西增鑫";
+    String username = "华统";
     String password = "888888";
     String passwordMD5 = "21218cca77804d2ba1922c33e0151105";
     String baseurl ="https://yzwlw.loongk.com/";
 
     @Scheduled(cron = "0 0/11 * * * ? ")
     @Transactional
-    private void getHuanKong() throws Exception {
+    public void getHuanKong() throws Exception {
         //目前是这家
         Integer farmId = 21;
         String encode = loginOnly();
@@ -124,7 +122,7 @@ public class EnvTimer {
         }
     }
 
-    private void saveHumWarning(String val, EnvWarningThreshold envWarningThreshold, EnvDevice envDevice, Integer farmId) {
+    public void saveHumWarning(String val, EnvWarningThreshold envWarningThreshold, EnvDevice envDevice, Integer farmId) {
         if (StringUtils.isNotBlank(val)){
             String maxHum ;
             String minHum ;
@@ -220,7 +218,7 @@ public class EnvTimer {
     }
 
     @Scheduled(cron = "0 0 0 * * ? ")
-    private void update() throws Exception {
+    public void update() throws Exception {
         Date date = new Date();
         DateTime beginOfMonth = DateUtil.beginOfMonth(date);
         List<Farm> list = farmService.list();

+ 11 - 23
huimv-admin/src/main/java/com/huimv/admin/timer/GasTimer.java

@@ -33,15 +33,15 @@ public class  GasTimer {
         String type = NumberUtils.getNum(1, 5, 0);//loc_type
         for (int i = 1; i < 5; i++) {
 
-            String nh3n = NumberUtils.getNumFloat(0.0, 10.5);//NH3N
-            String jlm = NumberUtils.getNumFloat(0.0, 10.5);//jlm
-            String elht = NumberUtils.getNumFloat(0.0, 10.5);//elht
-            String ejel = NumberUtils.getNumFloat(0.0, 10.5);//ejel
-            String h2s = NumberUtils.getNumFloat(0.0, 10.5);//h2s
-            String byx = NumberUtils.getNumFloat(0.0, 20.5);//byx
-            String ch3 = NumberUtils.getNumFloat(0.0, 10.5);//ch3
-            String sja = NumberUtils.getNumFloat(0.0,10.5);//sja
-
+            String nh3n = NumberUtils.getNumFloat(0.01, 0.0501);//NH3N
+            String jlm = NumberUtils.getNumFloat(0.01, 0.0701);//jlm
+            String elht = NumberUtils.getNumFloat(1.00, 2.5001);//elht
+            String ejel = NumberUtils.getNumFloat(0.01, 0.0501);//ejel
+            String h2s = NumberUtils.getNumFloat(0.01, 0.0501);//h2s
+            String byx = NumberUtils.getNumFloat(1.0, 4.5001);//byx
+            String ch3 = NumberUtils.getNumFloat(0.001, 0.0062);//ch3
+            String sja = NumberUtils.getNumFloat(0.01, 0.0701);//sja
+            String cq = NumberUtils.getNumFloat(10.0, 18.001);//cq
 
             GasData gasData = new GasData();
             gasData.setLoctionType(i);
@@ -53,16 +53,14 @@ public class  GasTimer {
             gasData.setByx(byx);
             gasData.setCh3sh(ch3);
             gasData.setSja(sja);
+            gasData.setCq(cq);
             gasData.setFarmId(21);
             gasData.setCreateTime(new Date());
-
+            gasDataMapper.insert(gasData);
 
             QueryWrapper<GasThreshold> queryWrapper = new QueryWrapper<>();
             GasWarningInfo warningInfo = new GasWarningInfo();
             if (i==1) {
-                String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
-                gasData.setCq(cq);
-
                 queryWrapper.eq("farm_id", 21).eq("gas_type", 1);
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
@@ -148,9 +146,6 @@ public class  GasTimer {
                 }
 
             } else if (i==2) {
-                String cq = NumberUtils.getNumFloat(0.0, 5000.5);//cq
-                gasData.setCq(cq);
-
                 queryWrapper.eq("farm_id", 21).eq("gas_type", 2);
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
@@ -237,9 +232,6 @@ public class  GasTimer {
                 }
 
             } else if (i==3) {
-                String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
-                gasData.setCq(cq);
-
                 queryWrapper.eq("farm_id", 21).eq("gas_type", 3);
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
@@ -326,9 +318,6 @@ public class  GasTimer {
                 }
 
             } else if (i==4) {
-                String cq = NumberUtils.getNumFloat(0.0, 10000.5);//cq
-                gasData.setCq(cq);
-
                 queryWrapper.eq("farm_id", 21).eq("gas_type", 4);
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
@@ -414,7 +403,6 @@ public class  GasTimer {
                 }
 
             }
-            gasDataMapper.insert(gasData);
         }
     }
 }

+ 50 - 56
huimv-admin/src/main/java/com/huimv/admin/timer/ProtTimer.java

@@ -35,41 +35,43 @@ public class ProtTimer {
     private void getShenChan() throws Exception {
 
 
+
         for (int i = 1; i < 4; i++) {
 
             //假设已经拿到了数据
-            String num = NumberUtils.getNumFloat(6.4, 8.6);//ph
-
-
+            String num = NumberUtils.getNumFloat(4.0,6.0002);//ph
+            String num1 = NumberUtils.getNum(300, 361, 1);//cod
+            String num2 = NumberUtils.getNum(40, 61,1);//nh3n
+            String num3 = NumberUtils.getNumFloat(4.0, 6.5002);//tp
+            String num4 = NumberUtils.getNum(7000, 8001,0);//tn
+            String num5 = NumberUtils.getNum(220, 301,0);//flow
 
+            //排污口专用数据
+            String ph = NumberUtils.getNumFloat(5.0,5.9);//ph
+            String cod = NumberUtils.getNum(350, 360, 1);//cod
+            String nh3n = NumberUtils.getNum(55, 60, 1);//nh3n
+            String tp = NumberUtils.getNumFloat(5.0, 6.49);//tp
+            String tn = NumberUtils.getNum(7800, 8000, 1);//tn
+            String flow = NumberUtils.getNum(290, 300, 1);//flow
 
 
             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);
 
             QueryWrapper<ProtThreshold> queryWrapper = new QueryWrapper<>();
             if (i == 1) {
-                String num1 = NumberUtils.getNum(8000, 20001,0);//cod
-                String num2 = NumberUtils.getNumFloat(1000.0, 1501.0);//nh3n
-                String num3 = NumberUtils.getNumFloat(100.0, 260.0);//tp
-                String num4 = NumberUtils.getNum(1000, 1550, 0);//tn
-                String num5 = NumberUtils.getNum(0, 51, 0);//flow
-
-                protData.setCod(num1);
-                protData.setNh3n(num2);
-                protData.setTp(num3);
-                protData.setTn(num4);
-                protData.setFlow(num5);
-                protDataMapper.insert(protData);
-
                 queryWrapper.eq("farm_id", 21).eq("prot_type", 1);
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
-                if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) {
+                if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("进污口ph值为" + num + "达到红色预警");
                     protWarningInfo.setWarningType(1);
@@ -80,7 +82,7 @@ public class ProtTimer {
                     protWarningInfo.setBuildLocation("进污口");
                     warningInfoMapper.insert(protWarningInfo);
                 }
-                if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther2())) {
+                if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("进污口ph值为" + num + "达到橙色预警");
                     protWarningInfo.setWarningType(1);
@@ -201,40 +203,28 @@ public class ProtTimer {
                     protWarningInfo.setBuildLocation("进污口");
                     warningInfoMapper.insert(protWarningInfo);
                 }
-
             }
             if (i == 2) {
-                String num1 = NumberUtils.getNum(0, 310,0);//cod
-                String num2 = NumberUtils.getNumFloat(0.0, 31.0);//nh3n
-                String num3 = NumberUtils.getNumFloat(0.0, 3.6);//tp
-                String num4 = NumberUtils.getNum(0, 32, 0);//tn
-                String num5 = NumberUtils.getNum(0, 55, 0);//flow
-
-                protData.setCod(num1);
-                protData.setNh3n(num2);
-                protData.setTp(num3);
-                protData.setTn(num4);
-                protData.setFlow(num5);
-                protDataMapper.insert(protData);
-
                 queryWrapper.eq("farm_id", 21).eq("prot_type", 2);
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//污口
-                if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) {
+                if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口ph值为" + num + "达到红色预警");
                     protWarningInfo.setWarningType(1);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("处理口");
                     warningInfoMapper.insert(protWarningInfo);
                 }
-                if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther2())) {
+                if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("处理口ph值为" + num + "达到橙色预警");
                     protWarningInfo.setWarningType(1);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -246,6 +236,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("处理口cod值为" + num1 + "达到红色预警");
                     protWarningInfo.setWarningType(0);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -257,6 +248,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("处理口cod值为" + num1 + "达到橙色预警");
                     protWarningInfo.setWarningType(0);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -268,6 +260,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("处理口NH3N值为" + num2 + "达到红色预警");
                     protWarningInfo.setWarningType(2);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -279,6 +272,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("处理口NH3N值为" + num2 + "达到橙色预警");
                     protWarningInfo.setWarningType(2);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -290,6 +284,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("处理口TP值为" + num3 + "达到红色预警");
                     protWarningInfo.setWarningType(3);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -301,6 +296,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("处理口TP值为" + num3 + "达到橙色预警");
                     protWarningInfo.setWarningType(3);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -312,6 +308,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("处理口TN值为" + num4 + "达到红色预警");
                     protWarningInfo.setWarningType(4);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -323,6 +320,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("处理口TN值为" + num4 + "达到橙色预警");
                     protWarningInfo.setWarningType(4);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -334,6 +332,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("处理口累计流量值为" + num5 + "达到红色预警");
                     protWarningInfo.setWarningType(5);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -345,6 +344,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("处理口累计流量值为" + num5 + "达到橙色预警");
                     protWarningInfo.setWarningType(5);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -354,42 +354,26 @@ public class ProtTimer {
 
             }
             if (i == 3) {
-                //排污口专用数据
-                String ph = NumberUtils.getNumFloat(6.6, 8.4);//ph
-                String cod = NumberUtils.getNum(0, 380, 0);//cod
-                String nh3n = NumberUtils.getNum(0, 50, 1);//nh3n
-                String tp = NumberUtils.getNumFloat(0.0, 10.0);//tp
-                String tn = NumberUtils.getNum(0, 150, 1);//tn
-                String flow = NumberUtils.getNum(0, 100, 1);//flow
-
-                protData.setPh(ph);
-                protData.setFlow(flow);
-                protData.setTp(tp);
-                protData.setTn(tn);
-                protData.setCod(cod);
-                protData.setNh3n(nh3n);
-
-                protDataMapper.insert(protData);
-
-
                 queryWrapper.eq("farm_id", 21).eq("prot_type", 3);
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
-                if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(ph) < Double.parseDouble(protThreshold.getOther3())) {
+                if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh2())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("排污口ph值为" + ph + "达到红色预警");
                     protWarningInfo.setWarningType(1);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
                     protWarningInfo.setBuildLocation("排污口");
                     warningInfoMapper.insert(protWarningInfo);
                 }
-                if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh1()) || Double.parseDouble(ph) < Double.parseDouble(protThreshold.getOther2())) {
+                if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh1())) {
                     ProtWarningInfo protWarningInfo = new ProtWarningInfo();
                     protWarningInfo.setWarningContent("排污口ph值为" + ph + "达到橙色预警");
                     protWarningInfo.setWarningType(1);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -401,6 +385,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("排污口cod值为" + cod + "达到红色预警");
                     protWarningInfo.setWarningType(0);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -412,6 +397,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("排污口cod值为" + cod + "达到橙色预警");
                     protWarningInfo.setWarningType(0);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -423,6 +409,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("排污口NH3N值为" + nh3n + "达到红色预警");
                     protWarningInfo.setWarningType(2);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -434,6 +421,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("排污口NH3N值为" + nh3n + "达到橙色预警");
                     protWarningInfo.setWarningType(2);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -445,6 +433,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("排污口TP值为" + tp + "达到红色预警");
                     protWarningInfo.setWarningType(3);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -456,6 +445,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("排污口TP值为" + tp + "达到橙色预警");
                     protWarningInfo.setWarningType(3);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -467,6 +457,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("排污口TN值为" + tn + "达到红色预警");
                     protWarningInfo.setWarningType(4);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -478,6 +469,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("排污口TN值为" + tn + "达到橙色预警");
                     protWarningInfo.setWarningType(4);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -489,6 +481,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("排污口累计流量值为" + flow + "达到红色预警");
                     protWarningInfo.setWarningType(5);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);
@@ -500,6 +493,7 @@ public class ProtTimer {
                     protWarningInfo.setWarningContent("排污口累计流量值为" + flow + "达到橙色预警");
                     protWarningInfo.setWarningType(5);
                     protWarningInfo.setFarmId(protThreshold.getFarmId());
+                    protWarningInfo.setWarningType(i);
                     protWarningInfo.setDate(new Date());
                     protWarningInfo.setUserIds(protThreshold.getUserIds());
                     protWarningInfo.setDeviceId(i);