一小时内不重复告警
This commit is contained in:
parent
60780c0d35
commit
85b598a712
|
|
@ -1,5 +1,6 @@
|
||||||
package com.lanhai.service.Impl;
|
package com.lanhai.service.Impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
//import cn.hutool.extra.mail.MailUtil;
|
//import cn.hutool.extra.mail.MailUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
|
@ -22,11 +23,13 @@ import com.lanhai.service.ISurvAlertRecordService;
|
||||||
import com.lanhai.service.ISurvDeviceDeployService;
|
import com.lanhai.service.ISurvDeviceDeployService;
|
||||||
import com.lanhai.service.ISurvStationInfoService;
|
import com.lanhai.service.ISurvStationInfoService;
|
||||||
import com.lanhai.util.DataUtil;
|
import com.lanhai.util.DataUtil;
|
||||||
|
import com.xxl.job.core.context.XxlJobHelper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -127,6 +130,23 @@ public class SurvAlertRecordServiceImpl extends ServiceImpl<SurvAlertRecordMappe
|
||||||
String mn = baowenMap.get("mn");
|
String mn = baowenMap.get("mn");
|
||||||
String DataTime = baowenMap.get("DataTime");
|
String DataTime = baowenMap.get("DataTime");
|
||||||
if(deviceDeploy != null){
|
if(deviceDeploy != null){
|
||||||
|
//检查该设备上一次的数据,如果在60分钟以内,不报警
|
||||||
|
SurvAlertRecord lastBaojing = lambdaQuery()
|
||||||
|
.eq(SurvAlertRecord::getDeployId,deviceDeploy.getId())
|
||||||
|
.orderByDesc(SurvAlertRecord::getAlertTime)
|
||||||
|
.last("limit 1")
|
||||||
|
.one();
|
||||||
|
if(lastBaojing != null){
|
||||||
|
if(lastBaojing.getAlertTime()!=null){
|
||||||
|
long times = DateUtil.between(lastBaojing.getAlertTime(), new Date(),DateUnit.MINUTE);
|
||||||
|
if(times<=60){
|
||||||
|
XxlJobHelper.log("&&&&&设备:{},编号:{},在60分钟以内,不报警&&&&&",deviceDeploy.getDeployDes(),deviceDeploy.getDeployCode());
|
||||||
|
log.error("&&&&&设备:{},编号:{},在60分钟以内,不报警&&&&",deviceDeploy.getDeployDes(),deviceDeploy.getDeployCode());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LinkedHashMap<String, JSONObject> zhibiaomap = zhibiaoService.getAllZhiBiao(deviceDeploy.getScEquZhibiaoList());
|
LinkedHashMap<String, JSONObject> zhibiaomap = zhibiaoService.getAllZhiBiao(deviceDeploy.getScEquZhibiaoList());
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
JSONArray jsonarr = new JSONArray();
|
JSONArray jsonarr = new JSONArray();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue