From 67f535cd09dfcc23abe20ca16ae780322eab96f8 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 16 Nov 2022 14:40:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=91=8A=E8=AD=A6kind=20?= =?UTF-8?q?=E5=85=BC=E9=A1=BE=20=E7=BB=93=E6=9E=84=E7=89=A9=E5=8F=AF?= =?UTF-8?q?=E8=A7=81=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/data.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index 7ad2046..65b0c7a 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/api/app/lib/controllers/alarm/data.js @@ -15,10 +15,10 @@ async function groupList (ctx) { for (let g of groupRes) { g.unit = await await clickHouse.anxinyun.query(` SELECT DISTINCT - t_alarm_group_unit.id AS id,t_alarm_group_unit.name AS name,t_alarm_group_unit.group_id AS groupId + t_alarm_group_unit.id AS id,t_alarm_group_unit.name AS name,t_alarm_group_unit.group_id AS groupId FROM t_alarm_group_unit INNER JOIN ${dataAlarm}.alarms - ON t_alarm_group_unit.id = ${dataAlarm}.alarms.AlarmGroupUnit + ON t_alarm_group_unit.id = ${dataAlarm}.alarms.AlarmGroupUnit WHERE group_id = ${g.id} `).toPromise(); } From 602f5145ecb613653404380c0d27dc06d3d41603 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 16 Nov 2022 14:40:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=91=8A=E8=AD=A6kind=20?= =?UTF-8?q?=E5=85=BC=E9=A1=BE=20=E7=BB=93=E6=9E=84=E7=89=A9=E5=8F=AF?= =?UTF-8?q?=E8=A7=81=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/video.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js index 270c0f8..a8ec73a 100644 --- a/api/app/lib/controllers/alarm/video.js +++ b/api/app/lib/controllers/alarm/video.js @@ -6,6 +6,12 @@ async function deviceType (ctx) { try { const { models } = ctx.fs.dc; const { clickHouse } = ctx.app.fs + const { database: anxinyun } = clickHouse.anxinyun.opts.config + const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs + let anxinStruc = await anxinStrucIdRange({ + ctx, + }) + const anxinStrucIds = anxinStruc.map(a => a.strucId) const kindRes = await clickHouse.vcmp.query(` SELECT DISTINCT @@ -16,6 +22,10 @@ async function deviceType (ctx) { INNER JOIN camera_status_alarm ON camera.channel_no = camera_status_alarm.channel_no AND camera.serial_no = camera_status_alarm.serial_no + INNER JOIN ${anxinyun}.t_video_ipc + ON toString(${anxinyun}.t_video_ipc.channel_no) = camera_status_alarm.channel_no + AND ${anxinyun}.t_video_ipc.serial_no = camera_status_alarm.serial_no + ${`WHERE ${anxinyun}.t_video_ipc.structure IN (${anxinStrucIds.join(',')})`} `).toPromise() ctx.status = 200; ctx.body = kindRes @@ -34,7 +44,7 @@ async function alarmList (ctx) { const { clickHouse } = ctx.app.fs const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs const { database: anxinyun } = clickHouse.anxinyun.opts.config - const { pepProjectId, keywordTarget, keyword, state, kindId, sustainTimeStart, sustainTimeEnd, limit, page, statusId, toExport} = ctx.query + const { pepProjectId, keywordTarget, keyword, state, kindId, sustainTimeStart, sustainTimeEnd, limit, page, statusId, toExport } = ctx.query let anxinStruc = await anxinStrucIdRange({ ctx, pepProjectId, keywordTarget, keyword @@ -78,7 +88,7 @@ async function alarmList (ctx) { ) `) } - if(statusId){ + if (statusId) { statusAlarmWhereOption.push(`camera_status_alarm.status_id = ${statusId}`) } @@ -279,7 +289,7 @@ async function alarmList (ctx) { } } -async function exportVideoAlarms(ctx, alarmList) { +async function exportVideoAlarms (ctx, alarmList) { let accessType = { yingshi: "萤石云", nvr: "NVR", ipc: "IPC", cascade: "级联" } try { const { clickHouse, utils: { simpleExcelDown, getExportAlarmHeader } } = ctx.app.fs; @@ -328,7 +338,7 @@ async function exportVideoAlarms(ctx, alarmList) { } } } -async function confirm(ctx) { +async function confirm (ctx) { try { const { alarmId, content, confirmPost } = ctx.request.body; // TODO: 以视频·应用的秘钥进行鉴权