Merge branch 'master' into docker_package
This commit is contained in:
commit
afabcc911b
|
@ -168,31 +168,45 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
|||
AtomicInteger pageIndex = new AtomicInteger(1);
|
||||
AtomicBoolean end = new AtomicBoolean(true);
|
||||
List<CompletableFuture> completableFutures=new CopyOnWriteArrayList<>();
|
||||
while(end.get()){
|
||||
do {
|
||||
completableFutures.add(CompletableFuture.supplyAsync(()->{
|
||||
Optional<AbstractDataResourceService> factory = DataResourceFactory.build();
|
||||
if (factory.isPresent()) {
|
||||
GetDataResourceListDto dto=new GetDataResourceListDto().setPageNum(pageIndex.get()).setPageSize(pageSize);
|
||||
Map<String, Object> dataResource = (Map<String, Object>) factory.get().getDataResource(dto);
|
||||
if(!dataResource.isEmpty()){
|
||||
List<Map<String, Object>> list = (List<Map<String, Object>>) dataResource.get("data");
|
||||
pageIndex.getAndIncrement();
|
||||
return new HashMap(){{put( list.stream().map(map->{
|
||||
if (map.containsKey("zyname")) {
|
||||
return map.get("guid");
|
||||
} else {
|
||||
return map.get("serviceId");
|
||||
}
|
||||
}), list);}};
|
||||
try {
|
||||
GetDataResourceListDto dto=new GetDataResourceListDto().setPageNum(pageIndex.get()).setPageSize(pageSize);
|
||||
Map<String, Object> dataResource = (Map<String, Object>) factory.get().getDataResource(dto);
|
||||
if(!dataResource.isEmpty()){
|
||||
List<Map<String, Object>> list = (List<Map<String, Object>>) dataResource.get("data");
|
||||
pageIndex.getAndIncrement();
|
||||
return new HashMap(){{put( list.stream().map(map->{
|
||||
if (map.containsKey("zyname")) {
|
||||
return map.get("guid");
|
||||
} else {
|
||||
return map.get("serviceId");
|
||||
}
|
||||
}), list);}};
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.info("获取数据资源异常:", e);
|
||||
end.set(false);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return new HashMap<>();
|
||||
}).thenAcceptAsync(map->{
|
||||
if(map != null){
|
||||
if(!map.isEmpty()){
|
||||
result.putAll(map);
|
||||
}else{
|
||||
end.set(false);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(300); // 防止任务运行过快,无法跳出循环
|
||||
} catch (InterruptedException e) {
|
||||
logger.info("获取数据资源异常", e);
|
||||
}
|
||||
|
||||
} while(end.get());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -204,7 +218,7 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
|||
List<TbFuseResourceEntity> list = fuseResourceDao.selectList(wrapper);
|
||||
Map<String, List<TbFuseResourceEntity>> resourceMap = list.stream().filter(index -> index.getType() != null).collect(Collectors.groupingBy(TbFuseResourceEntity::getType));
|
||||
if (resourceMap.containsKey("数据资源")) {
|
||||
//dataResourceMap.putAll(getDataResource());
|
||||
dataResourceMap.putAll(getDataResource());
|
||||
}
|
||||
resourceMap.forEach((type, value) -> {
|
||||
if ("组件服务".equals(type)) {
|
||||
|
|
Loading…
Reference in New Issue