From ffad1c9f59e0132ef560ffed79bda48cc2c87f91 Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Fri, 5 Sep 2025 16:51:47 +0800 Subject: [PATCH] =?UTF-8?q?refactor(device):=20=E9=87=8D=E6=9E=84=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 DefaultConfigClient 中的 listDefaultConfigs 方法返回类型由 PageResponse 改为 CommonResponse - 更新 DefaultConfigIntegrationService 中的调用方式 - 移除 handlePageResponse 方法,改为使用 handleResponse 方法处理响应 --- .../device/client/DefaultConfigClient.java | 4 ++-- .../service/DefaultConfigIntegrationService.java | 15 ++------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/ycwl/basic/integration/device/client/DefaultConfigClient.java b/src/main/java/com/ycwl/basic/integration/device/client/DefaultConfigClient.java index f1571c1..2163c67 100644 --- a/src/main/java/com/ycwl/basic/integration/device/client/DefaultConfigClient.java +++ b/src/main/java/com/ycwl/basic/integration/device/client/DefaultConfigClient.java @@ -18,8 +18,8 @@ public interface DefaultConfigClient { * 获取默认配置列表 */ @GetMapping - PageResponse listDefaultConfigs(@RequestParam(value = "page", defaultValue = "1") int page, - @RequestParam(value = "pageSize", defaultValue = "10") int pageSize); + CommonResponse> listDefaultConfigs(@RequestParam(value = "page", defaultValue = "1") int page, + @RequestParam(value = "pageSize", defaultValue = "10") int pageSize); /** * 根据配置键获取默认配置 diff --git a/src/main/java/com/ycwl/basic/integration/device/service/DefaultConfigIntegrationService.java b/src/main/java/com/ycwl/basic/integration/device/service/DefaultConfigIntegrationService.java index 3a996e7..dbe702a 100644 --- a/src/main/java/com/ycwl/basic/integration/device/service/DefaultConfigIntegrationService.java +++ b/src/main/java/com/ycwl/basic/integration/device/service/DefaultConfigIntegrationService.java @@ -35,8 +35,8 @@ public class DefaultConfigIntegrationService { SERVICE_NAME, "defaults:list:" + page + ":" + pageSize, () -> { - PageResponse response = defaultConfigClient.listDefaultConfigs(page, pageSize); - return handlePageResponse(response, "获取默认配置列表失败"); + CommonResponse> response = defaultConfigClient.listDefaultConfigs(page, pageSize); + return handleResponse(response, "获取默认配置列表失败"); }, PageResponse.class ); @@ -216,15 +216,4 @@ public class DefaultConfigIntegrationService { } return response.getData(); } - - private PageResponse handlePageResponse(PageResponse response, String errorMessage) { - if (response == null || !response.isSuccess()) { - String msg = response != null && response.getMessage() != null - ? response.getMessage() - : errorMessage; - Integer code = response != null ? response.getCode() : 5000; - throw new IntegrationException(code, msg, SERVICE_NAME); - } - return response; - } } \ No newline at end of file