From 8de7205d8dc9cc176a471b4a41c4966d88338f06 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 24 Nov 2022 09:24:00 +0800 Subject: [PATCH] =?UTF-8?q?EM=E6=8E=A8=E9=80=81=E9=85=8D=E7=BD=AE=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=A4=9A=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/schedule/alarms_push.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/api/app/lib/schedule/alarms_push.js b/api/app/lib/schedule/alarms_push.js index 9c3460e..44eca5e 100644 --- a/api/app/lib/schedule/alarms_push.js +++ b/api/app/lib/schedule/alarms_push.js @@ -19,7 +19,7 @@ module.exports = function (app, opts) { del: false, disable: false }, - order: ['id'], + order: ['id'], }) let pomsProjectId = new Set() let pepProjectIds = new Set() @@ -90,7 +90,7 @@ module.exports = function (app, opts) { curAnxinProjectId.add(axId) } } - + const anxinProjectId = [...curAnxinProjectId] // 查当前 poms 下的结构物 并把不包含的去掉 // 可能有结构物已解绑 @@ -151,7 +151,7 @@ module.exports = function (app, opts) { let pepProjectName = pepProjectName_.length ? pepProjectName_.join('
') - : '' + : '' let emailTitle = `${pepProjectName_.length ? pepProjectName_.join('、') @@ -249,9 +249,15 @@ module.exports = function (app, opts) { } if (c.alarmType.includes('video_exception')) { let videoAlarmSubType = c.alarmSubType ? c.alarmSubType['video_exception'] : [] - if (videoAlarmSubType.length == 1) videoAlarmSubType.push(-1) - videoAlarms = searchStrucIds.length && videoAlarmSubType.length ? await clickHouse.vcmp.query( - ` + if (videoAlarmSubType.length == 1) { + videoAlarmSubType.push(-1) + } + videoAlarms = + searchStrucIds.length && ( + !c.alarmSubType || videoAlarmSubType.length > 0 + ) ? + await clickHouse.vcmp.query( + ` SELECT cameraAlarm.cameraId AS cameraId, cameraAlarm.cameraName AS cameraName, @@ -294,7 +300,7 @@ module.exports = function (app, opts) { AND camera.channel_no = camera_status_alarm.channel_no AND camera.delete = false AND camera.recycle_time is null - ${!c.alarmSubType ? `AND camera.kind_id in (${videoAlarmSubType.join(',')})` : ""} + ${c.alarmSubType ? `AND camera.kind_id in (${videoAlarmSubType.join(',')})` : ""} WHERE camera_status_alarm.confirm_time IS null ${videoAlarmWhereOption.length ? ` AND ${videoAlarmWhereOption.join(' AND ')}` : ''} @@ -318,7 +324,7 @@ module.exports = function (app, opts) { ON anxinStation.id = anxinIpcStation.station ORDER BY cameraAlarm.createTime DESC ` - ).toPromise() : [] + ).toPromise() : [] let returnD = [] let positionD = {}