|
@@ -115,10 +115,11 @@ public class CarmeraTimer {
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.add("Authorization",encode);
|
|
|
HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
|
|
|
- //只有一家,先拿全部
|
|
|
+ //TODO 只有一家,先拿全部
|
|
|
List<EnvDevice> list = envDeviceService.list();
|
|
|
for (EnvDevice envDevice : list) {
|
|
|
if (ObjectUtil.isNotEmpty(envDevice) && StringUtils.isNotBlank(envDevice.getDeviceCode())){
|
|
|
+ System.out.println(envDevice.getDeviceCode());
|
|
|
ResponseEntity<String> exchange = restTemplate.exchange("https://yzwlw.loongk.com/mobile/loadShackDatas/" + envDevice.getDeviceCode(), HttpMethod.GET, requestEntity, String.class);
|
|
|
String shishiBody = exchange.getBody();
|
|
|
if (ObjectUtil.isEmpty(shishiBody)){
|
|
@@ -146,7 +147,7 @@ public class CarmeraTimer {
|
|
|
envData.setDeviceId(envDevice.getDeviceCode());
|
|
|
envData.setFarmId(farmId);
|
|
|
envData.setUnitId(envDevice.getUnitId());
|
|
|
- envDataService.save(envData);
|
|
|
+// envDataService.save(envData);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -207,7 +208,8 @@ public class CarmeraTimer {
|
|
|
}else {
|
|
|
minTem =envWarningThreshold.getMinTem();
|
|
|
}
|
|
|
- if (Double.parseDouble(maxTem) > Double.parseDouble(val)){
|
|
|
+ System.out.println("maxTem:"+Double.parseDouble(maxTem)+" minTem:"+Double.parseDouble(minTem)+" val:"+Double.parseDouble(val));
|
|
|
+ if (Double.parseDouble(maxTem) < Double.parseDouble(val)){
|
|
|
EnvWarningInfo envWarningInfo = new EnvWarningInfo();
|
|
|
envWarningInfo.setBuildLocation(envDevice.getUnitName());
|
|
|
envWarningInfo.setDate(new Date());
|
|
@@ -218,8 +220,9 @@ public class CarmeraTimer {
|
|
|
envWarningInfo.setUserIds(envWarningThreshold.getUserIds());
|
|
|
envWarningInfo.setWarningContent("当前温度为"+val+"°超过阈值,请及时检查");
|
|
|
envWarningInfo.setWarningType(1);
|
|
|
+ envWarningInfoService.save(envWarningInfo);
|
|
|
}
|
|
|
- if (Double.parseDouble(minTem) <Double.parseDouble(val)){
|
|
|
+ if (Double.parseDouble(minTem)>Double.parseDouble(val)){
|
|
|
EnvWarningInfo envWarningInfo = new EnvWarningInfo();
|
|
|
envWarningInfo.setBuildLocation(envDevice.getUnitName());
|
|
|
envWarningInfo.setDate(new Date());
|
|
@@ -230,7 +233,7 @@ public class CarmeraTimer {
|
|
|
envWarningInfo.setUserIds(envWarningThreshold.getUserIds());
|
|
|
envWarningInfo.setWarningContent("当前温度为"+val+"°低于阈值,请及时检查");
|
|
|
envWarningInfo.setWarningType(1);
|
|
|
-
|
|
|
+ envWarningInfoService.save(envWarningInfo);
|
|
|
}
|
|
|
}
|
|
|
}
|