Browse Source

告警推送++

dev
CODE 1 year ago
parent
commit
2a8376fda4
  1. 15
      api/app/lib/schedule/alarms_push.js

15
api/app/lib/schedule/alarms_push.js

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

Loading…
Cancel
Save