Compare commits
3 Commits
44b2336bd1
...
3600f89289
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3600f89289 | ||
|
|
7e7ed5ed6d | ||
|
|
5a8344426b |
@@ -245,6 +245,8 @@ aliyun:
|
||||
call-success-suppress-hours: 2
|
||||
# 设备离线告警延迟触发时间(分钟),设备离线超过此时间后才发送告警
|
||||
offline-warn-delay-minutes: 6
|
||||
# 是否启用报警电话通知(全局开关,关闭后所有类型的报警都不会触发电话通知)
|
||||
call-notice-enabled: false
|
||||
# AMQP 服务端订阅配置(使用数据同步的 AppKey + AppSecret)
|
||||
amqp:
|
||||
# 是否启用
|
||||
|
||||
@@ -101,6 +101,13 @@ public class AliyunIotProperties {
|
||||
*/
|
||||
private int saturabilityWarnHours = 8;
|
||||
|
||||
/**
|
||||
* 是否启用报警电话通知
|
||||
* 全局开关,关闭后所有类型的报警都不会触发电话通知
|
||||
* 默认开启
|
||||
*/
|
||||
private boolean callNoticeEnabled = true;
|
||||
|
||||
@Data
|
||||
public static class VmsMnsConfig {
|
||||
/**
|
||||
|
||||
@@ -570,7 +570,7 @@ public class DeviceDataHandler {
|
||||
}
|
||||
|
||||
// 仅对开启了电话通知开关的告警触发电话通知(MessageWarn 由通知方法内部插入)
|
||||
if (!callWarnList.isEmpty()) {
|
||||
if (!callWarnList.isEmpty() && aliyunIotProperties.isCallNoticeEnabled()) {
|
||||
triggerAlarmNotification(device, alarmMessage.toString(), sensorData, callWarnList);
|
||||
}
|
||||
}
|
||||
@@ -903,6 +903,11 @@ public class DeviceDataHandler {
|
||||
* @param deviceName 设备名称(serialNum)
|
||||
*/
|
||||
public void triggerOfflineAlarm(String deviceName) {
|
||||
// 全局电话通知开关检查
|
||||
if (!aliyunIotProperties.isCallNoticeEnabled()) {
|
||||
log.debug("[离线告警] 电话通知已全局关闭,跳过: {}", deviceName);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Device device = deviceMapper.selectOne(
|
||||
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<Device>()
|
||||
@@ -1026,6 +1031,11 @@ public class DeviceDataHandler {
|
||||
* @param deviceName 设备名称(serialNum)
|
||||
*/
|
||||
public void triggerSaturaHighAlarm(String deviceName) {
|
||||
// 全局电话通知开关检查
|
||||
if (!aliyunIotProperties.isCallNoticeEnabled()) {
|
||||
log.debug("[饱和度告警] 电话通知已全局关闭,跳过: {}", deviceName);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Device device = deviceMapper.selectOne(
|
||||
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<Device>()
|
||||
@@ -1151,6 +1161,11 @@ public class DeviceDataHandler {
|
||||
* @param params 事件参数
|
||||
*/
|
||||
private void triggerDeviceErrorAlarm(String deviceName, JSONObject params) {
|
||||
// 全局电话通知开关检查
|
||||
if (!aliyunIotProperties.isCallNoticeEnabled()) {
|
||||
log.debug("[设备故障] 电话通知已全局关闭,跳过: {}", deviceName);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Device device = deviceMapper.selectOne(
|
||||
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<Device>()
|
||||
@@ -1500,8 +1515,10 @@ public class DeviceDataHandler {
|
||||
if (userId != null) {
|
||||
MessageWarn warn = createMessageWarn(deviceId, userId, pondName, title, WARN_TYPE_DISSOLVED_OXYGEN, message);
|
||||
messageWarnMapper.insert(warn);
|
||||
// 创建电话通知记录
|
||||
createCallNotices(device, pondName, warn);
|
||||
// 创建电话通知记录(全局开关控制)
|
||||
if (aliyunIotProperties.isCallNoticeEnabled()) {
|
||||
createCallNotices(device, pondName, warn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user