Commit 81920ba8 by qiuchaofei

同步 视图,存储过程等对象

parent e5fc656c
...@@ -90,6 +90,8 @@ public class AsyncDataFromMongoToNeo4j { ...@@ -90,6 +90,8 @@ public class AsyncDataFromMongoToNeo4j {
// // 同步其他数据(模型,标准,质量等) // // 同步其他数据(模型,标准,质量等)
// //
// //同步作业内部的临时数据 // //同步作业内部的临时数据
logger.info("开始处理临时节点。。。");
metadataService.deleteTempNodeByCatalogName(catalogName); metadataService.deleteTempNodeByCatalogName(catalogName);
metadataService.createTempNode(catalogName); metadataService.createTempNode(catalogName);
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
......
...@@ -23,4 +23,9 @@ public interface ISchemaService { ...@@ -23,4 +23,9 @@ public interface ISchemaService {
Map<String,String> getColumnIdFromSchemaId(String schemaId); Map<String,String> getColumnIdFromSchemaId(String schemaId);
Map<String, String> getViewIdFromSchemaId(String schemaId);
Map<String, String> getFunctionIdFromSchemaId(String schemaId);
Map<String, String> getProcedureIdFromSchemaId(String schemaId);
} }
...@@ -351,6 +351,87 @@ public class SchemaServiceImpl implements ISchemaService { ...@@ -351,6 +351,87 @@ public class SchemaServiceImpl implements ISchemaService {
return columnIdMap; return columnIdMap;
} }
@Override
public Map<String, String> getViewIdFromSchemaId(String schemaId) {
Map<String,String> viewIdMap = new HashMap<>();
//批量获取指定schema下面的view
String countCypher = "match (n:Neo4jSchema{metadataId:\""+schemaId+"\"})-->(m:Neo4jView) return count(m) as count";
String detailCypher = "match (n:Neo4jSchema{metadataId:\""+schemaId+"\"})-->(m:Neo4jTable) return m skip 10 limit 10";
StatementResult countResult = session.run(countCypher);
int jdcount= 0 ;
while(countResult.hasNext()){
Record record = countResult.next();
jdcount= record.get( "count").asInt();
}
//分页获取 view
int pageSize = 100;
int page = jdcount/pageSize;
for(int i=0;i<page+1;i++){
detailCypher = "match (n:Neo4jSchema{metadataId:\""+schemaId+"\"})-->(m:Neo4jView) return m.metadataId as id skip "+(i*pageSize ) +" limit "+ pageSize;
StatementResult detailResult = session.run(detailCypher);
while (detailResult.hasNext()){
Record record = detailResult.next();
String metadataId = record.get( "id").asString();
viewIdMap.put(metadataId,"");
}
}
return viewIdMap;
}
@Override
public Map<String, String> getFunctionIdFromSchemaId(String schemaId) {
Map<String,String> functionIdMap = new HashMap<>();
//批量获取指定schema下面的view
String countCypher = "match (n:Neo4jSchema{metadataId:\""+schemaId+"\"})-->(m:Neo4jFunction) return count(m) as count";
String detailCypher = "match (n:Neo4jSchema{metadataId:\""+schemaId+"\"})-->(m:Neo4jTable) return m skip 10 limit 10";
StatementResult countResult = session.run(countCypher);
int jdcount= 0 ;
while(countResult.hasNext()){
Record record = countResult.next();
jdcount= record.get( "count").asInt();
}
//分页获取 view
int pageSize = 100;
int page = jdcount/pageSize;
for(int i=0;i<page+1;i++){
detailCypher = "match (n:Neo4jSchema{metadataId:\""+schemaId+"\"})-->(m:Neo4jFunction) return m.metadataId as id skip "+(i*pageSize ) +" limit "+ pageSize;
StatementResult detailResult = session.run(detailCypher);
while (detailResult.hasNext()){
Record record = detailResult.next();
String metadataId = record.get( "id").asString();
functionIdMap.put(metadataId,"");
}
}
return functionIdMap;
}
@Override
public Map<String, String> getProcedureIdFromSchemaId(String schemaId) {
Map<String,String> functionIdMap = new HashMap<>();
//批量获取指定schema下面的view
String countCypher = "match (n:Neo4jSchema{metadataId:\""+schemaId+"\"})-->(m:Neo4jProcedure) return count(m) as count";
String detailCypher = "match (n:Neo4jSchema{metadataId:\""+schemaId+"\"})-->(m:Neo4jTable) return m skip 10 limit 10";
StatementResult countResult = session.run(countCypher);
int jdcount= 0 ;
while(countResult.hasNext()){
Record record = countResult.next();
jdcount= record.get( "count").asInt();
}
//分页获取 view
int pageSize = 100;
int page = jdcount/pageSize;
for(int i=0;i<page+1;i++){
detailCypher = "match (n:Neo4jSchema{metadataId:\""+schemaId+"\"})-->(m:Neo4jProcedure) return m.metadataId as id skip "+(i*pageSize ) +" limit "+ pageSize;
StatementResult detailResult = session.run(detailCypher);
while (detailResult.hasNext()){
Record record = detailResult.next();
String metadataId = record.get( "id").asString();
functionIdMap.put(metadataId,"");
}
}
return functionIdMap;
}
private void saveLabelFromTag(List<String> layer, Map<String, Neo4jSchema> neo4jSchemaMap, Map<String, List<Map<String, Object>>> returnResults) { private void saveLabelFromTag(List<String> layer, Map<String, Neo4jSchema> neo4jSchemaMap, Map<String, List<Map<String, Object>>> returnResults) {
for (Object obj : returnResults.keySet()) { for (Object obj : returnResults.keySet()) {
String schemaId = (String) obj; String schemaId = (String) obj;
......
...@@ -921,37 +921,37 @@ public class TableServiceImpl implements ITableService { ...@@ -921,37 +921,37 @@ public class TableServiceImpl implements ITableService {
getTargetTable(tableId ,targetTables); getTargetTable(tableId ,targetTables);
//质量报告 //质量报告
List<ReturnNode> qualityList = new ArrayList<>(); // List<ReturnNode> qualityList = new ArrayList<>();
try{ // try{
//从表获取字段: // //从表获取字段:
List<Neo4jColumn> neo4jColumnList = neo4jTableRepository.getColumnByTableId(tableId); // List<Neo4jColumn> neo4jColumnList = neo4jTableRepository.getColumnByTableId(tableId);
List<String> reportIdList = new ArrayList<>(); // List<String> reportIdList = new ArrayList<>();
//
for(Neo4jColumn neo4jColumn :neo4jColumnList ){ // for(Neo4jColumn neo4jColumn :neo4jColumnList ){
// // //
String metaId =neo4jColumn.getMetadataId(); // String metaId =neo4jColumn.getMetadataId();
// metaId = "Column=1=55d151b1ba484d0cbe3ccd7e9e2f0bfe"; //// metaId = "Column=1=55d151b1ba484d0cbe3ccd7e9e2f0bfe";
Map<String, String> dataQualityRepost = dataQualityReportRemoteService.getDataAssetGraphInfoByMetadataId(metaId); // Map<String, String> dataQualityRepost = dataQualityReportRemoteService.getDataAssetGraphInfoByMetadataId(metaId);
if(dataQualityRepost ==null || dataQualityRepost.size()==0){ // if(dataQualityRepost ==null || dataQualityRepost.size()==0){
continue; // continue;
} // }
String reportId = dataQualityRepost.get("id"); // String reportId = dataQualityRepost.get("id");
if(reportIdList.contains(reportId)){ // if(reportIdList.contains(reportId)){
continue; // continue;
} // }
reportIdList.add(reportId); // reportIdList.add(reportId);
ReturnNode returnNode = new ReturnNode(); // ReturnNode returnNode = new ReturnNode();
returnNode.setId(reportId); // returnNode.setId(reportId);
returnNode.setName(dataQualityRepost.get(JobAnalyzer)); // returnNode.setName(dataQualityRepost.get(JobAnalyzer));
returnNode.setCnName(dataQualityRepost.get(JobAnalyzer)); // returnNode.setCnName(dataQualityRepost.get(JobAnalyzer));
returnNode.setAttributeMaps(dataQualityRepost); // returnNode.setAttributeMaps(dataQualityRepost);
qualityList.add(returnNode); //// qualityList.add(returnNode);
} // }
}catch (Exception e){ // }catch (Exception e){
e.printStackTrace(); // e.printStackTrace();
} // }
sourceAndTargetTable.put("质量",qualityList); // sourceAndTargetTable.put("质量",qualityList);
sourceAndTargetTable.put("来源",sourceTables); sourceAndTargetTable.put("来源",sourceTables);
sourceAndTargetTable.put("目标",targetTables); sourceAndTargetTable.put("目标",targetTables);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment