feat: 告警增加通知串口

main
huangfeng 6 months ago
parent ef38aa2675
commit 08654185ca

@ -0,0 +1 @@
ALTER TABLE `warn_rule` ADD COLUMN `notify_com` INT(11) NULL DEFAULT NULL COMMENT '0:不通知; 1:通知' AFTER `active`;

@ -77,6 +77,10 @@ public class WarnRule {
@Column(name = "active")
private Integer active;
@ApiModelProperty("状态 0:不通知 1:通知")
@Column(name = "notify_com")
private Integer notifyCom;
@ApiModelProperty("最后数据采集时间")
@Column(name = "last_d_time")
private Date lastDTime;

@ -86,6 +86,7 @@ public class WarnRuleServiceImpl implements WarnRuleService {
rule.setThreshold(item.getThreshold());
rule.setLevel(item.getLevel());
rule.setActive(item.getActive());
rule.setNotifyCom(item.getNotifyCom());
repository.save(rule);
StaticVariable.rule_Cache.remove(rule.getId());
}

@ -4,6 +4,7 @@ import com.xydl.cac.entity.ModevTypePoint;
import com.xydl.cac.entity.NSensor;
import com.xydl.cac.entity.WarnRule;
import com.xydl.cac.entity.Warning;
import com.xydl.cac.entity.constants.Constants;
import com.xydl.cac.model.StaticVariable;
import com.xydl.cac.model.TriggerModel;
import com.xydl.cac.repository.WarnRuleRepository;
@ -73,6 +74,10 @@ public class RuleCheckTask {
for (TriggerModel model : warnList) {
this.sendWarning(rule, model);
}
if (rule.getNotifyCom() != null && rule.getNotifyCom().intValue() == Constants.TRUE) {
// 通知串口
}
}
} catch (Exception e) {
log.error("RuleCheckTask.ruleCheck error.", e);

Loading…
Cancel
Save