refactor(integration): 重构集成服务的降级机制

-移除各服务自定义的降级服务类,统一降级逻辑
- 新增 IntegrationFallbackService作为通用降级服务
- 更新设备和景区服务的降级处理方式
- 优化降级缓存管理,增加统计信息和批量清理功能
- 调整 API 接口,移除扁平化批量更新等相关方法
This commit is contained in:
2025-09-02 12:24:55 +08:00
parent d35a1facbd
commit 8c8a6baa5e
13 changed files with 757 additions and 260 deletions

View File

@@ -399,21 +399,6 @@ public class DeviceV2Controller {
}
}
/**
* 扁平化批量更新设备配置
*/
@PostMapping("/{id}/config/flat-batch")
public ApiResponse<String> batchFlatUpdateDeviceConfig(@PathVariable Long id,
@RequestBody Map<String, Object> configs) {
log.info("扁平化批量更新设备配置, deviceId: {}, configs count: {}", id, configs.size());
try {
deviceConfigIntegrationService.batchFlatUpdateDeviceConfig(id, configs);
return ApiResponse.success("设备配置批量更新成功");
} catch (Exception e) {
log.error("扁平化批量更新设备配置失败, deviceId: {}", id, e);
return ApiResponse.fail("扁平化批量更新设备配置失败: " + e.getMessage());
}
}
/**
* 更新设备配置
@@ -431,27 +416,6 @@ public class DeviceV2Controller {
}
}
/**
* 配置摄像头参数(快捷方法)
*/
@PutMapping("/{id}/config/camera")
public ApiResponse<String> configureCameraParams(@PathVariable Long id, @RequestBody Map<String, Object> request) {
String ipAddress = (String) request.get("ipAddress");
String resolution = (String) request.get("resolution");
Integer framerate = request.get("framerate") != null ? Integer.valueOf(request.get("framerate").toString()) : null;
String protocol = (String) request.get("protocol");
String username = (String) request.get("username");
String password = (String) request.get("password");
log.info("配置摄像头参数, deviceId: {}, ipAddress: {}, resolution: {}", id, ipAddress, resolution);
try {
deviceConfigIntegrationService.configureCameraParams(id, ipAddress, resolution, framerate, protocol, username, password);
return ApiResponse.success("摄像头参数配置成功");
} catch (Exception e) {
log.error("配置摄像头参数失败, deviceId: {}", id, e);
return ApiResponse.fail("配置摄像头参数失败: " + e.getMessage());
}
}
/**
* 删除设备配置