From a40221c883c632630b4876ad846e08c0da8af388 Mon Sep 17 00:00:00 2001
From: Jay <csj123456>
Date: 星期三, 16 十月 2024 09:20:23 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorIhDB.java |  119 +++++++++++++++++++++++++++++++++++++++
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java  |    5 -
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/package-info.java           |    1 
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpApiService.java           |    2 
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/admin/TagController.java    |    2 
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/entity/DaMeasurePointEntity.java             |    5 +
 iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml                                          |    4 +
 iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/point/DataPointApi.java                        |    4 
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaMeasurePointDTO.java                   |    5 +
 9 files changed, 135 insertions(+), 12 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/point/DataPointApi.java b/iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/point/DataPointApi.java
index 28e6b4b..aa3a880 100644
--- a/iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/point/DataPointApi.java
+++ b/iailab-module-data/iailab-module-data-api/src/main/java/com/iailab/module/data/api/point/DataPointApi.java
@@ -37,9 +37,9 @@
     @Operation(summary = "查询多个测点历史值")
     Map<String, List<Map<String, Object>>> queryPointsHistoryValue(@RequestBody ApiPointsValueQueryDTO queryDto);
 
-    @GetMapping(PREFIX + "/query-point/history-value")
+    @PostMapping(PREFIX + "/query-point/history-value")
     @Operation(summary = "查询单个测点历史值")
-    List<ApiPointValueDTO> queryPointHistoryValue(@RequestParam ApiPointValueQueryDTO queryDto);
+    List<ApiPointValueDTO> queryPointHistoryValue(@RequestBody ApiPointValueQueryDTO queryDto);
 
     @PutMapping(PREFIX + "/write-point/real-value")
     @Operation(summary = "写入单个测点值")
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorIhDB.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorIhDB.java
new file mode 100644
index 0000000..434637e
--- /dev/null
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorIhDB.java
@@ -0,0 +1,119 @@
+package com.iailab.module.data.channel.http.collector.ihdb;
+
+import com.iailab.framework.common.constant.CommonConstant;
+import com.iailab.module.data.channel.http.entity.HttpApiEntity;
+import com.iailab.module.data.channel.http.service.HttpApiService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *
+ * iHyperDB采集
+ *
+ * {
+ *     "data": [
+ *         {
+ *             "tagname": "S10248500000002PS011",
+ *             "value": 2701557.4736842105263157894737,
+ *             "timeStamp": "2024-10-11T18:24:00"
+ *         }
+ *     ],
+ *     "resultMessage": "请求成功...",
+ *     "resultCode": 0,
+ *     "isSuccess": true
+ * }
+ *
+ * @author PanZhibao
+ * @Description
+ * @createTime 2024年10月14日
+ */
+@Slf4j
+@Component
+public class HttpCollectorIhDB {
+    private Map<String, HttpApiEntity> apiMap = new HashMap<>();
+
+    @Autowired
+    private HttpApiService httpApiService;
+
+    private final boolean STA_TRUE = true;
+
+    private final String IS_SUCCESS = "isSuccess";
+
+    private HttpApiEntity getHttpApi(String id) {
+        if (apiMap.containsKey(id)) {
+            return apiMap.get(id);
+        }
+        HttpApiEntity httpApi = httpApiService.info(id);
+        apiMap.put(id, httpApi);
+        return httpApi;
+    }
+
+    public BigDecimal getTagValue(String sourceId, String tagNo) {
+        BigDecimal value = CommonConstant.BAD_VALUE;
+        HttpApiEntity httpApi = this.getHttpApi(sourceId);
+
+        //HttpRequest.sendPost()
+
+        return value;
+    }
+
+
+    public Map<String, Object> getTagValues(List<String[]> params) {
+        if (CollectionUtils.isEmpty(params)) {
+            return new HashMap<>();
+        }
+
+        /*Map<Integer, List<String[]>> measurePointsCountGroup = new HashMap<>();
+        int pointListSize = params.size();
+        int groupCount  = pointListSize / GROUP_MAX_COUNT + ((pointListSize % GROUP_MAX_COUNT) > 0 ? 1 : 0);
+        log.info("groupCount=" + groupCount);
+        for (int i = 0; i < groupCount; i++) {
+            int end = (i + 1) * GROUP_MAX_COUNT;
+            if (end > pointListSize) {
+                end = pointListSize;
+            }
+            measurePointsCountGroup.put(i, params.subList(i * GROUP_MAX_COUNT, end));
+        }*/
+        Map<String, Object> result = new HashMap<>(params.size());
+        /*for(Map.Entry<Integer, List<String[]>> measurePointsItem : measurePointsCountGroup.entrySet()) {
+            try {
+                getByHtp(result, measurePointsItem.getValue());
+            } catch (Exception ex) {
+                ex.printStackTrace();
+            }
+        }*/
+        return result;
+    }
+
+    private void getByHtp(Map<String, Object> result, List<String[]> params) {
+        HttpApiEntity httpApi = this.getHttpApi(params.get(0)[0]);
+        Map<String, String> queryParams = new HashMap<>();
+        StringBuilder tagSb = new StringBuilder();
+        for (int i = 0; i < params.size(); i ++) {
+            tagSb.append(params.get(i)[1]);
+            if (i < params.size() - 1) {
+                tagSb.append(",");
+            }
+        }
+        /*queryParams.put("tagstr", tagSb.toString());
+        String responseStr = HttpRequest.sendGet(httpApi.getUrl(), queryParams, "utf-8", "");
+        JSONObject responseObj = JSON.parseObject(responseStr);
+        if (STA_TRUE.equals(responseObj.get("sta").toString())) {
+            JSONArray tagValueList = responseObj.getJSONArray("res");
+            if (!CollectionUtils.isEmpty(tagValueList)) {
+                for (int i = 0; i < tagValueList.size(); i++) {
+                    JSONObject item = tagValueList.getJSONObject(i);
+                    result.put(TagUtils.genTagId(DataSourceType.HTTP.getCode(), httpApi.getCode(), item.get("Tag").toString()), item.get("Value"));
+                }
+            }
+        }*/
+
+    }
+}
\ No newline at end of file
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/package-info.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/package-info.java
new file mode 100644
index 0000000..77e2f4b
--- /dev/null
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/package-info.java
@@ -0,0 +1 @@
+package com.iailab.module.data.channel.http.collector;
\ No newline at end of file
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpApiService.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpApiService.java
index 658a20a..57a7cb8 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpApiService.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/HttpApiService.java
@@ -17,8 +17,6 @@
 
     void delete(String id);
 
