From c3d98a259ea29c449245ad5b9a47e542af0ac499 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期三, 12 三月 2025 17:40:44 +0800
Subject: [PATCH] SDK 业务功能

---
 iailab-plat-sdk/src/main/java/com/iailab/sdk/util/http/IailabHttpUtils.java |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/util/http/IailabHttpUtils.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/util/http/IailabHttpUtils.java
index 9c1eda9..ad149fb 100644
--- a/iailab-plat-sdk/src/main/java/com/iailab/sdk/util/http/IailabHttpUtils.java
+++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/util/http/IailabHttpUtils.java
@@ -1,7 +1,7 @@
 package com.iailab.sdk.util.http;
 
 import com.iailab.sdk.auth.client.IailabAuthClient;
-import com.iailab.sdk.auth.config.AuthProperties;
+import com.iailab.sdk.auth.config.SdkAutoConfiguration;
 import org.apache.http.HttpEntity;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpGet;
@@ -18,12 +18,6 @@
 
 public class IailabHttpUtils {
 
-    private static AuthProperties authProperties;
-
-    public static void setAuthProperties(AuthProperties properties) {
-        authProperties = properties;
-    }
-
     /**
      *
      * @param url
@@ -31,7 +25,7 @@
      * @param charset
      * @return
      */
-    public static String doGet(String url, Map<String, String> map, String charset) throws Exception {
+    public static String doGet(String url, Map<String, Object> map, String charset) throws Exception {
         System.out.println("start doGet url: " + url);
         checkToken();
         org.apache.http.client.HttpClient httpClient = null;
@@ -48,7 +42,7 @@
                 }
                 map.forEach((k, v) -> {
                     try {
-                        sb.append(k + "=" + URLEncoder.encode(v, charset) + "&");
+                        sb.append(k + "=" + URLEncoder.encode(v.toString(), charset) + "&");
                     } catch (UnsupportedEncodingException e) {
                         e.printStackTrace();
                     }
@@ -61,8 +55,7 @@
             httpGet.addHeader("Accept", "application/json");
             httpGet.addHeader("Content-Type", "application/json;charset=UTF-8");
             httpGet.addHeader("Authorization", "Bearer " + IailabAuthClient.accessToken);
-            httpGet.addHeader("Tenant-Id", String.valueOf(authProperties.getTenantId()));
-
+            httpGet.addHeader("Tenant-Id", SdkAutoConfiguration.TENANT_ID.toString());
             HttpResponse response = httpClient.execute(httpGet);
             if (response != null) {
                 HttpEntity resEntity = response.getEntity();
@@ -96,7 +89,7 @@
             httpPost.addHeader("Accept", "application/json");
             httpPost.addHeader("Content-Type", "application/json;charset=UTF-8");
             httpPost.addHeader("Authorization", "Bearer " + IailabAuthClient.accessToken);
-            httpPost.addHeader("Tenant-Id", String.valueOf(authProperties.getTenantId()));
+            httpPost.addHeader("Tenant-Id", SdkAutoConfiguration.TENANT_ID.toString());
             StringEntity stringEntity = new StringEntity(json);
             stringEntity.setContentEncoding("UTF-8");
             stringEntity.setContentType("application/json");

--
Gitblit v1.9.3