diff --git a/api/app/lib/schedule/alarms_push.js b/api/app/lib/schedule/alarms_push.js index 7d32954..d4a18d6 100644 --- a/api/app/lib/schedule/alarms_push.js +++ b/api/app/lib/schedule/alarms_push.js @@ -1211,11 +1211,13 @@ module.exports = function (app, opts) { ).toPromise() || [] : [] //查询结构物的监测因素(本地化项目) let factorDataLocal = await clickHouse.dataAlarm.query( - ` SELECT - StructId AS structureId,SafetyFactorTypeName AS name,SafetyFactorTypeId AS id + `SELECT + PlatformStructureId AS structureId, + SafetyFactorTypeName AS name, + SafetyFactorTypeId AS id FROM sensors - WHERE sensors.StructId in (${[...dataAlarmStructureId, -1].join(',')})` + WHERE sensors.PlatformStructureId IN (${[...dataAlarmStructureId, -1, -2].join(',')})` ).toPromise() || [] pLog('安心云项目监测因素', factorData.length) pLog('本地化项目监测因素', factorDataLocal) @@ -1250,11 +1252,12 @@ module.exports = function (app, opts) { let equipmentLocal = await clickHouse.dataAlarm.query( ` SELECT SensorLocationDescription AS name, - StructId AS structureId, + PlatformStructureId AS structureId, SafetyFactorTypeId AS factorId, - SensorId AS iotaDeviceId + SensorId AS iotaDeviceId, + ProductName AS deviceName FROM sensors - WHERE sensors.StructId IN (${[...dataAlarmStructureId, -1].join(',')}) + WHERE sensors.PlatformStructureId IN (${[...dataAlarmStructureId, -1].join(',')}) AND sensors.SafetyFactorTypeId IN (${[...factorIdLocal, -1].join(',')}) ` ).toPromise() || []