c09880d791eccb623be595aeb11d6ce0c4561a3f..a5353feebdef3812ea7692603263fe0217d5bc15
2025-03-20 潘志宝
Merge branch 'master' of http://dlindusit.com:53929/r/iailab-plat-sdk-demo
a5353f 对比 | 目录
2025-03-20 潘志宝
IailabClient
21231a 对比 | 目录
2025-03-20 潘志宝
demo
b91310 对比 | 目录
2025-03-12 潘志宝
demo
a0df01 对比 | 目录
已修改3个文件
63 ■■■■ 文件已修改
libs/iailab-plat-sdk-1.0.0-jar-with-dependencies.jar 补丁 | 查看 | 原始文档 | blame | 历史
libs/iailab-plat-sdk-1.0.0.jar 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/iailab/sdk/demo/HttpClientDemo.java 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
libs/iailab-plat-sdk-1.0.0-jar-with-dependencies.jar
Binary files differ
libs/iailab-plat-sdk-1.0.0.jar
Binary files differ
src/main/java/com/iailab/sdk/demo/HttpClientDemo.java
@@ -2,71 +2,24 @@
import com.iailab.sdk.auth.client.IailabClient;
import com.iailab.sdk.auth.client.common.pojo.CommonResult;
import com.iailab.sdk.auth.client.dto.ApiDataQueryDTO;
import com.iailab.sdk.auth.client.dto.TokenDTO;
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 = IailabClient.authenticate();
        System.out.println(authenticate);
    }
    /**
     * 根据refreshToken刷新授权token
     * @throws Exception
     */
    public void refreshToken() throws Exception {
        IailabClient.authenticate();
        TokenDTO authenticate = IailabClient.refreshToken();
        System.out.println(authenticate);
    }
    public CommonResult<Map<String, Object>> queryPointsRealValue() throws Exception {
        List<String> pointNos = new ArrayList<>();
        pointNos.add("F0000120031");
    @PostMapping("/query-points/history-value")
    public CommonResult<Map<String, Object>> queryPointsRealValue(@RequestBody List<String> pointNos) {
        return IailabClient.getInstance().queryPointsRealValue(pointNos);
    }
    /**
     * 测试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 = IailabClient.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 = IailabClient.doHttp("get", "http://172.16.8.100/admin-api/data/api/device-value", params);
        System.out.println(s);
    }
}