调整获取通道同步进度取参方式

This commit is contained in:
lin
2025-11-20 14:03:06 +08:00
parent ba4620c2d6
commit 493131df8b
2 changed files with 39 additions and 4 deletions

View File

@@ -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<SyncStatus> getSyncStatus(@PathVariable String deviceId) {
public WVPResult<SyncStatus> getSyncStatusInPath(@PathVariable String deviceId) {
SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId);
WVPResult<SyncStatus> 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<SyncStatus> getSyncStatus(String deviceId) {
SyncStatus channelSyncStatus = deviceService.getChannelSyncStatus(deviceId);
WVPResult<SyncStatus> 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)

View File

@@ -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
}
})
}