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

---
 src/main/java/com/iailab/sdk/demo/HttpClientDemo.java |   75 +++++--------------------------------
 1 files changed, 10 insertions(+), 65 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..8e7ce35 100644
--- a/src/main/java/com/iailab/sdk/demo/HttpClientDemo.java
+++ b/src/main/java/com/iailab/sdk/demo/HttpClientDemo.java
@@ -1,80 +1,25 @@
 package com.iailab.sdk.demo;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
 import com.iailab.sdk.auth.client.IailabAuthClient;
-import com.iailab.sdk.auth.client.dto.TokenDTO;
-import com.iailab.sdk.demo.dto.ApiDataQueryDTO;
-import com.iailab.sdk.util.http.IailabHttpUtils;
-import org.springframework.beans.factory.annotation.Value;
+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 {
 
-    @Value("${iailab.token.base-url}")
-    private String baseUrl;
-
-    @Value("${iailab.api.user-simple-list}")
-    private String userSimpleList;
-
-    @Value("${iailab.api.query-plans-chart}")
-    private String queryPlansChart;
-
-    @Value("${iailab.api.device-value}")
-    private String deviceValue;
-
-    /**
-     * 无参get请求测试
-     * @throws Exception
-     */
-    public void HttpGet() throws Exception {
-        String s = IailabHttpUtils.doGet(baseUrl + userSimpleList, null, "utf-8");
-        System.out.println(s);
-    }
-
-    public void HttpPost() throws Exception {
-        ApiDataQueryDTO apiDataQueryDTO = new ApiDataQueryDTO();
-        ObjectMapper objectMapper = new ObjectMapper();
-        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);
-        String jsonString = objectMapper.writeValueAsString(apiDataQueryDTO);
-        String s = IailabHttpUtils.doPost(baseUrl + queryPlansChart, jsonString, "utf-8");
-        System.out.println(s);
-    }
-
-    public void HttpGetDeviceValue() throws Exception {
-        Map<String, String> params = new HashMap<>();
-        params.put("pointNos", "M0000101158,M0000101157,M0000101156,M0000101155,F0000120026");
-        String s = IailabHttpUtils.doGet(baseUrl + deviceValue, params, "utf-8");
-        System.out.println(s);
-    }
-
-    /**
-     * 获取平台授权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);
+    @PostMapping("/query-points/history-value")
+    public CommonResult<Map<String, Object>> queryPointsRealValue(@RequestBody List<String> pointNos) {
+        return IailabAuthClient.getInstance().queryPointsRealValue(pointNos);
     }
 }

--
Gitblit v1.9.3