Browse Source

注释掉全部告警发送

dev
CODE 1 year ago
parent
commit
7197f82f5b
  1. 96
      api/app/lib/schedule/alarms_push.js

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

@ -1245,54 +1245,54 @@ module.exports = function (app, opts) {
// 上面的代码自内而外构建数据 // 上面的代码自内而外构建数据
// 下面的逻辑自外向内!!! // 下面的逻辑自外向内!!!
// 处理那些没有被匹配到的告警信息 // // 处理那些没有被匹配到的告警信息
// 将设备没有绑定到测点的告警也推出去 // // 将设备没有绑定到测点的告警也推出去
for (let a of alarmDatas) { // for (let a of alarmDatas) {
if (!matchedAlarmIds.includes(a.alarmId)) { // if (!matchedAlarmIds.includes(a.alarmId)) {
let curStruc = strucMap[a.StructureId] // let curStruc = strucMap[a.StructureId]
if (curStruc) { // if (curStruc) {
// curStruc 可以推出 告警属于哪个 project -> pomsProject // // curStruc 可以推出 告警属于哪个 project -> pomsProject
let curProject = pepProject_name.filter(p => p.anxinProjectId && p.anxinProjectId.includes(curStruc.projectId)); // let curProject = pepProject_name.filter(p => p.anxinProjectId && p.anxinProjectId.includes(curStruc.projectId));
for (let cp of curProject) { // for (let cp of curProject) {
// cp.projects 是结构物信息 // // cp.projects 是结构物信息
let curStruc = cp.projects.find(cpp => cpp.id == a.StructureId) // let curStruc = cp.projects.find(cpp => cpp.id == a.StructureId)
if (!curStruc) { // if (!curStruc) {
console.error(`没有查到结构物信息:${a.StructureId}?!不应该不应该!`); // console.error(`没有查到结构物信息:${a.StructureId}?!不应该不应该!`);
} else { // } else {
// let emptyFactor = { id: -1 } // // let emptyFactor = { id: -1 }
let emptyFactor = curStruc.factor.find(f => f.id == -1) // let emptyFactor = curStruc.factor.find(f => f.id == -1)
if (!emptyFactor) { // if (!emptyFactor) {
curStruc.factor.push({ // curStruc.factor.push({
id: -1, // id: -1,
devices: [{ // devices: [{
alarmDatas: [ // alarmDatas: [
{ ...a } // { ...a }
], // ],
iotaDeviceId: a.sourceId, // iotaDeviceId: a.sourceId,
name: a.SourceName, // name: a.SourceName,
structureId: a.StructureId, // structureId: a.StructureId,
}] // }]
}) // })
} else { // } else {
let curDevice = emptyFactor.devices.find(d => d.iotaDeviceId == a.sourceId) // let curDevice = emptyFactor.devices.find(d => d.iotaDeviceId == a.sourceId)
if (!curDevice) { // if (!curDevice) {
emptyFactor.devices.push({ // emptyFactor.devices.push({
alarmDatas: [ // alarmDatas: [
{ ...a } // { ...a }
], // ],
iotaDeviceId: a.sourceId, // iotaDeviceId: a.sourceId,
name: a.SourceName, // name: a.SourceName,
structureId: a.StructureId, // structureId: a.StructureId,
}) // })
} else { // } else {
curDevice.alarmDatas.push({ ...a }) // curDevice.alarmDatas.push({ ...a })
} // }
} // }
} // }
} // }
} // }
} // }
} // }
pepProject_name.forEach(h => { pepProject_name.forEach(h => {
let rowspan1 = 0 let rowspan1 = 0

Loading…
Cancel
Save