|
|
@ -2,55 +2,6 @@ |
|
|
|
const moment = require('moment'); |
|
|
|
const { alarmList } = require('../alarm/video'); |
|
|
|
|
|
|
|
//项目概览
|
|
|
|
async function getProjectsInfo(ctx) { |
|
|
|
try { |
|
|
|
const { models } = ctx.fs.dc; |
|
|
|
const { clickHouse, utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs |
|
|
|
const { database: anxinyun } = clickHouse.anxinyun.opts.config |
|
|
|
const { alarmId, limit, page, projectCorrelationId, pepProjectId, keywordTarget, keyword } = ctx.query; |
|
|
|
const { userInfo } = ctx.fs.api; |
|
|
|
// let where = {}
|
|
|
|
// if (!userInfo.role.includes('SuperAdmin') && !userInfo.role.includes('admin')) {
|
|
|
|
// where.projectCorrelationId = { $in: userInfo.correlationProject }
|
|
|
|
// }
|
|
|
|
// if (projectCorrelationId) {//查指定项目,控制台全局切换
|
|
|
|
// where.projectCorrelationId = projectCorrelationId
|
|
|
|
// }
|
|
|
|
let anxinStruc = await anxinStrucIdRange({ |
|
|
|
ctx, pepProjectId, keywordTarget, keyword |
|
|
|
}) |
|
|
|
const anxinStrucIds = anxinStruc.map(a => a.strucId); |
|
|
|
//先查全部的摄像头
|
|
|
|
const videoList = anxinStrucIds.length ? await clickHouse.vcmp.query( |
|
|
|
`select camera.id,
|
|
|
|
camera.name, |
|
|
|
camera.serial_no from camera where camera.delete=false and camera.recycle_time is null |
|
|
|
|
|
|
|
LEFT JOIN ${anxinyun}.t_video_ipc AS anxinIpc |
|
|
|
ON toString(anxinIpc.channel_no) = cameraAlarm.cameraChannelNo |
|
|
|
AND anxinIpc.serial_no = cameraAlarm.cameraSerialNo |
|
|
|
LEFT JOIN ${anxinyun}.t_structure AS anxinStruc |
|
|
|
ON anxinStruc.id = anxinIpc.structure |
|
|
|
AND anxinStruc.id IN (${anxinStrucIds.join(',')}) |
|
|
|
LEFT JOIN ${anxinyun}.t_video_ipc_station AS anxinIpcStation |
|
|
|
ON anxinIpcStation.ipc = anxinIpc.id |
|
|
|
LEFT JOIN ${anxinyun}.t_sensor AS anxinStation |
|
|
|
ON anxinStation.id = anxinIpcStation.station` |
|
|
|
).toPromise() : [] |
|
|
|
|
|
|
|
|
|
|
|
ctx.status = 200; |
|
|
|
ctx.body = [] |
|
|
|
} catch (error) { |
|
|
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|
|
|
ctx.status = 400; |
|
|
|
ctx.body = { |
|
|
|
message: typeof error == 'string' ? error : undefined |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//BI分析-数据
|
|
|
|
async function getDataAlarmsAggDay(ctx) { |
|
|
|
try { |
|
|
@ -323,8 +274,6 @@ async function getLatestDynamic(ctx) { |
|
|
|
} |
|
|
|
|
|
|
|
module.exports = { |
|
|
|
getProjectsInfo, |
|
|
|
|
|
|
|
getDataAlarmsAggDay, |
|
|
|
getAppAlarmsAggDay, |
|
|
|
getVideoAlarmsAggDay, |
|
|
|