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

Loading…
Cancel
Save