From df0b4b2a6e34766de8231c392597fac4e68f85e2 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Thu, 3 Nov 2022 16:50:22 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=A8=A1=E6=9D=BF=E5=B8=82=E5=9C=BA):?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=E6=A8=A1=E6=9D=BF=E5=B8=82=E5=9C=BA?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/dataease/commons/utils/HttpClientConfig.java | 4 ++-- .../java/io/dataease/dto/templateMarket/TemplateCategory.java | 2 ++ .../service/templateMarket/TemplateMarketService.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/dataease/commons/utils/HttpClientConfig.java b/backend/src/main/java/io/dataease/commons/utils/HttpClientConfig.java index 819ac172ce..8786d3fcb0 100755 --- a/backend/src/main/java/io/dataease/commons/utils/HttpClientConfig.java +++ b/backend/src/main/java/io/dataease/commons/utils/HttpClientConfig.java @@ -15,9 +15,9 @@ public class HttpClientConfig { private Map header = new HashMap<>(); // 设置连接超时时间,单位毫秒 - private int connectTimeout = 5000; + private int connectTimeout = 30000; // 设置从connect Manager获取Connection 超时时间,单位毫秒。这个属性是新加的属性,因为目前版本是可以共享连接池的 - private int connectionRequestTimeout = 5000; + private int connectionRequestTimeout = 30000; // 请求获取数据的超时时间,单位毫秒。 如果访问一个接口,多少时间内无法返回数据,就直接放弃此次调用 private int socketTimeout = 60000; diff --git a/backend/src/main/java/io/dataease/dto/templateMarket/TemplateCategory.java b/backend/src/main/java/io/dataease/dto/templateMarket/TemplateCategory.java index dd78b81ec4..29dee68bf8 100644 --- a/backend/src/main/java/io/dataease/dto/templateMarket/TemplateCategory.java +++ b/backend/src/main/java/io/dataease/dto/templateMarket/TemplateCategory.java @@ -14,4 +14,6 @@ public class TemplateCategory { private String name; private String slug; + + private Integer priority; } diff --git a/backend/src/main/java/io/dataease/service/templateMarket/TemplateMarketService.java b/backend/src/main/java/io/dataease/service/templateMarket/TemplateMarketService.java index 427d111358..658c23aa91 100644 --- a/backend/src/main/java/io/dataease/service/templateMarket/TemplateMarketService.java +++ b/backend/src/main/java/io/dataease/service/templateMarket/TemplateMarketService.java @@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; @@ -76,7 +77,7 @@ public class TemplateMarketService { String resultStr = marketGet(basicInfo.getTemplateMarketUlr()+CATEGORIES_API,basicInfo.getTemplateAccessKey()); List categories = JSONObject.parseObject(resultStr).getJSONArray("data").toJavaList(TemplateCategory.class); if(CollectionUtils.isNotEmpty(categories)){ - return categories.stream().map(TemplateCategory :: getName).collect(Collectors.toList()); + return categories.stream().sorted(Comparator.comparing(TemplateCategory::getPriority)).map(TemplateCategory :: getName).collect(Collectors.toList()); }else{ return null; }