forked from github/dataease
Merge pull request #3633 from dataease/pr@dev@refactor_template-market-sort
refactor(模板市场): 增加模板市场分类排序
This commit is contained in:
commit
c937bbd9ed
@ -15,9 +15,9 @@ public class HttpClientConfig {
|
||||
private Map<String, String> 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;
|
||||
|
||||
|
@ -14,4 +14,6 @@ public class TemplateCategory {
|
||||
private String name;
|
||||
|
||||
private String slug;
|
||||
|
||||
private Integer priority;
|
||||
}
|
||||
|
@ -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<TemplateCategory> 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user