From fc5fd7e63b6cacbffc99eee37d551e513872b47d Mon Sep 17 00:00:00 2001
From: houzhongjian <houzhongyi@126.com>
Date: 星期五, 07 三月 2025 10:39:03 +0800
Subject: [PATCH] 增加doHttp接口测试

---
 src/main/java/com/iailab/sdk/demo/HttpClientDemo.java |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/iailab/sdk/demo/HttpClientDemo.java b/src/main/java/com/iailab/sdk/demo/HttpClientDemo.java
index d2060ab..e66e3b2 100644
--- a/src/main/java/com/iailab/sdk/demo/HttpClientDemo.java
+++ b/src/main/java/com/iailab/sdk/demo/HttpClientDemo.java
@@ -1,5 +1,6 @@
 package com.iailab.sdk.demo;
 
+import com.alibaba.fastjson.JSON;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.iailab.sdk.auth.client.IailabAuthClient;
 import com.iailab.sdk.auth.client.dto.TokenDTO;
@@ -54,7 +55,7 @@
     }
 
     public void HttpGetDeviceValue() throws Exception {
-        Map<String, String> params = new HashMap<>();
+        Map<String, Object> params = new HashMap<>();
         params.put("pointNos", "M0000101158,M0000101157,M0000101156,M0000101155,F0000120026");
         String s = IailabHttpUtils.doGet(baseUrl + deviceValue, params, "utf-8");
         System.out.println(s);
@@ -77,4 +78,32 @@
         TokenDTO authenticate = IailabAuthClient.refreshToken();
         System.out.println(authenticate);
     }
+
+    /**
+     * 测试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", baseUrl + queryPlansChart, 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", baseUrl + deviceValue, params);
+        System.out.println(s);
+    }
 }

--
Gitblit v1.9.3