|
|
@ -307,15 +307,15 @@ module.exports = function (app, opts) { |
|
|
|
// 判断告警数据范围
|
|
|
|
if (c.alarmType.includes('data_outages')) { |
|
|
|
dataAlarmGroupOption.push(1) |
|
|
|
if (c.alarmSubType) dataAlarmSubType = dataAlarmSubType.concat(c.alarmSubType['data_outages']) |
|
|
|
if (c.alarmSubType) dataAlarmSubType = dataAlarmSubType.concat(c.alarmSubType['data_outages'] || []) |
|
|
|
} |
|
|
|
if (c.alarmType.includes('data_exception')) { |
|
|
|
dataAlarmGroupOption.push(2) |
|
|
|
if (c.alarmSubType) dataAlarmSubType = dataAlarmSubType.concat(c.alarmSubType['data_exception']) |
|
|
|
if (c.alarmSubType) dataAlarmSubType = dataAlarmSubType.concat(c.alarmSubType['data_exception'] || []) |
|
|
|
} |
|
|
|
if (c.alarmType.includes('strategy_hit')) { |
|
|
|
dataAlarmGroupOption.push(3) |
|
|
|
if (c.alarmSubType) dataAlarmSubType = dataAlarmSubType.concat(c.alarmSubType['strategy_hit']) |
|
|
|
if (c.alarmSubType) dataAlarmSubType = dataAlarmSubType.concat(c.alarmSubType['strategy_hit'] || []) |
|
|
|
} |
|
|
|
if (c.alarmType.includes('video_exception')) { |
|
|
|
let videoAlarmSubType = c.alarmSubType ? |
|
|
@ -515,13 +515,14 @@ module.exports = function (app, opts) { |
|
|
|
if (dataAlarmGroupOption.length && searchStrucIds.length) { |
|
|
|
dataAlarmGroupOption.push(-1) |
|
|
|
dataAlarmOption.push(`AlarmGroup IN (${dataAlarmGroupOption.join(',')})`) |
|
|
|
if (c.alarmSubType && dataAlarmSubType.length) { |
|
|
|
dataAlarmSubType.push(-1) |
|
|
|
dataAlarmOption.push(`AlarmGroupUnit IN (${dataAlarmSubType.join(',')})`) |
|
|
|
let dataAlarmSubType_ = dataAlarmSubType.filter(s => s) |
|
|
|
if (c.alarmSubType && dataAlarmSubType_.length) { |
|
|
|
dataAlarmSubType_.push(-1) |
|
|
|
dataAlarmOption.push(`AlarmGroupUnit IN (${dataAlarmSubType_.join(',')})`) |
|
|
|
} |
|
|
|
|
|
|
|
dataAlarms = |
|
|
|
!c.alarmSubType || dataAlarmSubType.length ? |
|
|
|
!c.alarmSubType || dataAlarmSubType_.length ? |
|
|
|
await clickHouse.dataAlarm.query(` |
|
|
|
SELECT * FROM alarms |
|
|
|
LEFT JOIN ${anxinyun}.t_sensor |
|
|
|