From d097b6d0ede9a50036f2e57e04832a2d916ec60b Mon Sep 17 00:00:00 2001
From: liriming <1343021927@qq.com>
Date: 星期四, 20 三月 2025 18:08:47 +0800
Subject: [PATCH] demo

---
 src/main/java/com/iailab/sdk/demo/HttpClientDemo.java |   82 +++++++++-------------------------------
 1 files changed, 19 insertions(+), 63 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..6ad0804 100644
--- a/src/main/java/com/iailab/sdk/demo/HttpClientDemo.java
+++ b/src/main/java/com/iailab/sdk/demo/HttpClientDemo.java
@@ -1,80 +1,36 @@
 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 org.springframework.web.bind.annotation.RestController;
+import com.alibaba.fastjson.JSONObject;
+import com.iailab.sdk.auth.client.IailabClient;
+import com.iailab.sdk.auth.client.common.pojo.CommonResult;
+import com.iailab.sdk.auth.client.common.pojo.PageResult;
+import com.iailab.sdk.auth.client.dto.StAlarmAndSuggestPageReqDTO;
+import com.iailab.sdk.auth.client.dto.StAlarmAndSuggestRespDTO;
+import org.springframework.web.bind.annotation.*;
 
-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);
+    @PostMapping("/query-points/history-value")
+    public CommonResult<Map<String, Object>> queryPointsRealValue(@RequestBody List<String> pointNos) {
+        return IailabClient.getInstance().queryPointsRealValue(pointNos);
     }
 
-    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);
+    @PostMapping("/alarm-suggest/page")
+    public CommonResult<PageResult<StAlarmAndSuggestRespDTO>> getAlarmAndSuggestPage(@RequestBody StAlarmAndSuggestPageReqDTO reqVO) {
+        return IailabClient.getInstance().getAlarmAndSuggestPage(reqVO);
     }
 
-    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);
+    @GetMapping("/handleHttp")
+    public CommonResult<Object> handleHttp(@RequestParam("method") String method, @RequestParam("url") String url, @RequestParam("params") Map<String, Object> params) {
+        return IailabClient.getInstance().handleHttp(method,url,params);
     }
 }

--
Gitblit v1.9.3