From a0df015b37f653456ce644bfc1fbc337d343d88e Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期三, 12 三月 2025 18:06:40 +0800
Subject: [PATCH] demo

---
 libs/iailab-plat-sdk-1.0.0.jar                            |    0 
 libs/iailab-plat-sdk-1.0.0-jar-with-dependencies.jar      |    0 
 src/main/java/com/iailab/sdk/demo/HttpClientDemo.java     |   75 ++++---------------------------------
 src/test/java/com/iailab/sdk/demo/HttpClientDemoTest.java |   15 +++++++
 4 files changed, 23 insertions(+), 67 deletions(-)

diff --git a/libs/iailab-plat-sdk-1.0.0-jar-with-dependencies.jar b/libs/iailab-plat-sdk-1.0.0-jar-with-dependencies.jar
index 0361cd1..a20facf 100644
--- a/libs/iailab-plat-sdk-1.0.0-jar-with-dependencies.jar
+++ b/libs/iailab-plat-sdk-1.0.0-jar-with-dependencies.jar
Binary files differ
diff --git a/libs/iailab-plat-sdk-1.0.0.jar b/libs/iailab-plat-sdk-1.0.0.jar
index 80a8d22..406d718 100644
--- a/libs/iailab-plat-sdk-1.0.0.jar
+++ b/libs/iailab-plat-sdk-1.0.0.jar
Binary files differ
diff --git a/src/main/java/com/iailab/sdk/demo/HttpClientDemo.java b/src/main/java/com/iailab/sdk/demo/HttpClientDemo.java
index 3c8580b..8e7ce35 100644
--- a/src/main/java/com/iailab/sdk/demo/HttpClientDemo.java
+++ b/src/main/java/com/iailab/sdk/demo/HttpClientDemo.java
@@ -1,82 +1,25 @@
 package com.iailab.sdk.demo;
 
 import com.iailab.sdk.auth.client.IailabAuthClient;
-import com.iailab.sdk.auth.client.dto.ApiDataQueryDTO;
-import com.iailab.sdk.auth.client.dto.TokenDTO;
+import com.iailab.sdk.auth.client.common.pojo.CommonResult;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.List;
+import java.util.Map;
 
 
 /**
  * @author iailab
  */
 @RestController
+@RequestMapping("/demo")
 public class HttpClientDemo {
 
-
-    /**
-     * 获取平台授权token及refreshToken
-     */
-    public void authenticate() {
-        TokenDTO authenticate = IailabAuthClient.authenticate();
-        System.out.println(authenticate);
-    }
-
-    /**
-     * 根据refreshToken刷新授权token
-     * @throws Exception
-     */
-    public void refreshToken() throws Exception {
-        IailabAuthClient.authenticate();
-        TokenDTO authenticate = IailabAuthClient.refreshToken();
-        System.out.println(authenticate);
-    }
-
-
-    public Map<String, Object> queryPointsRealValue() throws Exception {
-        List<String> pointNos = new ArrayList<>();
-        pointNos.add("111");
+    @PostMapping("/query-points/history-value")
+    public CommonResult<Map<String, Object>> queryPointsRealValue(@RequestBody List<String> pointNos) {
         return IailabAuthClient.getInstance().queryPointsRealValue(pointNos);
-    }
-
-    public Map<String, Object> queryPlanChart() throws Exception {
-        ApiDataQueryDTO apiDataQueryDTO = new ApiDataQueryDTO();
-        List<String> itemNos = new ArrayList<>();
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        apiDataQueryDTO.setStart(sdf.parse("2024-06-11 07:24:00"));
-        apiDataQueryDTO.setEnd(sdf.parse("2024-06-13 00:00:00"));
-        itemNos.add("P0000100010");
-        apiDataQueryDTO.setItemNos(itemNos);
-        return IailabAuthClient.getInstance().queryPlanChart(apiDataQueryDTO);
-    }
-
-    /**
-     * 测试doHttp post请求
-     * @throws Exception
-     */
-    public void doHttpPost() throws Exception {
-        Map<String, Object> params = new HashMap<>();
-        List<String> itemNos = new ArrayList<>();
-        params.put("start", "2024-06-11 07:24:00");
-        params.put("end", "2024-06-13 00:00:00");
-        params.put("itemNo", null);
-        params.put("granularity", null);
-        itemNos.add("P0000100010");
-        params.put("itemNos", itemNos);
-        String s = IailabAuthClient.doHttp("POST", "http://172.16.8.100/admin-api/data/api/query-plans/chart", params);
-        System.out.println(s);
-    }
-
-    /**
-     * 测试doHttp get请求
-     * @throws Exception
-     */
-    public void doHttpGet() throws Exception {
-        Map<String, Object> params = new HashMap<>();
-        params.put("pointNos", "M0000101158,M0000101157,M0000101156,M0000101155,F0000120026");
-        String s = IailabAuthClient.doHttp("get", "http://172.16.8.100/admin-api/data/api/device-value", params);
-        System.out.println(s);
     }
 }
diff --git a/src/test/java/com/iailab/sdk/demo/HttpClientDemoTest.java b/src/test/java/com/iailab/sdk/demo/HttpClientDemoTest.java
index 880f477..c2b6895 100644
--- a/src/test/java/com/iailab/sdk/demo/HttpClientDemoTest.java
+++ b/src/test/java/com/iailab/sdk/demo/HttpClientDemoTest.java
@@ -1,11 +1,15 @@
 package com.iailab.sdk.demo;
 
+import com.alibaba.fastjson.JSONObject;
+import com.iailab.sdk.auth.client.common.pojo.CommonResult;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 
 
@@ -17,7 +21,7 @@
     private HttpClientDemo httpClientDemo;
 
 
-    @Test
+    /*@Test
     public void authenticate() {
         httpClientDemo.authenticate();
     }
@@ -49,5 +53,14 @@
     public void testDoHttpGet() throws Exception {
         // 准备参数
         httpClientDemo.doHttpGet();
+    }*/
+
+    @Test
+    public void testDoHttpGet() throws Exception {
+        // 准备参数
+        List<String> params = new ArrayList<String>();
+        params.add("M0000101153");
+        CommonResult<Map<String, Object>> mapCommonResult = httpClientDemo.queryPointsRealValue(params);
+        System.out.println(JSONObject.toJSONString(mapCommonResult));
     }
 }

--
Gitblit v1.9.3