|
@@ -73,7 +73,7 @@ public class EnvTimer {
|
|
|
//目前是这家
|
|
|
Integer farmId = 21;
|
|
|
String encode = loginOnly();
|
|
|
- System.out.println("encode" + encode);
|
|
|
+// System.out.println("encode" + encode);
|
|
|
//获取阈值
|
|
|
EnvWarningThreshold envWarningThreshold = envWarningThresholdService.getOne(new QueryWrapper<EnvWarningThreshold>().eq("farm_id", farmId));
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
@@ -129,20 +129,20 @@ public class EnvTimer {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Scheduled(cron = "0 0/12 * * * ? ")
|
|
|
+ @Scheduled(cron = "0 0/12 * * * ?")
|
|
|
@Transactional
|
|
|
public void getHuanKongs() {
|
|
|
Integer farmId = 21;
|
|
|
EnvWarningThreshold envWarningThreshold = envWarningThresholdService.getOne(new QueryWrapper<EnvWarningThreshold>().eq("farm_id", farmId));
|
|
|
|
|
|
List<BasePigpen> list = basePigpenService.list(new QueryWrapper<BasePigpen>().eq("farm_id", farmId).eq("f_type", 3).ne("id", 178).ne("id", 181));
|
|
|
- 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());
|
|
|
+// 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 : list) {
|
|
|
EnvData envData = new EnvData();
|
|
@@ -154,8 +154,8 @@ public class EnvTimer {
|
|
|
envDevice.setUnitId(basePigpen.getId());
|
|
|
envDevice.setFarmId(farmId);
|
|
|
|
|
|
- String tem = NumberUtils.getNum(temperature-3, temperature+3, 1);
|
|
|
- String hum = NumberUtils.getNum(humidity-3, humidity+3, 0);
|
|
|
+ String tem = NumberUtils.getNum(17, 23, 1);
|
|
|
+ String hum = NumberUtils.getNum(65, 80, 0);
|
|
|
saveTemWarning(tem, envWarningThreshold, envDevice, farmId);
|
|
|
envData.setEnvTemp(tem);
|
|
|
saveHumWarning(hum, envWarningThreshold, envDevice, farmId);
|
|
@@ -271,7 +271,7 @@ public class EnvTimer {
|
|
|
queryWrapper.eq("farm_id", farmId);
|
|
|
Integer count = envDeviceService.count(queryWrapper);
|
|
|
QueryWrapper<EnvDevice> queryWrapper1 = new QueryWrapper<>();
|
|
|
- queryWrapper1.eq("device_status", 1);
|
|
|
+ queryWrapper1.eq("device_status", 0);
|
|
|
Integer count1 = envDeviceService.count(queryWrapper1);
|
|
|
Integer OffDeviceCount = count - count1;
|
|
|
//创建一个数值格式化对象
|