From f050679c6d047d487b1561ea63a94e8d52e24074 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 2 Nov 2022 11:05:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=8E=87=E4=BD=8E=E4=BA=8E?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E5=80=BC=E5=88=99=E4=B8=8D=E6=8E=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/schedule/alarms_push.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/api/app/lib/schedule/alarms_push.js b/api/app/lib/schedule/alarms_push.js index c6a1a37..9b2c556 100644 --- a/api/app/lib/schedule/alarms_push.js +++ b/api/app/lib/schedule/alarms_push.js @@ -120,7 +120,8 @@ module.exports = function (app, opts) { return s.id }) - searchStrucIds = searchStrucIds.concat([991, 1052, 700]) + // 开发测试用的数据 + // searchStrucIds = searchStrucIds.concat([991, 1052, 700]) if (searchStrucIds.length) { searchStrucIds.unshift(-1) @@ -377,7 +378,7 @@ module.exports = function (app, opts) { dataAlarms = await clickHouse.dataAlarm.query(` SELECT * FROM alarms WHERE - ${`'State NOT IN (3, 4) AND '`} + ${`State NOT IN (3, 4) AND `} StructureId IN (${searchStrucIds.join(',')}) ${dataAlarmOption.length ? ' AND ' + dataAlarmOption.join(' AND ') : ''} ORDER BY StartTime DESC @@ -602,8 +603,13 @@ module.exports = function (app, opts) { deviceStatistic.add(d.SourceId) } if (c.tactics == 'abnormal_rate') { - let a = ((deviceStatistic.size + videoAlarms.length) / (parseInt(deviceCount) + parseInt(cameraCount))).toFixed(1) + '%' - emailSubTitle = emailSubTitle.replace('--%', ((deviceStatistic.size + videoAlarms.length) / (parseInt(deviceCount) + parseInt(cameraCount))).toFixed(1) + '%') + let rate = ((deviceStatistic.size + videoAlarms.length) / (parseInt(deviceCount) + parseInt(cameraCount))); + + if (rate < parseFloat(deviceProportion)) { + continue + } + + emailSubTitle = emailSubTitle.replace('--%', rate.toFixed(1) + '%') } let html = `