From 16b42f22b8641f1325bcb178dd8383aebc71b272 Mon Sep 17 00:00:00 2001 From: CODE <1650192445@qq.com> Date: Wed, 18 Oct 2023 18:35:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=8E=A8=E9=80=81++?= 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, 8 insertions(+), 6 deletions(-) diff --git a/api/app/lib/schedule/alarms_push.js b/api/app/lib/schedule/alarms_push.js index 0b0b6a2..e83c8b1 100644 --- a/api/app/lib/schedule/alarms_push.js +++ b/api/app/lib/schedule/alarms_push.js @@ -105,7 +105,7 @@ module.exports = function (app, opts) { pLog(`curMinOfYear / ${curMinOfYear}`) for (let { dataValues: c } of configListRes) { - if (isDev && c.id != 94) { + if (isDev && c.id != 95) { continue } @@ -1186,7 +1186,7 @@ module.exports = function (app, opts) { //本地化项目structureId数组 let dataAlarmStructureId = new Set() dataAlarmG145Data.map(c => { - if (c.project) { + if (c.Project) { dataAlarmStructureId.add(c.StructureId) } else { dataAlarmG1StructureId.add(c.StructureId) @@ -1211,10 +1211,10 @@ module.exports = function (app, opts) { ).toPromise() || [] : [] //查询结构物的监测因素(本地化项目) let factorDataLocal = await clickHouse.dataAlarm.query( - `SELECT + `SELECT + distinct SafetyFactorTypeId AS id, PlatformStructureId AS structureId, - SafetyFactorTypeName AS name, - SafetyFactorTypeId AS id + SafetyFactorTypeName AS name FROM sensors WHERE sensors.PlatformStructureId IN (${[...dataAlarmStructureId, -1, -2].join(',')})` @@ -1226,6 +1226,8 @@ module.exports = function (app, opts) { //本地化的factorId let factorIdLocal = factorDataLocal.map(f => f.id) pLog('安心云+本地监测因素', factorData.length) + + factorData = [...factorData, ...factorDataLocal] //查询结构物对应的测点(安心云) // ! 测点 let equipment = await clickHouse.anxinyun.query( @@ -1254,7 +1256,7 @@ module.exports = function (app, opts) { SensorLocationDescription AS name, PlatformStructureId AS structureId, SafetyFactorTypeId AS factorId, - SensorId AS iotaDeviceId, + ID AS iotaDeviceId, ProductName AS deviceName FROM sensors WHERE sensors.PlatformStructureId IN (${[...dataAlarmStructureId, -1].join(',')})