You've already forked FrameTour-BE
feat(device): 更新景区设备查询接口
- 删除冗余的景区IPC设备和激活设备查询接口
- 合并设备查询逻辑到统一接口 /scenic/{scenicId}
- 新增设备名称、类型、编号作为可选查询参数
- 简化控制器代码结构,提升维护性
-保留分页功能支持大规模数据展示
- 统一异常处理流程增强系统健壮性
This commit is contained in:
@@ -368,50 +368,19 @@ public class DeviceV2Controller {
|
|||||||
|
|
||||||
// ========== 景区设备管理操作 ==========
|
// ========== 景区设备管理操作 ==========
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取景区IPC设备列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/scenic/{scenicId}/ipc")
|
|
||||||
public ApiResponse<PageResponse<DeviceV2DTO>> getScenicIpcDevices(@PathVariable Long scenicId,
|
|
||||||
@RequestParam(defaultValue = "1") Integer page,
|
|
||||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
|
||||||
log.info("获取景区IPC设备列表, scenicId: {}, page: {}, pageSize: {}", scenicId, page, pageSize);
|
|
||||||
try {
|
|
||||||
PageResponse<DeviceV2DTO> response = deviceIntegrationService.getScenicIpcDevices(scenicId, page, pageSize);
|
|
||||||
return ApiResponse.success(response);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("获取景区IPC设备列表失败, scenicId: {}", scenicId, e);
|
|
||||||
return ApiResponse.fail("获取景区IPC设备列表失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取景区激活设备列表
|
|
||||||
*/
|
|
||||||
@GetMapping("/scenic/{scenicId}/active")
|
|
||||||
public ApiResponse<PageResponse<DeviceV2DTO>> getScenicActiveDevices(@PathVariable Long scenicId,
|
|
||||||
@RequestParam(defaultValue = "1") Integer page,
|
|
||||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
|
||||||
log.info("获取景区激活设备列表, scenicId: {}, page: {}, pageSize: {}", scenicId, page, pageSize);
|
|
||||||
try {
|
|
||||||
PageResponse<DeviceV2DTO> response = deviceIntegrationService.getScenicActiveDevices(scenicId, page, pageSize);
|
|
||||||
return ApiResponse.success(response);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("获取景区激活设备列表失败, scenicId: {}", scenicId, e);
|
|
||||||
return ApiResponse.fail("获取景区激活设备列表失败: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取景区所有设备列表
|
* 获取景区所有设备列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/scenic/{scenicId}/all")
|
@GetMapping("/scenic/{scenicId}")
|
||||||
public ApiResponse<PageResponse<DeviceV2DTO>> getScenicAllDevices(@PathVariable Long scenicId,
|
public ApiResponse<PageResponse<DeviceV2DTO>> getScenicAllDevices(@PathVariable Long scenicId,
|
||||||
|
@RequestParam(required = false) String name,
|
||||||
|
@RequestParam(required = false) String type,
|
||||||
|
@RequestParam(required = false) String no,
|
||||||
@RequestParam(defaultValue = "1") Integer page,
|
@RequestParam(defaultValue = "1") Integer page,
|
||||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||||
log.info("获取景区所有设备列表, scenicId: {}, page: {}, pageSize: {}", scenicId, page, pageSize);
|
log.info("获取景区所有设备列表, scenicId: {}, page: {}, pageSize: {}", scenicId, page, pageSize);
|
||||||
try {
|
try {
|
||||||
PageResponse<DeviceV2DTO> response = deviceIntegrationService.listDevices(page, pageSize, null, null, null, null, scenicId);
|
PageResponse<DeviceV2DTO> response = deviceIntegrationService.listDevices(page, pageSize, name, no, type, null, scenicId);
|
||||||
return ApiResponse.success(response);
|
return ApiResponse.success(response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("获取景区所有设备列表失败, scenicId: {}", scenicId, e);
|
log.error("获取景区所有设备列表失败, scenicId: {}", scenicId, e);
|
||||||
|
|||||||
Reference in New Issue
Block a user