From b44442b2168828d50d1fdf484c4187073bf099f6 Mon Sep 17 00:00:00 2001
From: liriming <1343021927@qq.com>
Date: 星期四, 20 三月 2025 14:06:00 +0800
Subject: [PATCH] sdk去掉个性化接口

---
 iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java
index 2c06c3c..a7a2f43 100644
--- a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java
+++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java
@@ -22,7 +22,9 @@
 import org.springframework.web.client.RestTemplate;
 
 import java.nio.charset.StandardCharsets;
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import static com.iailab.framework.common.exception.util.ServiceExceptionUtil.exception;
 
@@ -198,6 +200,33 @@
         return authTokenDTO;
     }
 
+    public CommonResult<JSONObject> handleHttp(String method, String url, Map<String, Object> params) {
+        JSONObject data = new JSONObject();
+        String resp = null;
+        try {
+            String upperMethod = method.toUpperCase();
+            if ("GET".equals(upperMethod)) {
+                resp = IailabHttpUtils.doGet(url, params, CHARSET);
+            } else if ("POST".equals(upperMethod)) {
+                ObjectMapper objectMapper = new ObjectMapper();
+                resp = IailabHttpUtils.doPost(url, objectMapper.writeValueAsString(params), CHARSET);
+            }
+            if (StringUtils.isEmpty(resp)) {
+                return CommonResult.error(GlobalErrorCodeConstants.EMPTY_RESP);
+            }
+            JSONObject jsonObject = JSON.parseObject(resp);
+            Integer respCode = jsonObject.getInteger(RESP_CODE);
+            if (!GlobalErrorCodeConstants.SUCCESS.getCode().equals(respCode)) {
+                CommonResult.error(respCode, jsonObject.getString(RESP_MSG));
+            }
+            data = jsonObject.getJSONObject(RESP_DATA);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            return CommonResult.error(GlobalErrorCodeConstants.UNKNOWN.getCode(), ex.getMessage());
+        }
+        return CommonResult.success(data);
+    }
+
     /**
      * 查询多个测点当前值
      *

--
Gitblit v1.9.3