|
@@ -67,11 +67,12 @@ public class EcoDryListServiceImpl extends ServiceImpl<EcoDryListMapper, EcoDryL
|
|
|
String dryDuration = "0";
|
|
|
//常温阈值
|
|
|
String dryNormalTemp = "0";
|
|
|
- if(thresholdJo == null){
|
|
|
- dryTem = thresholdJo.getString("dryTem");
|
|
|
- dryMin = thresholdJo.getString("dryMin");
|
|
|
- dryDuration = thresholdJo.getString("dryDuration");
|
|
|
- dryNormalTemp = thresholdJo.getString("dryNormalTemp");
|
|
|
+ System.out.println("thresholdJo>>>>>>>>>>>>>>>>>>>>>>>"+thresholdJo);
|
|
|
+ if (thresholdJo != null) {
|
|
|
+ dryTem = thresholdJo.getString("dryTem");
|
|
|
+ dryMin = thresholdJo.getString("dryMin");
|
|
|
+ dryDuration = thresholdJo.getString("dryDuration");
|
|
|
+ dryNormalTemp = thresholdJo.getString("dryNormalTemp");
|
|
|
}
|
|
|
String farmId = thresholdJo.getString("farmId");
|
|
|
DateUtil dateUtil = new DateUtil();
|
|
@@ -81,10 +82,16 @@ public class EcoDryListServiceImpl extends ServiceImpl<EcoDryListMapper, EcoDryL
|
|
|
String location = deviceMap.get("pigpen_name") + "";
|
|
|
//保存烘干设备记录列表
|
|
|
if (deviceType == 2) {
|
|
|
+ System.out.println("1.");
|
|
|
//判断上次间隔时间(读取该设备上次添加时间),超过一次洗消烘干的标准周期时间
|
|
|
if (isOverdue(deviceCode, farmId, todayTime, dryDuration)) {
|
|
|
- //判断是否高温(高温且超过一次烘干持续时间需要进行烘干高温记录)
|
|
|
- if (new BigDecimal(temp).compareTo(new BigDecimal(dryTem)) != -1) {
|
|
|
+ System.out.println("1.1");
|
|
|
+ System.out.println("temp=" + temp);
|
|
|
+ System.out.println("dryTem=" + dryTem);
|
|
|
+ //超过2次烘干之间的规定间隔时间,判断是否高温(高温且超过一次烘干持续时间需要进行烘干高温记录)
|
|
|
+// if (new BigDecimal(temp).compareTo(new BigDecimal(dryTem)) != -1) {
|
|
|
+ if (Float.parseFloat(temp) >= Float.parseFloat(dryTem)) {
|
|
|
+ System.out.println("1.2");
|
|
|
EcoDryList ecoDryList = new EcoDryList();
|
|
|
ecoDryList.setDeviceCode(deviceCode);
|
|
|
ecoDryList.setLocation(location);
|
|
@@ -94,6 +101,7 @@ public class EcoDryListServiceImpl extends ServiceImpl<EcoDryListMapper, EcoDryL
|
|
|
ecoDryListMapper.insert(ecoDryList);
|
|
|
System.out.println("保存");
|
|
|
} else {
|
|
|
+ System.out.println("1.3");
|
|
|
EcoDryList ecoDryList = new EcoDryList();
|
|
|
ecoDryList.setDeviceCode(deviceCode);
|
|
|
ecoDryList.setLocation(location);
|
|
@@ -101,31 +109,34 @@ public class EcoDryListServiceImpl extends ServiceImpl<EcoDryListMapper, EcoDryL
|
|
|
ecoDryList.setAddTime(todayTime);
|
|
|
ecoDryList.setFarmId(Integer.parseInt(farmId));
|
|
|
ecoDryListMapper.insert(ecoDryList);
|
|
|
- newLowDryTempWarningInfo(temp, dryNormalTemp, dryTem, dateUtil.formatDateTime(todayTime),farmId,location);
|
|
|
+ System.out.println("处理温度不达标。");
|
|
|
+ newLowDryTempWarningInfo(temp, dryNormalTemp, dryTem, dateUtil.formatDateTime(todayTime), farmId, location);
|
|
|
}
|
|
|
} else {
|
|
|
- //判断当前温度是否介于烘干温度阈值和常温阈值之间,即可报警
|
|
|
- newLowDryTempWarningInfo(temp, dryNormalTemp, dryTem, dateUtil.formatDateTime(todayTime),farmId,location);
|
|
|
+ System.out.println("2.");
|
|
|
+ //未超过2次烘干之间的规定间隔时间,判断当前温度是否介于烘干温度阈值和常温阈值之间,即可报警
|
|
|
+ newLowDryTempWarningInfo(temp, dryNormalTemp, dryTem, dateUtil.formatDateTime(todayTime), farmId, location);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//新建洗消烘干温度不足报警记录
|
|
|
private void newLowDryTempWarningInfo(String temp, String dryNormalTemp, String dryTem, String todayTime, String farmId, String location) {
|
|
|
- System.out.println("44 temp="+temp);
|
|
|
- System.out.println("44 dryNormalTemp="+dryNormalTemp);
|
|
|
- System.out.println("44 dryTem="+dryTem);
|
|
|
+ System.out.println("# 开始处理烘干温度不足的场景 #");
|
|
|
+ System.out.println("44 temp=" + temp);
|
|
|
+ System.out.println("44 dryNormalTemp=" + dryNormalTemp);
|
|
|
+ System.out.println("44 dryTem=" + dryTem);
|
|
|
|
|
|
if (Float.parseFloat(temp) > Float.parseFloat(dryNormalTemp) && Float.parseFloat(temp) < Float.parseFloat(dryTem)) {
|
|
|
System.out.println("烘干温度未达到烘干温度阈值");
|
|
|
//烘干温度未达标,发送烘干警报
|
|
|
- String alarmInfo = todayTime + " "+location+"当前温度" + temp + "°,未达到烘干阈值温度" + dryTem + "°";
|
|
|
- System.out.println("alarmInfo="+alarmInfo);
|
|
|
- System.out.println("farmId="+farmId);
|
|
|
- System.out.println("todayTime="+todayTime);
|
|
|
- System.out.println("todayTime="+todayTime);
|
|
|
+ String alarmInfo = todayTime + " " + location + "当前温度" + temp + "°,未达到烘干阈值温度" + dryTem + "°";
|
|
|
+ System.out.println("alarmInfo=" + alarmInfo);
|
|
|
+ System.out.println("farmId=" + farmId);
|
|
|
+ System.out.println("todayTime=" + todayTime);
|
|
|
+ System.out.println("todayTime=" + todayTime);
|
|
|
//发送低烘干温度报警
|
|
|
- sendLowDryTempAlarm(alarmInfo,farmId,todayTime,todayTime);
|
|
|
+ sendLowDryTempAlarm(alarmInfo, farmId, todayTime, todayTime);
|
|
|
} else if (Float.parseFloat(temp) >= Float.parseFloat(dryTem)) {
|
|
|
// System.out.println("烘干温度已达到烘干温度阈值");
|
|
|
} else {
|
|
@@ -149,7 +160,7 @@ public class EcoDryListServiceImpl extends ServiceImpl<EcoDryListMapper, EcoDryL
|
|
|
map.put("alarmType", "0");
|
|
|
HttpEntity<Map<String, Object>> objectHttpEntity = new HttpEntity<>(map, httpHeaders);
|
|
|
System.out.println("URL_WARNING_SERVICE=" + URL_WARNING_SERVICE);
|
|
|
- System.out.println("map>>>>>>>>>>>>>>>>>"+map);
|
|
|
+ System.out.println("map>>>>>>>>>>>>>>>>>" + map);
|
|
|
ResponseEntity<String> entity = restTemplate.postForEntity(URL_WARNING_SERVICE, objectHttpEntity, String.class);
|
|
|
JSONObject thresholdJo = JSONObject.parseObject(entity.getBody());
|
|
|
// if (thresholdJo.getInteger("code") != 10000) {
|
|
@@ -206,15 +217,15 @@ public class EcoDryListServiceImpl extends ServiceImpl<EcoDryListMapper, EcoDryL
|
|
|
//farmId
|
|
|
String farmId = paramsMap.get("farmId");
|
|
|
QueryWrapper<EcoDryList> queryWrapper = new QueryWrapper();
|
|
|
- queryWrapper.eq("farm_id",farmId);
|
|
|
+ queryWrapper.eq("farm_id", farmId);
|
|
|
queryWrapper.orderByDesc("add_time");
|
|
|
Page<EcoDryList> page = new Page<>(Integer.parseInt(pageNo), Integer.parseInt(pageSize));
|
|
|
Page<EcoDryList> pageEcoDryList = ecoDryListMapper.selectPage(page, queryWrapper);
|
|
|
List<EcoDryList> ecoDryListList = pageEcoDryList.getRecords();
|
|
|
List dataList = new ArrayList();
|
|
|
- for(EcoDryList ecoDryList:ecoDryListList){
|
|
|
+ for (EcoDryList ecoDryList : ecoDryListList) {
|
|
|
JSONObject ecoDryJo = JSONObject.parseObject(JSONObject.toJSONString(ecoDryList));
|
|
|
- ecoDryJo.put("addTime",dateUtil.formatDateTime(ecoDryList.getAddTime()));
|
|
|
+ ecoDryJo.put("addTime", dateUtil.formatDateTime(ecoDryList.getAddTime()));
|
|
|
dataList.add(ecoDryJo);
|
|
|
}
|
|
|
pageEcoDryList.setRecords(dataList);
|