|
@@ -1811,6 +1811,17 @@ public class AsyncTask {
|
|
|
}else{//有告警信息
|
|
|
Date nowDate = DateUtils.getNowDate();
|
|
|
if(CollectionUtils.isEmpty(tXinyiWarningRecords)){//之前没有告警记录
|
|
|
+ //2024年7月18日16:23:11 新增逻辑,查询是否有连续升高的趋势,如果有才需要报警
|
|
|
+ List<TXinyiIndustry> tXinyiIndustries = this.xinyiIndustryMapper.selectNIndustry(INT_3);
|
|
|
+ if(CollectionUtils.isEmpty(tXinyiIndustries) || tXinyiIndustries.size() < 3){
|
|
|
+ log.error("处理生化报警时,获取最近的3条工业库数据失败~~~~~~~");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ TXinyiIndustry tXinyiIndustry1 = tXinyiIndustries.get(INDEX_1);//前一个小时
|
|
|
+ TXinyiIndustry tXinyiIndustry2 = tXinyiIndustries.get(INDEX_2);//前两个小时
|
|
|
+ if(!this.judgeContinuous(tXinyiIndustry1, tXinyiIndustry2, category)){
|
|
|
+ log.info("虽然当前超标了,但是没有连续升高趋势,所以不报警,当前没有报警出来的数据为{}\n,前一个小时数据为{}\n前两个小时数据为{}", JSON.toJSONString(tXinyiWarningRecord), JSON.toJSONString(tXinyiIndustry1), JSON.toJSONString(tXinyiIndustry2));
|
|
|
+ }
|
|
|
//保存到数据库中
|
|
|
//2024年7月15日11:06:16 因为只有一个告警记录,但是如果一直报警,现在报警时间取的是更新时间,兼容第一次报警处理
|
|
|
tXinyiWarningRecord.setUpdateTime(nowDate);
|
|
@@ -1848,6 +1859,64 @@ public class AsyncTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private boolean judgeContinuous(TXinyiIndustry tXinyiIndustry1, TXinyiIndustry tXinyiIndustry2, String category) {
|
|
|
+ boolean result = false;//默认不超标
|
|
|
+ if(BusinessEnum.WarningCategoryEnum.CS_COD.getCode().equals(category)){
|
|
|
+ BigDecimal csCod1 = tXinyiIndustry1.getCsCod();
|
|
|
+ BigDecimal csCod2 = tXinyiIndustry2.getCsCod();
|
|
|
+ if(!Objects.isNull(csCod1) && !Objects.isNull(csCod2) && csCod1.compareTo(csCod2) > INT_0)
|
|
|
+ result = true;
|
|
|
+ }else if(BusinessEnum.WarningCategoryEnum.CS_SS.getCode().equals(category)){
|
|
|
+ BigDecimal csSs1 = tXinyiIndustry1.getCsSs();
|
|
|
+ BigDecimal csSs2 = tXinyiIndustry2.getCsSs();
|
|
|
+ if(!Objects.isNull(csSs1) && !Objects.isNull(csSs2) && csSs1.compareTo(csSs2) > INT_0)
|
|
|
+ result = true;
|
|
|
+ }else if(BusinessEnum.WarningCategoryEnum.CS_ZD.getCode().equals(category)){
|
|
|
+ BigDecimal csTn1 = tXinyiIndustry1.getCsTn();
|
|
|
+ BigDecimal csTn2 = tXinyiIndustry2.getCsTn();
|
|
|
+ if(!Objects.isNull(csTn1) && !Objects.isNull(csTn2) && csTn1.compareTo(csTn2) > INT_0)
|
|
|
+ result = true;
|
|
|
+ }else if(BusinessEnum.WarningCategoryEnum.CS_ZL.getCode().equals(category)){
|
|
|
+ BigDecimal csTp1 = tXinyiIndustry1.getCsTp();
|
|
|
+ BigDecimal csTp2 = tXinyiIndustry2.getCsTp();
|
|
|
+ if(!Objects.isNull(csTp1) && !Objects.isNull(csTp2) && csTp1.compareTo(csTp2) > INT_0)
|
|
|
+ result = true;
|
|
|
+ }else if(BusinessEnum.WarningCategoryEnum.CS_AD.getCode().equals(category)){
|
|
|
+ BigDecimal csNh31 = tXinyiIndustry1.getCsNh3();
|
|
|
+ BigDecimal csNh32 = tXinyiIndustry2.getCsNh3();
|
|
|
+ if(!Objects.isNull(csNh31) && !Objects.isNull(csNh32) && csNh31.compareTo(csNh32) > INT_0)
|
|
|
+ result = true;
|
|
|
+ }else if(BusinessEnum.WarningCategoryEnum.JS_COD.getCode().equals(category)){
|
|
|
+ BigDecimal jsCod1 = tXinyiIndustry1.getJsCod();
|
|
|
+ BigDecimal jsCod2 = tXinyiIndustry2.getJsCod();
|
|
|
+ if(!Objects.isNull(jsCod1) && !Objects.isNull(jsCod2) && jsCod1.compareTo(jsCod2) > INT_0)
|
|
|
+ result = true;
|
|
|
+ }else if(BusinessEnum.WarningCategoryEnum.JS_SS.getCode().equals(category)){
|
|
|
+ BigDecimal jsSs1 = tXinyiIndustry1.getJsSs();
|
|
|
+ BigDecimal jsSs2 = tXinyiIndustry2.getJsSs();
|
|
|
+ if(!Objects.isNull(jsSs1) && !Objects.isNull(jsSs2) && jsSs1.compareTo(jsSs2) > INT_0)
|
|
|
+ result = true;
|
|
|
+ }else if(BusinessEnum.WarningCategoryEnum.JS_ZD.getCode().equals(category)){
|
|
|
+ BigDecimal jsTn1 = tXinyiIndustry1.getJsTn();
|
|
|
+ BigDecimal jsTn2 = tXinyiIndustry2.getJsTn();
|
|
|
+ if(!Objects.isNull(jsTn1) && !Objects.isNull(jsTn2) && jsTn1.compareTo(jsTn2) > INT_0)
|
|
|
+ result = true;
|
|
|
+ }else if(BusinessEnum.WarningCategoryEnum.JS_ZL.getCode().equals(category)){
|
|
|
+ BigDecimal jsTp1 = tXinyiIndustry1.getJsTp();
|
|
|
+ BigDecimal jsTp2 = tXinyiIndustry2.getJsTp();
|
|
|
+ if(!Objects.isNull(jsTp1) && !Objects.isNull(jsTp2) && jsTp1.compareTo(jsTp2) > INT_0)
|
|
|
+ result = true;
|
|
|
+ }else if(BusinessEnum.WarningCategoryEnum.JS_AD.getCode().equals(category)){
|
|
|
+ BigDecimal jsNh31 = tXinyiIndustry1.getJsNh3();
|
|
|
+ BigDecimal jsNh32 = tXinyiIndustry2.getJsNh3();
|
|
|
+ if(!Objects.isNull(jsNh31) && !Objects.isNull(jsNh32) && jsNh31.compareTo(jsNh32) > INT_0)
|
|
|
+ result = true;
|
|
|
+ }else{
|
|
|
+ log.error("暂时还不支持的报警类型~~~~");
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
private void addChatRecordByDeviceErr(TXinyiWarningRecord tXinyiWarningRecord, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
|
|
|
ChatReq chatReq = new ChatReq();
|
|
|
//保存聊天记录
|