Browse Source

告警推送++

dev
CODE 2 years ago
parent
commit
16b42f22b8
  1. 14
      api/app/lib/schedule/alarms_push.js

14
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(',')})

Loading…
Cancel
Save