Browse Source

告警推送++

dev
CODE 1 year ago
parent
commit
9750566ce8
  1. 24
      api/app/lib/schedule/alarms_push.js

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

@ -654,8 +654,6 @@ module.exports = function (app, opts) {
}, { }, {
n: '告警信息', n: '告警信息',
k: 'AlarmContent' k: 'AlarmContent'
}, {
}, { }, {
n: '告警等级(当前)', n: '告警等级(当前)',
k: '', k: '',
@ -1045,12 +1043,9 @@ module.exports = function (app, opts) {
* 以测点关联 * 以测点关联
*/ */
if ( if (
isDev || apMergeDeVeAnxinProjectId_.length &&
( d.SourceName && d.SourceName.includes('扬尘') &&
apMergeDeVeAnxinProjectId_.length && apMergeDeVeAnxinProjectId_.some(pid => pid == (strucMap[d.StructureId] || {}).projectId)
d.SourceName && d.SourceName.includes('扬尘') &&
apMergeDeVeAnxinProjectId_.some(pid => pid == (strucMap[d.StructureId] || {}).projectId)
)
) { ) {
// SourceTypeId 0: 'DTU' / 1: '传感器' / 2: '测点' // SourceTypeId 0: 'DTU' / 1: '传感器' / 2: '测点'
@ -1121,9 +1116,9 @@ module.exports = function (app, opts) {
.replace('**', abnormalDeviceCount.toFixed(0)) .replace('**', abnormalDeviceCount.toFixed(0))
} }
// 注1 // 注1
if (apMergeDeVeAnxinProjectId_.length || isDev) { if (apMergeDeVeAnxinProjectId_.length) {
for (let a of videoAlarms) { for (let a of videoAlarms) {
let existStruc = a.struc.find(asc => apMergeDeVeAlarms[asc.id] || isDev) let existStruc = a.struc.find(asc => apMergeDeVeAlarms[asc.id])
if (existStruc) { if (existStruc) {
apMergeDeVeAlarms[existStruc.id].video_exception.push(a) apMergeDeVeAlarms[existStruc.id].video_exception.push(a)
} }
@ -1631,10 +1626,11 @@ module.exports = function (app, opts) {
de.id = corSensor.sensor de.id = corSensor.sensor
} }
} }
let corVideoException = curStrucAlarm.video_exception.filter(v => { let corVideoException =
// ! de.id 是告警信息关联查出来的测点的id curStrucAlarm.video_exception ? curStrucAlarm.video_exception.filter(v => {
return v.station.some(vs => vs.id == de.id) // ! de.id 是告警信息关联查出来的测点的id
}) return v.station.some(vs => vs.id == de.id)
}) : []
if (!corVideoException.length) { if (!corVideoException.length) {
// 构造一个长度 以便在for循环里把 data_exception 放进去 // 构造一个长度 以便在for循环里把 data_exception 放进去
corVideoException.push({}) corVideoException.push({})

Loading…
Cancel
Save