Explorar el Código

生成新牧场

wwh hace 2 años
padre
commit
19af290863

+ 29 - 0
huimv-admin/src/main/java/com/huimv/admin/timer/EnvTimer.java

@@ -225,6 +225,35 @@ public class EnvTimer {
             envData.setEnvHum(hum);
             envDataService.save(envData);
         }
+
+        Integer farmId3 = 26;
+        List<BasePigpen> list3 = basePigpenService.list(new QueryWrapper<BasePigpen>().eq("farm_id", farmId3).eq("f_type", 3).ne("id", 242));
+//        String url="https://restapi.amap.com/v3/weather/weatherInfo?parameters&key=c1d8179ed2dda7ed48c56bed06c0c86e&city=330782&extensions=base&output=JSON";
+//        String result = HttpUtil.get(url);
+//        WeatherDto weatherDto = JSONUtil.toBean(result, WeatherDto.class);
+//        List<WeatherLives> lives = weatherDto.getLives();
+//        WeatherLives weatherLives = lives.get(0);
+//        int humidity = Integer.parseInt(weatherLives.getHumidity());
+//        int temperature = Integer.parseInt(weatherLives.getTemperature());
+
+        for (BasePigpen basePigpen : list3) {
+            EnvData envData = new EnvData();
+            envData.setCreateTime(new Date());
+            envData.setFarmId(farmId3);
+            envData.setUnitId(basePigpen.getId());
+            EnvDevice envDevice = new EnvDevice();
+            envDevice.setUnitName(basePigpen.getBuildName());
+            envDevice.setUnitId(basePigpen.getId());
+            envDevice.setFarmId(farmId3);
+
+            String tem = NumberUtils.getNum(17, 23, 1);
+            String hum = NumberUtils.getNum(65, 80, 0);
+            saveTemWarning(tem, envWarningThreshold2, envDevice, farmId3);
+            envData.setEnvTemp(tem);
+            saveHumWarning(hum, envWarningThreshold2, envDevice, farmId3);
+            envData.setEnvHum(hum);
+            envDataService.save(envData);
+        }
     }
 
     public void saveHumWarning(String val, EnvWarningThreshold envWarningThreshold, EnvDevice envDevice, Integer farmId) {

+ 22 - 10
huimv-admin/src/main/java/com/huimv/admin/timer/GasTimer.java

@@ -31,7 +31,7 @@ public class  GasTimer {
     private void getShenChan() throws Exception {
 
         String type = NumberUtils.getNum(1, 5, 0);//loc_type
-        for (int i = 1; i < 13; i++) {
+        for (int i = 1; i < 17; i++) {
 
             String nh3n = NumberUtils.getNumFloat(0.0, 10.5);//NH3N
             String jlm = NumberUtils.getNumFloat(0.0, 10.5);//jlm
@@ -52,7 +52,10 @@ public class  GasTimer {
             gasData.setByx(byx);
             gasData.setCh3sh(ch3);
             gasData.setSja(sja);
-            if (i > 8) {
+            if (i > 12) {
+                gasData.setLoctionType(i - 12);//横路
+                gasData.setFarmId(26);
+            } else if (i > 8) {
                 gasData.setLoctionType(i - 8);//浦江
                 gasData.setFarmId(23);
             } else if (i > 4) {
@@ -67,15 +70,17 @@ public class  GasTimer {
 
             QueryWrapper<GasThreshold> queryWrapper = new QueryWrapper<>();
             GasWarningInfo warningInfo = new GasWarningInfo();
-            if (i==1||i==5||i==9) {
+            if (i==1||i==5||i==9||i==13) {
                 String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
                 gasData.setCq(cq);
                 if (i == 1) {
                     queryWrapper.eq("farm_id", 21).eq("gas_type", 1);
                 } else if (i == 5) {
                     queryWrapper.eq("farm_id", 24).eq("gas_type", 1);
-                } else {
+                } else if (i == 9) {
                     queryWrapper.eq("farm_id", 23).eq("gas_type", 1);
+                } else {
+                    queryWrapper.eq("farm_id", 26).eq("gas_type", 1);
                 }
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
@@ -160,15 +165,17 @@ public class  GasTimer {
                     warningInfoMapper.insert(warningInfo);
                 }
 
-            } else if (i==2||i==6||i==10) {
+            } else if (i==2||i==6||i==10||i==14) {
                 String cq = NumberUtils.getNumFloat(0.0, 5000.5);//cq
                 gasData.setCq(cq);
                 if (i == 2) {
                     queryWrapper.eq("farm_id", 21).eq("gas_type", 2);
                 } else if (i == 6) {
                     queryWrapper.eq("farm_id", 24).eq("gas_type", 2);
-                } else {
+                } else if (i == 10) {
                     queryWrapper.eq("farm_id", 23).eq("gas_type", 2);
+                } else {
+                    queryWrapper.eq("farm_id", 26).eq("gas_type", 2);
                 }
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
@@ -254,15 +261,18 @@ public class  GasTimer {
                     warningInfoMapper.insert(warningInfo);
                 }
 
-            } else if (i==3||i==7||i==11) {
+            } else if (i==3||i==7||i==11||i==15) {
                 String cq = NumberUtils.getNumFloat(0.0, 1000.5);//cq
                 gasData.setCq(cq);
                 if (i == 3) {
                     queryWrapper.eq("farm_id", 21).eq("gas_type", 3);
                 } else if (i == 7) {
                     queryWrapper.eq("farm_id", 24).eq("gas_type", 3);
-                } else {
+                } else if (i == 11) {
                     queryWrapper.eq("farm_id", 23).eq("gas_type", 3);
+                } else {
+                    queryWrapper.eq("farm_id", 26).eq("gas_type", 3);
+
                 }
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {
@@ -348,15 +358,17 @@ public class  GasTimer {
                     warningInfoMapper.insert(warningInfo);
                 }
 
-            } else if (i==4||i==8||i==12) {
+            } else if (i==4||i==8||i==12||i==16) {
                 String cq = NumberUtils.getNumFloat(0.0, 10000.5);//cq
                 gasData.setCq(cq);
                 if (i == 4) {
                     queryWrapper.eq("farm_id", 21).eq("gas_type", 4);
                 } else if (i == 8) {
                     queryWrapper.eq("farm_id", 24).eq("gas_type", 4);
-                } else {
+                } else if (i == 12) {
                     queryWrapper.eq("farm_id", 23).eq("gas_type", 4);
+                } else {
+                    queryWrapper.eq("farm_id", 26).eq("gas_type", 4);
                 }
                 GasThreshold gasThreshold = thresholdMapper.selectOne(queryWrapper);
                 if (Double.parseDouble(nh3n) > Double.parseDouble(gasThreshold.getNh3N())) {

+ 17 - 8
huimv-admin/src/main/java/com/huimv/admin/timer/ProtTimer.java

@@ -31,7 +31,7 @@ public class ProtTimer {
     private void getShenChan() throws Exception {
 
 
-        for (int i = 1; i < 10; i++) {
+        for (int i = 1; i < 13; i++) {
             //假设已经拿到了数据
             String num = NumberUtils.getNumFloat(6.4, 8.6);//ph
 
@@ -44,15 +44,18 @@ public class ProtTimer {
             } else if (i < 7) {
                 protData.setLoctionType(i - 3);
                 protData.setFarmId(24);//东阳
-            } else {
+            } else if (i < 10) {
                 protData.setLoctionType(i - 6);
                 protData.setFarmId(23);//浦江
+            } else {
+                protData.setLoctionType(i - 9);
+                protData.setFarmId(26);//横路
             }
 
             protData.setPh(num);
 
             QueryWrapper<ProtThreshold> queryWrapper = new QueryWrapper<>();
-            if (i == 1||i==4||i==7) {
+            if (i == 1||i==4||i==7||i==10) {
                 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
@@ -70,8 +73,10 @@ public class ProtTimer {
                     queryWrapper.eq("farm_id", 21).eq("prot_type", 1);
                 } else if (i == 4) {
                     queryWrapper.eq("farm_id", 24).eq("prot_type", 1);
-                } else {
+                } else if (i == 7) {
                     queryWrapper.eq("farm_id", 23).eq("prot_type", 1);
+                } else {
+                    queryWrapper.eq("farm_id", 26).eq("prot_type", 1);
                 }
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
                 if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) {
@@ -208,7 +213,7 @@ public class ProtTimer {
                 }
 
             }
-            if (i == 2 || i == 5 || i == 8) {
+            if (i == 2 || i == 5 || i == 8||i==11) {
                 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
@@ -226,8 +231,10 @@ public class ProtTimer {
                     queryWrapper.eq("farm_id", 21).eq("prot_type", 2);
                 } else if (i == 5) {
                     queryWrapper.eq("farm_id", 24).eq("prot_type", 2);
-                } else {
+                } else if (i == 8) {
                     queryWrapper.eq("farm_id", 23).eq("prot_type", 2);
+                } else {
+                    queryWrapper.eq("farm_id", 26).eq("prot_type", 2);
                 }
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//污口
                 if (Double.parseDouble(num) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(num) < Double.parseDouble(protThreshold.getOther3())) {
@@ -364,7 +371,7 @@ public class ProtTimer {
                 }
 
             }
-            if (i == 3 || i == 6 || i == 9) {
+            if (i == 3 || i == 6 || i == 9||i==12) {
                 //排污口专用数据
                 String ph = NumberUtils.getNumFloat(6.6, 8.4);//ph
                 String cod = NumberUtils.getNum(0, 380, 0);//cod
@@ -386,8 +393,10 @@ public class ProtTimer {
                     queryWrapper.eq("farm_id", 21).eq("prot_type", 3);
                 } else if (i == 6) {
                     queryWrapper.eq("farm_id", 24).eq("prot_type", 3);
-                } else {
+                } else if (i == 9) {
                     queryWrapper.eq("farm_id", 23).eq("prot_type", 3);
+                } else {
+                    queryWrapper.eq("farm_id", 26).eq("prot_type", 3);
                 }
                 ProtThreshold protThreshold = protThresholdMapper.selectOne(queryWrapper);//进污口
                 if (Double.parseDouble(ph) > Double.parseDouble(protThreshold.getPh2()) || Double.parseDouble(ph) < Double.parseDouble(protThreshold.getOther3())) {

+ 41 - 0
huimv-admin/src/main/java/com/huimv/admin/timer/ShenChanTimer.java

@@ -47,6 +47,7 @@ public class ShenChanTimer {
         farmIds.add(21);
         farmIds.add(23);
         farmIds.add(24);
+        farmIds.add(26);
         String time = LocalDate.now().toString();
         String token = login();
 //        System.out.println("token"+token);
@@ -182,6 +183,46 @@ public class ShenChanTimer {
                     }
 
                 }
+
+                if ("横路".equals(stock.get(0))){
+                    if (ObjectUtil.isNotEmpty(prodStock)){
+//                        prodStock.setZzcl(Integer.parseInt(stock.get(11).toString()));
+                        prodStock.setZzcl(9980);
+//                        prodStock.setByzcl(Integer.parseInt(stock.get(13).toString()));
+                        prodStock.setByzcl(16384);
+//                        prodStock.setYfzcl(Integer.parseInt(stock.get(14).toString()));
+                        prodStock.setYfzcl(32999);
+//                        prodStock.setZcl(Integer.parseInt(stock.get(15).toString()));
+                        prodStock.setZcl(66381);
+                        prodStock.setCreatTime(new Date());
+                        prodStock.setFarmId(26);
+                        prodStockService.updateById(prodStock);
+                        System.out.println("横路--》");
+                    }else {
+                        prodStock = new ProdStock();
+//                        prodStock.setZzcl(Integer.parseInt(stock.get(11).toString()));
+                        prodStock.setZzcl(9980);
+//                        prodStock.setByzcl(Integer.parseInt(stock.get(13).toString()));
+                        prodStock.setByzcl(16384);
+//                        prodStock.setYfzcl(Integer.parseInt(stock.get(14).toString()));
+                        prodStock.setYfzcl(32999);
+//                        prodStock.setZcl(Integer.parseInt(stock.get(15).toString()));
+                        prodStock.setZcl(66381);
+                        prodStock.setMzcl(100);
+                        prodStock.setGzcl(200);
+                        prodStock.setBrzcl(452);
+                        prodStock.setHbzcl(100);
+                        prodStock.setRszcl(30);
+                        prodStock.setBrmzcl(20);
+                        prodStock.setKhzcl(212);
+                        prodStock.setSpzcl(1020);
+                        prodStock.setCreatTime(new Date());
+                        prodStock.setFarmId(26);
+                        prodStockService.save(prodStock);
+                        System.out.println("横路--》");
+                    }
+
+                }
             }
         }
     }