From 493131df8bb95a4d10dd2c037de73f4f2d7c5e1a Mon Sep 17 00:00:00 2001 From: lin <648540858@qq.com> Date: Thu, 20 Nov 2025 14:03:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=8E=B7=E5=8F=96=E9=80=9A?= =?UTF-8?q?=E9=81=93=E5=90=8C=E6=AD=A5=E8=BF=9B=E5=BA=A6=E5=8F=96=E5=8F=82?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/gb28181/controller/DeviceQuery.java | 38 +++++++++++++++++-- web/src/api/device.js | 5 ++- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java index 6954101a1..a4c3bf2da 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/DeviceQuery.java @@ -328,11 +328,13 @@ public class DeviceQuery { return result; } - + /** + * 此接口保留仅作为兼容,后续将移除,请迁移至 + */ @GetMapping("/{deviceId}/sync_status") - @Operation(summary = "获取通道同步进度", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Operation(summary = "获取通道同步进度(此接口保留仅作为兼容,后续将移除,请迁移至 /sync_status?deviceId=)", security = @SecurityRequirement(name = JwtUtils.HEADER)) @Parameter(name = "deviceId", description = "设备国标编号", required = true) - public WVPResult getSyncStatus(@PathVariable String deviceId) { + public WVPResult getSyncStatusInPath(@PathVariable String deviceId) { SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId); WVPResult wvpResult = new WVPResult<>(); if (channelSyncStatus == null) { @@ -356,6 +358,36 @@ public class DeviceQuery { return wvpResult; } + /** + * 此接口保留仅作为兼容,后续将移除,请迁移至 + */ + @GetMapping("/sync_status") + @Operation(summary = "获取通道同步进度", security = @SecurityRequirement(name = JwtUtils.HEADER)) + @Parameter(name = "deviceId", description = "设备国标编号", required = true) + public WVPResult getSyncStatus(String deviceId) { + SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId); + WVPResult wvpResult = new WVPResult<>(); + if (channelSyncStatus == null) { + wvpResult.setCode(ErrorCode.ERROR100.getCode()); + wvpResult.setMsg("同步不存在"); + }else if (channelSyncStatus.getErrorMsg() != null) { + wvpResult.setCode(ErrorCode.ERROR100.getCode()); + wvpResult.setMsg(channelSyncStatus.getErrorMsg()); + }else if (channelSyncStatus.getTotal() == null){ + wvpResult.setCode(ErrorCode.SUCCESS.getCode()); + wvpResult.setMsg("等待通道信息..."); + }else if (channelSyncStatus.getTotal() == 0){ + wvpResult.setCode(ErrorCode.SUCCESS.getCode()); + wvpResult.setMsg(ErrorCode.SUCCESS.getMsg()); + wvpResult.setData(channelSyncStatus); + }else { + wvpResult.setCode(ErrorCode.SUCCESS.getCode()); + wvpResult.setMsg(ErrorCode.SUCCESS.getMsg()); + wvpResult.setData(channelSyncStatus); + } + return wvpResult; + } + @GetMapping("/snap/{deviceId}/{channelId}") @Operation(summary = "请求截图") @Parameter(name = "deviceId", description = "设备国标编号", required = true) diff --git a/web/src/api/device.js b/web/src/api/device.js index fce3f300e..95c4f6619 100644 --- a/web/src/api/device.js +++ b/web/src/api/device.js @@ -5,7 +5,10 @@ import request from '@/utils/request' export function queryDeviceSyncStatus(deviceId) { return request({ method: 'get', - url: `/api/device/query/${deviceId}/sync_status` + url: `/api/device/query/sync_status`, + params: { + deviceId: deviceId + } }) }