Browse Source

camera_status_alarm.platform AS platform

dev
巴林闲侠 2 years ago
parent
commit
02eeb15f15
  1. 33
      api/app/lib/schedule/alarms_push.js

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

@ -89,7 +89,7 @@ module.exports = function (app, opts) {
for (let { dataValues: c } of configListRes) {
if (c.tacticsParams && c.tactics) {
if (proDebug) {
console.log(`当前运行EM配置id=${c.id} name=${c.name}`);
console.log(`当前运行EM配置:id=${c.id} name=${c.name}`);
}
// pomsProjectId 是个数组 []
const { strucId, pomsProjectId, pomsStrucFactorId } = c
@ -235,7 +235,7 @@ module.exports = function (app, opts) {
// appAlarmWhereOption.createTime = { $gte: pointTime }
// videoAlarmWhereOption.push(`camera_status_alarm.create_time >= '${pointTime}'`)
emailTitle += `即时推送服务`
emailSubTitle += `截止${moment(pointTime).format('YYYY年MM月DD日 HH时mm分')}-${moment(nowTime).format('HH时mm分')}`
emailSubTitle += `截止${moment(pointTime).format('YYYY年MM月DD日 HH时mm分')}-${moment(nowTime).format('HH时mm分')}:`
} else if (c.tactics == 'continue' || c.tactics == 'abnormal_rate') {
// 新增的应该是上一个时间节点到上上个节点之间
dataAlarmOption.push(`StartTime <= '${pointTime}'`);
@ -247,7 +247,7 @@ module.exports = function (app, opts) {
if (c.tactics == 'continue') {
emailTitle += `持续时长推送服务`
emailSubTitle += `告警持续时长超${interval}分钟的告警源,详情如下:`
emailSubTitle += `告警持续时长超${interval}分钟的告警源,详情如下:`
} else {
if (c.alarmType.includes('data_outages') || c.alarmType.includes('data_exception')) {
// 查了设备异常率 去安心云查当前项目下的设备数量
@ -269,10 +269,10 @@ module.exports = function (app, opts) {
: 0
}
emailTitle += `异常率推送服务`
emailSubTitle += `持续产生时间超过${interval}分钟的异常设备数量${interval}异常率达到项目或结构物内设备总数量${parseInt(deviceCount) + parseInt(cameraCount)}个的 --%详情如下`
emailSubTitle += `持续产生时间超过${interval}分钟的异常设备数量${interval},异常率达到项目或结构物内设备总数量${parseInt(deviceCount) + parseInt(cameraCount)}个的 --%,详情如下`
}
}
emailTitle += '——POMS飞尚运维中台'
emailTitle += '_POMS飞尚运维中台'
// 判断告警数据范围
if (c.alarmType.includes('data_outages')) {
@ -324,6 +324,7 @@ module.exports = function (app, opts) {
camera.name AS cameraName,
camera.kind_id AS cameraKindId,
camera_status_alarm.id AS alarmId,
camera_status_alarm.platform AS platform,
camera_status_alarm.create_time AS createTime,
camera_status_alarm.status_id AS statusId,
camera_status_alarm.serial_no AS cameraSerialNo,
@ -530,7 +531,7 @@ module.exports = function (app, opts) {
n: '告警信息',
k: 'AlarmContent'
}, {
n: '告警等级(当前)',
n: '告警等级(当前)',
k: '',
f: (d) => {
switch (d.CurrentLevel) {
@ -565,13 +566,13 @@ module.exports = function (app, opts) {
// return (strucListRes.find(s => s.id == d.StructureId) || { name: '' }).name
}
}, {
n: '监测因素(中断比例)',
n: '监测因素(中断比例)',
k: '',
f: (d) => {
// d.factor.join('<b/>')
// console.log(21211231131,d.factor);
let data=[]
d.factor.map(f => data.push(f.name + '' + f.breakData + '/' + f.sum + ''))
d.factor.map(f => data.push(f.name + '(' + f.breakData + '/' + f.sum + ')'))
return data.join('<br/>')
}
}, {
@ -596,7 +597,7 @@ module.exports = function (app, opts) {
n: '告警信息',
k: 'AlarmContent'
}, {
n: '告警等级(当前)',
n: '告警等级(当前)',
k: '',
f: (d) => {
switch (d.CurrentLevel) {
@ -715,7 +716,7 @@ module.exports = function (app, opts) {
let ifEmailSend = false
let tableTitlePostfix = ',详情如下:'
let tableTitlePostfix = ',详情如下:'
function packageTableTitle (titleArr) {
let tableTitle = '<tr>'
@ -745,9 +746,9 @@ module.exports = function (app, opts) {
let apMergeDeVeAnxinProjectId_ = apMergeDeVeAnxinProjectId ?
apMergeDeVeAnxinProjectId.split(',') : [];
let apMergeDeVeAlarms = {
// 结构物id {
// data_exception 数据异常告警[],
// video_exception 视频异常告警[]
// 结构物id :{
// data_exception 数据异常告警:[],
// video_exception 视频异常告警:[]
// }
}
@ -904,7 +905,7 @@ module.exports = function (app, opts) {
} else {
let corDetail = dataAlarmDetails.find(da => da.AlarmId == d.AlarmId)
if (proDebug) {
console.log(`相应告警详情(策略命中)`, corDetail);
console.log(`相应告警详情(策略命中):`, corDetail);
}
if (corDetail) {
// 判断告警详情信息里有没有监测项关键字
@ -1048,7 +1049,7 @@ module.exports = function (app, opts) {
if (Object.keys(apMergeDeVeAlarms).length) {
if (proDebug) {
console.log(`查得数据异常、视频异常合并の告警`);
console.log(`查得数据异常、视频异常合并の告警:`);
console.log(apMergeDeVeAlarms);
}
let deviceSensorRes = []
@ -1065,7 +1066,7 @@ module.exports = function (app, opts) {
`).toPromise()
}
if (proDebug) {
console.log(`相关设备及测点信息`);
console.log(`相关设备及测点信息:`);
console.log(deviceSensorRes);
}
let alarmTitle = dataAlarmTitle.concat(

Loading…
Cancel
Save