-    HttpApiEntity selectXstHttpTagApi();
-
     HttpApiEntity getByCode(String code);
 
     List<HttpApiEntity> list();
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java
index d92d201..d712f46 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/service/impl/HttpApiServiceImpl.java
@@ -44,11 +44,6 @@
     }
 
     @Override
-    public HttpApiEntity selectXstHttpTagApi() {
-        return httpApiDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code","xstHttpTag"));
-    }
-
-    @Override
     public HttpApiEntity getByCode(String code) {
         return httpApiDao.selectOne(new QueryWrapper<HttpApiEntity>().eq("code", code));
     }
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/admin/TagController.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/admin/TagController.java
index cad7f29..bda6560 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/admin/TagController.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/tag/controller/admin/TagController.java
@@ -157,7 +157,7 @@
                 List<TagOptionDTO> op2 = new ArrayList<>();
                 tags.forEach(item1 -> {
                     TagOptionDTO op3 = new TagOptionDTO();
-                    op3.setValue(item1.getTagName());
+                    op3.setValue(item1.getTagDesc());
                     op3.setLabel(item1.getTagName());
                     op2.add(op3);
                 });
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaMeasurePointDTO.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaMeasurePointDTO.java
index 908ba7a..c0c46be 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaMeasurePointDTO.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/dto/DaMeasurePointDTO.java
@@ -38,5 +38,8 @@
     private String tagNo;
 
     @Schema(description = "平滑尺度")
-    private String dimension;
+    private Integer dimension;
+
+    @Schema(description = "值类型")
+    private String valueType;
 }
\ No newline at end of file
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/entity/DaMeasurePointEntity.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/entity/DaMeasurePointEntity.java
index 4a15643..f778ad1 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/entity/DaMeasurePointEntity.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/point/entity/DaMeasurePointEntity.java
@@ -49,4 +49,9 @@
      * 平滑尺度
      */
     private Integer dimension;
+
+    /**
+     * 值类型
+     */
+    private String valueType;
 }
\ No newline at end of file
diff --git a/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml b/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml
index 5314c45..de6b5a0 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml
+++ b/iailab-module-data/iailab-module-data-biz/src/main/resources/mapper/point/DaPointDao.xml
@@ -25,7 +25,9 @@
       t1.update_time,
       t2.source_type,
       t3.source_name,
-      t2.tag_no
+      t2.tag_no,
+      t2.dimension,
+      t2.value_type
       from t_da_point t1
       left join t_da_measure_point t2 on t2.point_id = t1.id
       left join (

--
Gitblit v1.9.3