|
@ -149,6 +149,8 @@ module.exports = function (app, opts) { |
|
|
ON ${anxinyun}.t_structure.id = alarms.StructureId |
|
|
ON ${anxinyun}.t_structure.id = alarms.StructureId |
|
|
${whereOption.length ? 'WHERE ' + whereOption.join(' AND ') : ''}` |
|
|
${whereOption.length ? 'WHERE ' + whereOption.join(' AND ') : ''}` |
|
|
|
|
|
|
|
|
|
|
|
console.log('开始查数据-数据-数据类告警---' + moment().format('YYYY-MM-DD HH:mm:ss')) |
|
|
|
|
|
|
|
|
const alarmRes = await clickHouse.dataAlarm.query(` |
|
|
const alarmRes = await clickHouse.dataAlarm.query(` |
|
|
SELECT |
|
|
SELECT |
|
|
alarms.AlarmId AS AlarmId, |
|
|
alarms.AlarmId AS AlarmId, |
|
@ -157,6 +159,8 @@ module.exports = function (app, opts) { |
|
|
StartTime, EndTime |
|
|
StartTime, EndTime |
|
|
${alarmQueryOptionStr}`).toPromise();
|
|
|
${alarmQueryOptionStr}`).toPromise();
|
|
|
|
|
|
|
|
|
|
|
|
console.log('数据-数据-数据告警查询结束---' + moment().format('YYYY-MM-DD HH:mm:ss') + `---一共${alarmRes.length}条`) |
|
|
|
|
|
|
|
|
const confirmedAlarm = alarmRes.filter(ar => ar.State && ar.State > 2).map(ar => "'" + ar.AlarmId + "'"); |
|
|
const confirmedAlarm = alarmRes.filter(ar => ar.State && ar.State > 2).map(ar => "'" + ar.AlarmId + "'"); |
|
|
const confirmedAlarmDetailMax = confirmedAlarm.length ? |
|
|
const confirmedAlarmDetailMax = confirmedAlarm.length ? |
|
|
await clickHouse.dataAlarm.query(` |
|
|
await clickHouse.dataAlarm.query(` |
|
@ -209,7 +213,11 @@ module.exports = function (app, opts) { |
|
|
findOption.where['$app->projectCorrelations.id$'] = { |
|
|
findOption.where['$app->projectCorrelations.id$'] = { |
|
|
$in: pomsProjectIds |
|
|
$in: pomsProjectIds |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log('开始查应用-应用-应用告警---' + moment().format('YYYY-MM-DD HH:mm:ss')) |
|
|
const listRes = await models.AppAlarm.findAll(findOption) |
|
|
const listRes = await models.AppAlarm.findAll(findOption) |
|
|
|
|
|
console.log('应用-应用-应用告警查询结束---' + moment().format('YYYY-MM-DD HH:mm:ss') + `---一共${listRes.length}条`) |
|
|
|
|
|
|
|
|
return listRes |
|
|
return listRes |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error(error); |
|
|
console.error(error); |
|
@ -222,6 +230,7 @@ module.exports = function (app, opts) { |
|
|
let start = moment().add(-1, 'year').format('YYYY-MM-DD HH:mm:ss');//最近一年
|
|
|
let start = moment().add(-1, 'year').format('YYYY-MM-DD HH:mm:ss');//最近一年
|
|
|
statusAlarmWhereOption.push(`camera_status_alarm.create_time >= '${start}'`) |
|
|
statusAlarmWhereOption.push(`camera_status_alarm.create_time >= '${start}'`) |
|
|
|
|
|
|
|
|
|
|
|
console.log('开始查视频-视频-视频告警---' + moment().format('YYYY-MM-DD HH:mm:ss')) |
|
|
const alarmRes = anxinStrucIds.length ? await clickHouse.vcmp.query( |
|
|
const alarmRes = anxinStrucIds.length ? await clickHouse.vcmp.query( |
|
|
` |
|
|
` |
|
|
SELECT |
|
|
SELECT |
|
@ -276,6 +285,7 @@ module.exports = function (app, opts) { |
|
|
ON anxinIpcStation.ipc = anxinIpc.id |
|
|
ON anxinIpcStation.ipc = anxinIpc.id |
|
|
`).toPromise() : []
|
|
|
`).toPromise() : []
|
|
|
|
|
|
|
|
|
|
|
|
console.log('视频-视频-视频告警查询结束---' + moment().format('YYYY-MM-DD HH:mm:ss') + `---一共${alarmRes.length}条`) |
|
|
let returnD = [] |
|
|
let returnD = [] |
|
|
let positionD = {} |
|
|
let positionD = {} |
|
|
// 每个设备一个告警
|
|
|
// 每个设备一个告警
|
|
|