From 63108d80c9dfa941f43b72ab58acccf1ddfc03aa Mon Sep 17 00:00:00 2001
From: liriming <1343021927@qq.com>
Date: 星期三, 19 三月 2025 11:27:20 +0800
Subject: [PATCH] sdk

---
 iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/ApiPointValueDTO.java        |   22 +++
 iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/AlarmMessageRespDTO.java     |   55 +++++++++
 iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataChartRespVO.java      |   34 +++++
 iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java                |   56 ++++++++
 iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PowerRunStateDTO.java        |   26 ++++
 iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataViewDTO.java          |   82 +++++++++++++
 iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataSingleChartReqVO.java |   30 +++++
 iailab-plat-sdk/src/test/java/com/iailab/sdk/IailabClientTest.java                        |    7 +
 8 files changed, 308 insertions(+), 4 deletions(-)

diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java
index b97e900..667a51a 100644
--- a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java
+++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/IailabClient.java
@@ -6,10 +6,7 @@
 import com.iailab.sdk.auth.client.common.exception.enums.GlobalErrorCodeConstants;
 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.ApiPointsValueQueryDTO;
-import com.iailab.sdk.auth.client.dto.StAlarmAndSuggestPageReqDTO;
-import com.iailab.sdk.auth.client.dto.StAlarmAndSuggestRespDTO;
-import com.iailab.sdk.auth.client.dto.TokenDTO;
+import com.iailab.sdk.auth.client.dto.*;
 import com.iailab.sdk.auth.config.SdkAutoConfiguration;
 import com.iailab.sdk.auth.constants.SdkErrorCodeConstants;
 import com.iailab.sdk.util.http.IailabHttpUtils;
@@ -19,6 +16,7 @@
 import org.springframework.util.Base64Utils;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.client.RestTemplate;
 
 import java.nio.charset.StandardCharsets;
@@ -304,4 +302,54 @@
         }
         return CommonResult.success(data);
     }
+
+    /**
+     * 发电厂机组运行情况
+     * @return
+     */
+    public CommonResult<List<PowerRunStateDTO>> getPowerRunState() {
+        List<PowerRunStateDTO> list = new ArrayList<>();
+        try {
+            String url = BASE_URL + "/ansteel/api/mcs/power-run-state/list";
+            String resp = IailabHttpUtils.doGet(url, new HashMap<>(), "UTF-8");
+            if (StringUtils.isEmpty(resp)) {
+                return CommonResult.error(GlobalErrorCodeConstants.EMPTY_RESP);
+            }
+            JSONObject jsonObject = JSON.parseObject(resp);
+            Integer respCode = jsonObject.getInteger(RESP_CODE);
+            if (!GlobalErrorCodeConstants.SUCCESS.getCode().equals(respCode)) {
+                CommonResult.error(respCode, jsonObject.getString(RESP_MSG));
+            }
+            Long total = Long.parseLong(jsonObject.getJSONObject(RESP_DATA).get("total").toString());
+            list = jsonObject.getJSONObject(RESP_DATA).getJSONArray("list").toJavaList(PowerRunStateDTO.class);
+        } catch (Exception ex) {
+            return CommonResult.error(GlobalErrorCodeConstants.UNKNOWN.getCode(), ex.getMessage());
+        }
+        return CommonResult.success(list);
+    }
+
+    /**
+     * 预测数据图表
+     * @param reqVO
+     * @return
+     */
+    public CommonResult<PreDataChartRespVO> getPreDataChart(PreDataSingleChartReqVO reqVO) {
+        PreDataChartRespVO respVO = new PreDataChartRespVO();
+        try {
+            String url = BASE_URL + "/ansteel/api/mcs/predict-data/charts";
+            String resp = IailabHttpUtils.doPost(url, JSON.toJSONString(reqVO), "UTF-8");
+            if (StringUtils.isEmpty(resp)) {
+                return CommonResult.error(GlobalErrorCodeConstants.EMPTY_RESP);
+            }
+            JSONObject jsonObject = JSON.parseObject(resp);
+            Integer respCode = jsonObject.getInteger(RESP_CODE);
+            if (!GlobalErrorCodeConstants.SUCCESS.getCode().equals(respCode)) {
+                CommonResult.error(respCode, jsonObject.getString(RESP_MSG));
+            }
+            respVO = jsonObject.getJSONObject(RESP_DATA).toJavaObject(PreDataChartRespVO.class);
+        } catch (Exception ex) {
+            return CommonResult.error(GlobalErrorCodeConstants.UNKNOWN.getCode(), ex.getMessage());
+        }
+        return CommonResult.success(respVO);
+    }
 }
