|
|
@ -23,20 +23,21 @@ module.exports = function (app, opts) { |
|
|
|
'video': '/problem/dataAlarm/videoAbnormal', |
|
|
|
'app': '/problem/useAlarm/useAbnormal' |
|
|
|
} |
|
|
|
async function sendAppearToWeb (datas, ttype) { |
|
|
|
async function sendAppearToWeb(datas, ttype, aboutProject) { |
|
|
|
try { |
|
|
|
let alarmTypee = null, jumpUrl = null//告警类型 跳转地址
|
|
|
|
|
|
|
|
//项目信息
|
|
|
|
let { projects, pepProjects } = await getProjectsInfo(datas); |
|
|
|
//let { projects, pepProjects } = await getProjectsInfo(datas);
|
|
|
|
|
|
|
|
//数据类区分alarmGroup
|
|
|
|
if (ttype == 'data') { |
|
|
|
let alarm_group = await clickHouse.anxinyun.query( |
|
|
|
`SELECT alarm_group FROM t_alarm_code WHERE code='${datas[0].alarmInfo.alarmCode}'`).toPromise(); |
|
|
|
// let alarm_group = await clickHouse.anxinyun.query(
|
|
|
|
// `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 |
|
|
|
jumpUrl = alarm_group.length ? constAlarmUrls[alarm_group[0].alarm_group] : null |
|
|
|
let typeId = datas[0].alarmInfo.typeId;//1,2,3,4,5
|
|
|
|
alarmTypee = constAlarmGroups[typeId] || null |
|
|
|
jumpUrl = constAlarmUrls[typeId] || null |
|
|
|
} else { |
|
|
|
alarmTypee = constAlarmGroups[ttype] |
|
|
|
jumpUrl = constAlarmUrls[ttype] |
|
|
@ -44,10 +45,10 @@ module.exports = function (app, opts) { |
|
|
|
|
|
|
|
let sendData = [] |
|
|
|
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({ |
|
|
|
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, |
|
|
|
alarmGroup: ld.alarmInfo.type,//异常类型
|
|
|
|
time: ld.time, |
|
|
|