提交 b3008143 编写于 作者: zhouweidong's avatar zhouweidong

模型导入、导出逻辑优化

上级 b7e607be
......@@ -250,9 +250,9 @@ public class MetaModelExService extends MetaModelServiceImpl {
String modelId = et.getId();
AssembleModel models = new AssembleModel();
List<DAMetric> metrics = new ArrayList<>();
LinkedHashSet masterDsName = new LinkedHashSet();
Map<String, DstSystem> systemMap = new HashMap();
LinkedHashSet<String> entities = new LinkedHashSet<>();
List<DstDataSource> dataSources = new ArrayList<>();
// 查询模型
MetaModel metaModel = metaModelService.get(et.getId());
// 查询模型对应的N个规则
......@@ -296,26 +296,27 @@ public class MetaModelExService extends MetaModelServiceImpl {
}
// 用到的数据源和系统
List<EntityModel> entityModels = getEntityModel(modelId);
LinkedHashSet masterDsName = new LinkedHashSet();
for (EntityModel entityModel : entityModels) {
masterDsName.add(entityModel.getDsName());
masterDsName.add(entityModel.getDsName());
if (!ObjectUtils.isEmpty(entityModel.getEntity())) {
systemMap.put(entityModel.getEntity().getSystem().getPssystemid(), entityModel.getEntity().getSystem());
}
}
// 查询数据源
DstDataSourceSearchContext searchContext = new DstDataSourceSearchContext();
searchContext.setN_dsid_in(Joiner.on(";").join(masterDsName));
searchContext.setSize(entityModels.size());
Page<DstDataSource> dstDataSources = dstDataSourceService.searchDefault(searchContext);
if(masterDsName.size()>0){
DstDataSourceSearchContext searchContext = new DstDataSourceSearchContext();
searchContext.setN_dsid_in(Joiner.on(";").join(masterDsName));
searchContext.setSize(entityModels.size());
Page<DstDataSource> dstDataSources = dstDataSourceService.searchDefault(searchContext);
dataSources.addAll(dstDataSources.getContent());
}
models.setMetrics(metrics);
models.setMetaModel(metaModel);
models.setEntityModels(entityModels);
models.setDaBuilds(metaModel.getBuilds());
models.setRuleItems(metaModel.getRuleitems());
models.setDataSources(dstDataSources.getContent());
models.setDataSources(dataSources);
models.setSystems(new ArrayList<>(systemMap.values()));
return models;
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册