\ No newline at end of file
diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/AlarmMessageRespDTO.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/AlarmMessageRespDTO.java
new file mode 100644
index 0000000..8a5ba62
--- /dev/null
+++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/AlarmMessageRespDTO.java
@@ -0,0 +1,55 @@
+package com.iailab.sdk.auth.client.dto;
+
+/**
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年08月29日
+ */
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年08月29日
+ */
+@Data
+public class AlarmMessageRespDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String configId;
+
+    private String title;
+
+    private String content;
+
+    private String alarmObj;
+
+    private String pointId;
+
+    private String itemId;
+
+    private BigDecimal currentValue;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date outTime;
+
+    private BigDecimal outValue;
+
+    private String alarmType;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date alarmTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+}
\ No newline at end of file
diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/ApiPointValueDTO.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/ApiPointValueDTO.java
new file mode 100644
index 0000000..d74dbeb
--- /dev/null
+++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/ApiPointValueDTO.java
@@ -0,0 +1,22 @@
+package com.iailab.sdk.auth.client.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年08月19日
+ */
+@Data
+public class ApiPointValueDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date t;
+
+    private double v;
+}
\ No newline at end of file
diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PowerRunStateDTO.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PowerRunStateDTO.java
new file mode 100644
index 0000000..09099ec
--- /dev/null
+++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PowerRunStateDTO.java
@@ -0,0 +1,26 @@
+package com.iailab.sdk.auth.client.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author lirm
+ * @date 2025年03月13日
+ */
+@Data
+public class PowerRunStateDTO implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+    private String machineName;
+    private String qhRate;
+    private String fhRate;
+    private String gasTotal;
+    private String gasCost;
+    private String gasSurplus;
+    private String bfg;
+    private String ldg;
+    private String cog;
+}
diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataChartRespVO.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataChartRespVO.java
new file mode 100644
index 0000000..8193b1b
--- /dev/null
+++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataChartRespVO.java
@@ -0,0 +1,34 @@
+package com.iailab.sdk.auth.client.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年11月18日
+ */
+@Data
+public class PreDataChartRespVO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date predictTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date startTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date endTime;
+
+    private List<String> legend;
+
+    private List<String> categories;
+
+    private PreDataViewDTO dataView;
+
+}
\ No newline at end of file
diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataSingleChartReqVO.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataSingleChartReqVO.java
new file mode 100644
index 0000000..b15bd6f
--- /dev/null
+++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataSingleChartReqVO.java
@@ -0,0 +1,30 @@
+package com.iailab.sdk.auth.client.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年11月18日
+ */
+@Data
+public class PreDataSingleChartReqVO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private String chartCode;
+
+    private String timeFormat;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date predictTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date startTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date endTime;
+}
\ No newline at end of file
diff --git a/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataViewDTO.java b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataViewDTO.java
new file mode 100644
index 0000000..4da8f64
--- /dev/null
+++ b/iailab-plat-sdk/src/main/java/com/iailab/sdk/auth/client/dto/PreDataViewDTO.java
@@ -0,0 +1,82 @@
+package com.iailab.sdk.auth.client.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年08月26日
+ */
+@Data
+public class PreDataViewDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private String itemId;
+
+    private String itemName;
+
+    private String outId;
+
+    private String resultstr;
+
+    private String resultName;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date predictTime;
+
+    private BigDecimal rangeH;
+
+    private BigDecimal rangeL;
+
+    private BigDecimal deadLineH;
+
+    private BigDecimal deadLineL;
+
+    private BigDecimal limitH;
+
+    private BigDecimal limitL;
+
+    private List<ApiPointValueDTO> trendsDataH;
+
+    private List<ApiPointValueDTO> trendsDataL;
+
+    private BigDecimal currValue;
+
+    private BigDecimal maxValue;
+
+    private BigDecimal minValue;
+
+    private BigDecimal hisMax;
+
+    private BigDecimal hisMin;
+
+    private BigDecimal hisCumulant;
+
+    private BigDecimal preMax;
+
+    private BigDecimal preMin;
+
+    private BigDecimal preLast;
+
+    private BigDecimal preCumulant;
+
+    private List<Object[]> realData;
+
+    private List<Object[]> preData;
+
+    private List<AlarmMessageRespDTO> alarmList;
+
+    private String alarmMessage;
+
+    private String lineType;
+
+    private List<Object[]> cumulantRealData;
+
+    private List<Object[]> cumulantPreData;
+}
\ No newline at end of file
diff --git a/iailab-plat-sdk/src/test/java/com/iailab/sdk/IailabClientTest.java b/iailab-plat-sdk/src/test/java/com/iailab/sdk/IailabClientTest.java
index 13fc2ca..aff430f 100644
--- a/iailab-plat-sdk/src/test/java/com/iailab/sdk/IailabClientTest.java
+++ b/iailab-plat-sdk/src/test/java/com/iailab/sdk/IailabClientTest.java
@@ -2,6 +2,7 @@
 
 import com.iailab.sdk.auth.client.IailabClient;
 import com.iailab.sdk.auth.client.common.pojo.CommonResult;
+import com.iailab.sdk.auth.client.dto.PowerRunStateDTO;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -54,4 +55,10 @@
         System.out.println(stringObjectMap);
     }
 
+    @Test
+    public void testGetPowerRunState() {
+        CommonResult<List<PowerRunStateDTO>> list = IailabClient.getInstance().getPowerRunState();
+        System.out.println(list);
+    }
+
 }

--
Gitblit v1.9.3