|
|
@ -40,10 +40,10 @@ async function list (ctx) { |
|
|
|
ctx, pepProjectId, keywordTarget, keyword |
|
|
|
}) |
|
|
|
let whereOption = [] |
|
|
|
// TODO: 1 开发临时增加
|
|
|
|
// ! 1 开发临时增加
|
|
|
|
if (anxinStruc.length) { |
|
|
|
const anxinStrucIds = anxinStruc.map(a => a.strucId) |
|
|
|
// TODO: 开发临时注释
|
|
|
|
// ! 开发临时注释
|
|
|
|
whereOption.push(`alarms.StructureId IN (${anxinStrucIds.join(",")})`) |
|
|
|
|
|
|
|
if (groupId) { |
|
|
@ -109,6 +109,7 @@ async function list (ctx) { |
|
|
|
${limit && page ? 'OFFSET ' + parseInt(limit) * parseInt(page) : ''} |
|
|
|
`).toPromise();
|
|
|
|
|
|
|
|
// TODO lukai 说这里要加也不知道啥时候加
|
|
|
|
// ,
|
|
|
|
// ${anxinyun}.t_alarm_type.old_name AS alarmTypeOldName
|
|
|
|
|
|
|
@ -167,11 +168,6 @@ async function list (ctx) { |
|
|
|
// 最新告警详情 - 确认信息
|
|
|
|
let corConfirmedData = (confirmedAlarmDetailMax.find(cdm => cdm.AlarmId == ar.AlarmId) || {}); |
|
|
|
|
|
|
|
// if (corConfirmedData.AlarmState && corConfirmedData.AlarmState > 2) {
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
// corConfirmedData = {}
|
|
|
|
// }
|
|
|
|
ar.confirmedContent = corConfirmedData.Content || null |
|
|
|
ar.confirmedTime = corConfirmedData.Time || null |
|
|
|
|
|
|
@ -203,13 +199,24 @@ async function detail (ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { clickHouse } = ctx.app.fs |
|
|
|
const { alarmId } = ctx.query |
|
|
|
const { alarmId, limit, page } = ctx.query |
|
|
|
|
|
|
|
const detailRes = await clickHouse.dataAlarm.query(` |
|
|
|
SELECT * FROM alarm_details WHERE AlarmId = '${alarmId}' ORDER BY Time ASC |
|
|
|
SELECT * FROM alarm_details |
|
|
|
WHERE AlarmId = '${alarmId}' |
|
|
|
ORDER BY Time ASC |
|
|
|
${limit ? 'LIMIT ' + limit : ''} |
|
|
|
${limit && page ? 'OFFSET ' + parseInt(limit) * parseInt(page) : ''} |
|
|
|
`).toPromise()
|
|
|
|
const count = await clickHouse.dataAlarm.query(` |
|
|
|
SELECT count(*) AS count FROM alarm_details |
|
|
|
WHERE AlarmId = '${alarmId}' |
|
|
|
`).toPromise()
|
|
|
|
|
|
|
|
ctx.status = 200; |
|
|
|
// ctx.body = {
|
|
|
|
// count: count[0].count,
|
|
|
|
// rows: detailRes
|
|
|
|
// }
|
|
|
|
ctx.body = detailRes |
|
|
|
} catch (error) { |
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
|
|