Browse Source

数据预警修改2.0

wwh 2 years ago
parent
commit
39e589f89b

+ 6 - 5
huimv-admin/src/main/java/com/huimv/admin/timer/GasTimer.java

@@ -37,7 +37,7 @@ public class GasTimer {
 
 
 
-        QueryWrapper<GasThreshold> queryWrapper = new QueryWrapper<>();
+
         for (int i = 1; i < 5; i++) {
 
             String nh3n = NumberUtils.getNum(10, 20, 1);//NH3N
@@ -66,8 +66,9 @@ public class GasTimer {
             gasData.setCreateTime(new Date());
             gasDataMapper.insert(gasData);
 
+            QueryWrapper<GasThreshold> queryWrapper = new QueryWrapper<>();
             GasWarningInfo warningInfo = new GasWarningInfo();
-            if ("1".equals(i)) {
+            if (i==1) {
                 queryWrapper.eq("farm_id", 21).eq("gas_type", 1);
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
@@ -113,7 +114,7 @@ public class GasTimer {
                 warningInfo.setUserIds(gasThreshold.getUserIds());
                 warningInfoMapper.insert(warningInfo);
 
-            } else if ("2".equals(i)) {
+            } else if (i==2) {
                 queryWrapper.eq("farm_id", 21).eq("gas_type", 2);
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
@@ -159,7 +160,7 @@ public class GasTimer {
                 warningInfo.setFarmId(gasThreshold.getFarmId());
                 warningInfo.setUserIds(gasThreshold.getUserIds());
                 warningInfoMapper.insert(warningInfo);
-            } else if ("3".equals(i)) {
+            } else if (i==3) {
                 queryWrapper.eq("farm_id", 21).eq("gas_type", 3);
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
@@ -205,7 +206,7 @@ public class GasTimer {
                 warningInfo.setFarmId(gasThreshold.getFarmId());
                 warningInfo.setUserIds(gasThreshold.getUserIds());
                 warningInfoMapper.insert(warningInfo);
-            } else if ("4".equals(i)) {
+            } else if (i==4) {
                 queryWrapper.eq("farm_id", 21).eq("gas_type", 4);
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {

+ 5 - 4
huimv-admin/src/main/java/com/huimv/admin/timer/ProtTimer.java

@@ -38,7 +38,7 @@ public class ProtTimer {
 
 
 
-        QueryWrapper<ProtThreshold> queryWrapper = new QueryWrapper<>();
+
         for (int i = 1; i < 4; i++) {
 
 
@@ -63,7 +63,8 @@ public class ProtTimer {
             protData.setFlow(num5);
             protDataMapper.insert(protData);
 
-            if ("1".equals(i)) {
+            QueryWrapper<ProtThreshold> queryWrapper = new QueryWrapper<>();
+            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())) {
@@ -109,7 +110,7 @@ public class ProtTimer {
                 protWarningInfo.setDeviceId(i);
                 protWarningInfo.setBuildLocation("进污口");
                 warningInfoMapper.insert(protWarningInfo);
-            } else if ("2".equals(i)) {
+            } else 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())) {
@@ -156,7 +157,7 @@ public class ProtTimer {
                 protWarningInfo.setDeviceId(i);
                 protWarningInfo.setBuildLocation("处理口");
                 warningInfoMapper.insert(protWarningInfo);
-            } else if ("3".equals(i)) {
+            } else 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())) {