From 6bc0e9191a8098563eccca33e81b05c3af0dc30c Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 29 Sep 2022 09:36:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E5=88=86=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/video.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js index e3b32c0..d0a6fe6 100644 --- a/api/app/lib/controllers/alarm/video.js +++ b/api/app/lib/controllers/alarm/video.js @@ -27,7 +27,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, } = ctx.query + const { pepProjectId, keywordTarget, keyword, state, kindId, sustainTimeStart, sustainTimeEnd, limit, page, } = ctx.query let anxinStruc = await anxinStrucIdRange({ ctx, pepProjectId, keywordTarget, keyword @@ -128,6 +128,8 @@ async function alarmList (ctx) { ${`WHERE ${anxinyun}.t_video_ipc.structure IN (${anxinStrucIds.join(',')})` } ) + ${limit ? 'LIMIT ' + limit : ''} + ${limit && page ? 'OFFSET ' + parseInt(limit) * parseInt(page) : ''} ) AS cameraAlarm LEFT JOIN camera_status ON cameraAlarm.platform = camera_status.platform From 81d5d4855984986d48dc92343fd70e85273a5414 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 29 Sep 2022 15:45:33 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E6=8A=93=E5=8F=96=E6=B5=8B=E7=82=B9=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/video.js | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js index d0a6fe6..5d8dcfd 100644 --- a/api/app/lib/controllers/alarm/video.js +++ b/api/app/lib/controllers/alarm/video.js @@ -87,7 +87,9 @@ async function alarmList (ctx) { camera_status.describe AS statusDescribe, camera_status_resolve.resolve AS resolve, "gbCamera".online AS cameraOnline, - anxinIpc.t_video_ipc.name, + anxinIpc.t_video_ipc.name AS anxinIpcPosition, + anxinStation.id AS anxinStationId, + anxinStation.name AS anxinStationName, anxinStruc.name AS strucName, anxinStruc.id AS strucId FROM @@ -144,6 +146,10 @@ async function alarmList (ctx) { AND anxinIpc.serial_no = cameraAlarm.cameraSerialNo LEFT JOIN ${anxinyun}.t_structure AS anxinStruc ON anxinStruc.id = anxinIpc.structure + 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() @@ -165,6 +171,13 @@ async function alarmList (ctx) { name: a.strucName }) } + if (a.anxinStationId && !curD.station.some(s => s.id == a.anxinStationId)) { + curD.station.push({ + id: a.anxinStationId, + name: a.anxinStationName, + position: a.anxinIpcPosition + }) + } } else { let d = { cameraId: a.cameraId, @@ -185,7 +198,8 @@ async function alarmList (ctx) { cameraKindId: a.cameraKindId, resolve: [], - struc: [] + struc: [], + station: [] } if (a.resolveId) { d.resolve.push({ @@ -199,6 +213,13 @@ async function alarmList (ctx) { name: a.strucName }) } + if (a.anxinStationId) { + d.station.push({ + id: a.anxinStationId, + name: a.anxinStationName, + position: a.anxinIpcPosition + }) + } returnD.push(d) positionD[a.cameraId] = { positionReturnD: returnD.length - 1