|
|
@ -191,12 +191,13 @@ module.exports = function (app, opts) { |
|
|
|
console.log('开始查数据-数据-数据类告警---' + moment().format('YYYY-MM-DD HH:mm:ss')) |
|
|
|
|
|
|
|
const alarmRes = await clickHouse.dataAlarm.query(` |
|
|
|
SELECT |
|
|
|
select count(AlarmId) count from |
|
|
|
(SELECT |
|
|
|
alarms.AlarmId AS AlarmId, |
|
|
|
alarms.State AS State, |
|
|
|
alarms.StructureId AS StructureId, |
|
|
|
StartTime, EndTime |
|
|
|
${alarmQueryOptionStr}`).toPromise();
|
|
|
|
${alarmQueryOptionStr})`).toPromise();
|
|
|
|
|
|
|
|
let day1Str = getStr(alarmQueryOptionStr, 'Date(EndTime) - Date(StartTime)<=1'); |
|
|
|
let day1 = await clickHouse.dataAlarm.query(day1Str).toPromise(); |
|
|
@ -244,7 +245,7 @@ module.exports = function (app, opts) { |
|
|
|
// let corConfirmedData = (confirmedAlarmDetailMax.find(cdm => cdm.AlarmId == ar.AlarmId) || {});
|
|
|
|
// ar.confirmTime = corConfirmedData.Time || ar.EndTime
|
|
|
|
// })
|
|
|
|
return { dataSum: alarmRes.length, dataMaps: { day1, day3, day7, day15, day30, day30m } }; |
|
|
|
return { dataSum: alarmRes[0].count, dataMaps: { day1, day3, day7, day15, day30, day30m } }; |
|
|
|
} catch (error) { |
|
|
|
console.error(error); |
|
|
|
} |
|
|
|