|
@ -68,19 +68,19 @@ async function getProjectsInfo(ctx) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//BI分析
|
|
|
//BI分析
|
|
|
async function getBiAnalysis(ctx) { |
|
|
async function getVideoAlarmsAggDay(ctx) { |
|
|
try { |
|
|
try { |
|
|
const { models } = ctx.fs.dc; |
|
|
|
|
|
const { clickHouse } = ctx.app.fs |
|
|
|
|
|
const { alarmId, limit, page } = ctx.query; |
|
|
|
|
|
let videoAlarms = await alarmList(ctx, 'day'); |
|
|
let videoAlarms = await alarmList(ctx, 'day'); |
|
|
let aggDayMap = []; |
|
|
let aggDayMap = []; |
|
|
for (let a of videoAlarms) { |
|
|
for (let a of videoAlarms) { |
|
|
let exist = aggDayMap.find(ad => ad.day == moment(a.createTime).format('YYYY-MM-DD')) |
|
|
let exist = aggDayMap.find(ad => ad.day == moment(a.createTime).format('YYYY-MM-DD')); |
|
|
if (exist) { |
|
|
if (exist) { |
|
|
exist.number++ |
|
|
exist.total++;//总数
|
|
|
|
|
|
if (a.confirmTime || a.autoRestore) { |
|
|
|
|
|
exist.done++;//已恢复
|
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
aggDayMap.push({ day: moment(a.createTime).format('YYYY-MM-DD'), number: 1 }) |
|
|
aggDayMap.push({ day: moment(a.createTime).format('YYYY-MM-DD'), total: 1, done: a.confirmTime || a.autoRestore ? 1 : 0 }); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
ctx.status = 200; |
|
|
ctx.status = 200; |
|
@ -190,6 +190,6 @@ async function getLatestDynamic(ctx) { |
|
|
module.exports = { |
|
|
module.exports = { |
|
|
getWorkbench, |
|
|
getWorkbench, |
|
|
getProjectsInfo, |
|
|
getProjectsInfo, |
|
|
getBiAnalysis, |
|
|
getVideoAlarmsAggDay, |
|
|
getLatestDynamic |
|
|
getLatestDynamic |
|
|
}; |
|
|
}; |