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

模型导入、导出逻辑优化

上级 e1bbfeca
...@@ -231,10 +231,11 @@ public class MetaModelExService extends MetaModelServiceImpl { ...@@ -231,10 +231,11 @@ public class MetaModelExService extends MetaModelServiceImpl {
String strModel = JSON.toJSONString(models); String strModel = JSON.toJSONString(models);
File modelFile = generateModelFile(strModel); File modelFile = generateModelFile(strModel);
HttpServletResponse resp = ((ServletRequestAttributes) req).getResponse(); HttpServletResponse resp = ((ServletRequestAttributes) req).getResponse();
if (resp != null) if (resp != null){
resp.setContentType("APPLICATION/OCTET-STREAM");//返回格式为流 resp.setContentType("APPLICATION/OCTET-STREAM");//返回格式为流
resp.setHeader("Content-Disposition", "attachment;filename=" + getFileName(modelFile.getName())); resp.setHeader("Content-Disposition", "attachment;filename=" + getFileName(modelFile.getName()));
sendResponse(resp, modelFile); sendResponse(resp, modelFile);
}
return true; return true;
} }
...@@ -256,17 +257,18 @@ public class MetaModelExService extends MetaModelServiceImpl { ...@@ -256,17 +257,18 @@ public class MetaModelExService extends MetaModelServiceImpl {
// 查询模型 // 查询模型
MetaModel metaModel = metaModelService.get(et.getId()); MetaModel metaModel = metaModelService.get(et.getId());
// 查询模型对应的N个规则 // 查询模型对应的N个规则
for (RuleItem ruleItem : metaModel.getRuleitems()) { if(!ObjectUtils.isEmpty(metaModel.getRuleitems())){
JSONObject fieldSet = JSONObject.parseObject(ruleItem.getFieldSet()); for (RuleItem ruleItem : metaModel.getRuleitems()) {
if (!ObjectUtils.isEmpty(fieldSet)) { JSONObject fieldSet = JSONObject.parseObject(ruleItem.getFieldSet());
for (String entityName : fieldSet.keySet()) { if (!ObjectUtils.isEmpty(fieldSet)) {
if (entityName.endsWith("entity")) { for (String entityName : fieldSet.keySet()) {
entities.add(fieldSet.getString(entityName)); if (entityName.endsWith("entity")) {
entities.add(fieldSet.getString(entityName));
}
} }
} }
} }
} }
// 查询模型对应的N个(分析)构建 // 查询模型对应的N个(分析)构建
if (!ObjectUtils.isEmpty(metaModel.getBuilds())) { if (!ObjectUtils.isEmpty(metaModel.getBuilds())) {
for (DABuild build : metaModel.getBuilds()) { for (DABuild build : metaModel.getBuilds()) {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册