From 1673913c59fbe4458629ffa4093acc007ae9e749 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期五, 28 二月 2025 17:12:42 +0800
Subject: [PATCH] 修改超时时间为40s

---
 iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorForIhd.java |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorForIhd.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorForIhd.java
index df09772..d8e42b4 100644
--- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorForIhd.java
+++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/channel/http/collector/ihdb/HttpCollectorForIhd.java
@@ -5,6 +5,7 @@
 import com.alibaba.fastjson.JSONObject;
 import com.google.gson.Gson;
 import com.iailab.framework.common.constant.CommonConstant;
+import com.iailab.framework.common.util.http.HttpUtils;
 import com.iailab.module.data.channel.http.entity.HttpApiEntity;
 import com.iailab.module.data.channel.http.service.HttpApiService;
 import com.iailab.module.data.common.enums.DataSourceType;
@@ -55,7 +56,7 @@
 
     private static final int GROUP_MAX_COUNT = 300;
 
-    private static final int MAX_WAIT = 30;
+    private static final int MAX_WAIT = 40;
 
     private static final String pattern = "yyyyMMddHHmm00";
 
@@ -86,6 +87,11 @@
      */
     private static final String T = "t";
 
+    /**
+     * 数据质量G:good,B:bad
+     */
+    private static final String Q = "q";
+
     private HttpApiEntity getHttpApi(String id) {
         if (apiMap.containsKey(id)) {
             return apiMap.get(id);
@@ -108,7 +114,7 @@
         tagSb.append(jsonString);
         tagSb.append("]");
         String currentDate = DateUtils.format(new Date(), pattern);
-        String responseStr = HttpRequest.sendPost(httpApi.getUrl() + "/" + currentDate, tagSb.toString());
+        String responseStr = HttpUtils.sendPost(httpApi.getUrl() + "/" + currentDate, tagSb.toString());
         JSONObject responseObj = JSON.parseObject(responseStr);
         if (STA_TRUE.equals(responseObj.get(IS_SUCCESS).toString())) {
             JSONArray tagValueList = responseObj.getJSONArray("data");
@@ -150,7 +156,7 @@
             log.info("body=====" + tagSb);
             String currentDate = DateUtils.format(new Date(), pattern);
             String responseStr = "";
-            responseStr = HttpRequest.sendPost(httpApi.getUrl().replace("getPointdatasAvg", "getPointslast") + "/" + currentDate, tagSb);
+            responseStr = HttpUtils.sendPost(httpApi.getUrl().replace("getPointdatasAvg", "getPointslast") + "/" + currentDate, tagSb);
             JSONObject responseObj = JSON.parseObject(responseStr);
             if (STA_TRUE.equals(responseObj.get(IS_SUCCESS).toString())) {
                 JSONArray tagValueList = responseObj.getJSONArray("data");
@@ -204,7 +210,7 @@
             for (Map.Entry<Integer, List<Object[]>> measurePointsItem : measurePointsCountGroup.entrySet()) {
                 HttpApiEntity httpApi = this.getHttpApi(measurePointsItem.getValue().get(0)[0].toString());
                 // 并发
-                Thread.sleep(1000);
+                Thread.sleep(500);
                 threadPool.submit(new Task(httpApi.getUrl(), httpApi.getCode(), result, measurePointsItem.getValue(),
                         collectTime, countDownLatch));
                 // 顺序
@@ -279,7 +285,7 @@
             tagSb.append("]");
             log.info("body=====" + tagSb);
             String currentDate = DateUtils.format(collectTime, pattern);
-            String responseStr = HttpRequest.sendPost(url + "/" + currentDate, tagSb.toString());
+            String responseStr = HttpUtils.sendPost(url + "/" + currentDate, tagSb.toString());
             JSONObject responseObj = JSON.parseObject(responseStr);
             log.info("responseObj=====" + responseObj.toJSONString());
             if (STA_TRUE.equals(responseObj.get(IS_SUCCESS).toString())) {
@@ -287,7 +293,9 @@
                 if (!CollectionUtils.isEmpty(tagValueList)) {
                     for (int i = 0; i < tagValueList.size(); i++) {
                         JSONObject item = tagValueList.getJSONObject(i);
-                        result.put(TagUtils.genTagId(DataSourceType.HTTP.getCode(), sourceName, item.get(N).toString()), item.get(V));
+                        if (item.get(Q).toString().equals("G")) {
+                            result.put(TagUtils.genTagId(DataSourceType.HTTP.getCode(), sourceName, item.get(N).toString()), item.get(V));
+                        }
                     }
                 }
             }
@@ -311,7 +319,7 @@
         tagSb.append("]");
         log.info("body=====" + tagSb);
         String currentDate = DateUtils.format(collectTime, pattern);
-        String responseStr = HttpRequest.sendPost(url + "/" + currentDate, tagSb.toString());
+        String responseStr = HttpUtils.sendPost(url + "/" + currentDate, tagSb.toString());
         JSONObject responseObj = JSON.parseObject(responseStr);
         log.info("responseObj=====" + responseObj.toJSONString());
         if (STA_TRUE.equals(responseObj.get(IS_SUCCESS).toString())) {

--
Gitblit v1.9.3