|
@ -23,20 +23,21 @@ module.exports = function (app, opts) { |
|
|
'video': '/problem/dataAlarm/videoAbnormal', |
|
|
'video': '/problem/dataAlarm/videoAbnormal', |
|
|
'app': '/problem/useAlarm/useAbnormal' |
|
|
'app': '/problem/useAlarm/useAbnormal' |
|
|
} |
|
|
} |
|
|
async function sendAppearToWeb (datas, ttype) { |
|
|
async function sendAppearToWeb(datas, ttype, aboutProject) { |
|
|
try { |
|
|
try { |
|
|
let alarmTypee = null, jumpUrl = null//告警类型 跳转地址
|
|
|
let alarmTypee = null, jumpUrl = null//告警类型 跳转地址
|
|
|
|
|
|
|
|
|
//项目信息
|
|
|
//项目信息
|
|
|
let { projects, pepProjects } = await getProjectsInfo(datas); |
|
|
//let { projects, pepProjects } = await getProjectsInfo(datas);
|
|
|
|
|
|
|
|
|
//数据类区分alarmGroup
|
|
|
//数据类区分alarmGroup
|
|
|
if (ttype == 'data') { |
|
|
if (ttype == 'data') { |
|
|
let alarm_group = await clickHouse.anxinyun.query( |
|
|
// let alarm_group = await clickHouse.anxinyun.query(
|
|
|
`SELECT alarm_group FROM t_alarm_code WHERE code='${datas[0].alarmInfo.alarmCode}'`).toPromise(); |
|
|
// `SELECT alarm_group FROM t_alarm_code WHERE code='${datas[0].alarmInfo.alarmCode}'`).toPromise();
|
|
|
|
|
|
|
|
|
alarmTypee = alarm_group.length ? constAlarmGroups[alarm_group[0].alarm_group] : null |
|
|
let typeId = datas[0].alarmInfo.typeId;//1,2,3,4,5
|
|
|
jumpUrl = alarm_group.length ? constAlarmUrls[alarm_group[0].alarm_group] : null |
|
|
alarmTypee = constAlarmGroups[typeId] || null |
|
|
|
|
|
jumpUrl = constAlarmUrls[typeId] || null |
|
|
} else { |
|
|
} else { |
|
|
alarmTypee = constAlarmGroups[ttype] |
|
|
alarmTypee = constAlarmGroups[ttype] |
|
|
jumpUrl = constAlarmUrls[ttype] |
|
|
jumpUrl = constAlarmUrls[ttype] |
|
@ -44,10 +45,10 @@ module.exports = function (app, opts) { |
|
|
|
|
|
|
|
|
let sendData = [] |
|
|
let sendData = [] |
|
|
datas.map(ld => { |
|
|
datas.map(ld => { |
|
|
let pepPId = projects.find(p => p.id == ld.projectCorrelationId).pepProjectId; |
|
|
let item = aboutProject.pomsProject.find(p => p.id == ld.projectCorrelationId); |
|
|
sendData.push({ |
|
|
sendData.push({ |
|
|
projectCorrelationId: ld.projectCorrelationId, |
|
|
projectCorrelationId: ld.projectCorrelationId, |
|
|
project: projects.find(p => p.id == ld.projectCorrelationId).name || pepProjects.find(pp => pp.id == pepPId).project_name,//前者为自定义项目名称
|
|
|
project: item.name || item.pepProject.projectName,//前者为自定义项目名称
|
|
|
source: ld.alarmInfo.sourceName, |
|
|
source: ld.alarmInfo.sourceName, |
|
|
alarmGroup: ld.alarmInfo.type,//异常类型
|
|
|
alarmGroup: ld.alarmInfo.type,//异常类型
|
|
|
time: ld.time, |
|
|
time: ld.time, |
|
|