|
@@ -35,43 +35,41 @@ public class ProtTimer {
|
|
|
private void getShenChan() throws Exception {
|
|
|
|
|
|
|
|
|
-
|
|
|
for (int i = 1; i < 4; i++) {
|
|
|
|
|
|
//假设已经拿到了数据
|
|
|
- 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 num = NumberUtils.getNumFloat(6.4, 8.6);//ph
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- //排污口专用数据
|
|
|
- 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())) {
|
|
|
+ if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) {
|
|
|
ProtWarningInfo protWarningInfo = new ProtWarningInfo();
|
|
|
protWarningInfo.setWarningContent("进污口ph值为" + num + "达到红色预警");
|
|
|
protWarningInfo.setWarningType(1);
|
|
@@ -82,7 +80,7 @@ public class ProtTimer {
|
|
|
protWarningInfo.setBuildLocation("进污口");
|
|
|
warningInfoMapper.insert(protWarningInfo);
|
|
|
}
|
|
|
- if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1())) {
|
|
|
+ if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther2())) {
|
|
|
ProtWarningInfo protWarningInfo = new ProtWarningInfo();
|
|
|
protWarningInfo.setWarningContent("进污口ph值为" + num + "达到橙色预警");
|
|
|
protWarningInfo.setWarningType(1);
|
|
@@ -203,28 +201,40 @@ 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())) {
|
|
|
+ if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) {
|
|
|
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())) {
|
|
|
+ if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh1()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther2())) {
|
|
|
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);
|
|
@@ -236,7 +246,6 @@ 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);
|
|
@@ -248,7 +257,6 @@ 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);
|
|
@@ -260,7 +268,6 @@ 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);
|
|
@@ -272,7 +279,6 @@ 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);
|
|
@@ -284,7 +290,6 @@ 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);
|
|
@@ -296,7 +301,6 @@ 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);
|
|
@@ -308,7 +312,6 @@ 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);
|
|
@@ -320,7 +323,6 @@ 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);
|
|
@@ -332,7 +334,6 @@ 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);
|
|
@@ -344,7 +345,6 @@ 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,26 +354,42 @@ 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())) {
|
|
|
+ if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(ph) < Double.parseDouble(protThreshold.getOther3())) {
|
|
|
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())) {
|
|
|
+ if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh1()) || Double.parseDouble(ph) < Double.parseDouble(protThreshold.getOther2())) {
|
|
|
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);
|
|
@@ -385,7 +401,6 @@ 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);
|
|
@@ -397,7 +412,6 @@ 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);
|
|
@@ -409,7 +423,6 @@ 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);
|
|
@@ -421,7 +434,6 @@ 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);
|
|
@@ -433,7 +445,6 @@ 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);
|
|
@@ -445,7 +456,6 @@ 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);
|
|
@@ -457,7 +467,6 @@ 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);
|
|
@@ -469,7 +478,6 @@ 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);
|
|
@@ -481,7 +489,6 @@ 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);
|
|
@@ -493,7 +500,6 @@ 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);
|