zhaobing’ 1 year ago
parent
commit
780969a477
  1. 21
      api/app/lib/schedule/alarms_push.js

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

@ -130,6 +130,7 @@ module.exports = function (app, opts) {
pepProject_name.push({ id: poms.id, anxinProjectId: poms.anxinProjectId, name: corPepProject.project_name })
} else {
// 不符合当前项目的时间节点
pLog(`不符合当前项目的时间节点`)
continue
}
} else {
@ -220,6 +221,7 @@ module.exports = function (app, opts) {
searchStrucIds.unshift(-1)
} else {
// 没有结构物可查
pLog(`没有结构物可查`)
continue
}
let pepProjectName =
@ -654,8 +656,6 @@ module.exports = function (app, opts) {
}, {
n: '告警信息',
k: 'AlarmContent'
}, {
}, {
n: '告警等级(当前)',
k: '',
@ -1045,12 +1045,9 @@ module.exports = function (app, opts) {
* 以测点关联
*/
if (
isDev ||
(
apMergeDeVeAnxinProjectId_.length &&
d.SourceName && d.SourceName.includes('扬尘') &&
apMergeDeVeAnxinProjectId_.some(pid => pid == (strucMap[d.StructureId] || {}).projectId)
)
) {
// SourceTypeId 0: 'DTU' / 1: '传感器' / 2: '测点'
@ -1113,6 +1110,7 @@ module.exports = function (app, opts) {
pLog(`异常比率 ${rate} 设定值 ${deviceProportion}`)
if (rate < parseFloat(deviceProportion)) {
// 设备异常率低于设定值
pLog(`异常设备率低于设定值`)
continue
}
@ -1121,9 +1119,9 @@ module.exports = function (app, opts) {
.replace('**', abnormalDeviceCount.toFixed(0))
}
// 注1
if (apMergeDeVeAnxinProjectId_.length || isDev) {
if (apMergeDeVeAnxinProjectId_.length) {
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) {
apMergeDeVeAlarms[existStruc.id].video_exception.push(a)
}
@ -1307,7 +1305,7 @@ module.exports = function (app, opts) {
}
}
if (projectList.length) {
if (true || projectList.length) {
pepProject_name.map(s => {
s.projects = []
projectList.map(f => {
@ -1631,10 +1629,11 @@ module.exports = function (app, opts) {
de.id = corSensor.sensor
}
}
let corVideoException = curStrucAlarm.video_exception.filter(v => {
let corVideoException =
curStrucAlarm.video_exception ? curStrucAlarm.video_exception.filter(v => {
// ! de.id 是告警信息关联查出来的测点的id
return v.station.some(vs => vs.id == de.id)
})
}) : []
if (!corVideoException.length) {
// 构造一个长度 以便在for循环里把 data_exception 放进去
corVideoException.push({})
@ -1691,7 +1690,7 @@ module.exports = function (app, opts) {
html: html
})
//存日志 存动态 socket到前端
// //存日志 存动态 socket到前端
let dataToSave = {
time: moment().format(),
pushConfigId: c.id,

Loading…
Cancel
Save