|
|
@ -126,7 +126,7 @@ async function count (ctx) { |
|
|
|
if (anxinStruc.length) { |
|
|
|
|
|
|
|
const anxinStrucIds = anxinStruc.map(a => a.strucId) || [] |
|
|
|
|
|
|
|
let dataFront = new moment(); //验证前时间
|
|
|
|
//剩余数据,设备告警
|
|
|
|
const dataAlarm = await clickHouse.dataAlarm.query(` |
|
|
|
SELECT |
|
|
@ -226,6 +226,12 @@ async function count (ctx) { |
|
|
|
}] |
|
|
|
} |
|
|
|
|
|
|
|
let dataAfter = new moment(); //验证后时间
|
|
|
|
let dataduration = moment.duration(dataAfter.diff(dataFront))._data.milliseconds |
|
|
|
console.log('数据',dataduration); |
|
|
|
|
|
|
|
let yingyongFront = new moment(); //验证前时间
|
|
|
|
|
|
|
|
//应用总告警
|
|
|
|
let listRes = await models.AppAlarm.findAndCountAll(findOption) |
|
|
|
|
|
|
@ -242,6 +248,12 @@ async function count (ctx) { |
|
|
|
if (p.dataValues.confirmTime && moment(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')).isBefore(p.dataValues.confirmTime) && moment(p.dataValues.confirmTime).isBefore(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'))) appConfirme++ |
|
|
|
} |
|
|
|
|
|
|
|
let yingyongAfter = new moment(); //验证后时间
|
|
|
|
let yingyongduration = moment.duration(yingyongAfter.diff(yingyongFront))._data.milliseconds |
|
|
|
console.log('应用',yingyongduration); |
|
|
|
|
|
|
|
let videoFront = new moment(); //验证前时间
|
|
|
|
|
|
|
|
const alarmRes = anxinStrucIds.length ? await clickHouse.vcmp.query( |
|
|
|
` |
|
|
|
SELECT |
|
|
@ -338,11 +350,22 @@ async function count (ctx) { |
|
|
|
} |
|
|
|
|
|
|
|
//剩余视频告警
|
|
|
|
const videoSurplus = returnD.filter(r => !r.confirmTime).length || 0 |
|
|
|
let videoSurplus = 0 |
|
|
|
//今日新增视频告警
|
|
|
|
const videoNewAdd = returnD.filter(r => moment(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')).isBefore(r.createTime) && moment(r.createTime).isBefore(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'))).length || 0 |
|
|
|
let videoNewAdd = 0 |
|
|
|
//今日确认视频告警
|
|
|
|
const videoConfirme = returnD.filter(r => moment(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')).isBefore(r.confirmTime) && moment(r.confirmTime).isBefore(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'))).length || 0 |
|
|
|
let videoConfirme = 0 |
|
|
|
|
|
|
|
for (let p of returnD) { |
|
|
|
if (!p.confirmTime) videoSurplus++ |
|
|
|
if (p.createTime && moment(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')).isBefore(p.createTime) && moment(p.createTime).isBefore(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'))) videoNewAdd++ |
|
|
|
if (p.confirmTime && moment(moment().startOf('day').format('YYYY-MM-DD HH:mm:ss')).isBefore(p.confirmTime) && moment(p.confirmTime).isBefore(moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'))) videoConfirme++ |
|
|
|
} |
|
|
|
|
|
|
|
let videoAfter = new moment(); //验证后时间
|
|
|
|
let videoduration = moment.duration(videoAfter.diff(videoFront))._data.milliseconds |
|
|
|
console.log('视频',videoduration); |
|
|
|
|
|
|
|
|
|
|
|
let findOptions = { |
|
|
|
where: { |
|
|
@ -381,6 +404,7 @@ async function count (ctx) { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ctx.status = 200; |
|
|
|
ctx.body = { |
|
|
|
|
|
|
|