Commit 5e21c932 by qiuchaofei

重新设置关系的id

parent 2e5f32ae
......@@ -561,6 +561,9 @@ public class MetadataServiceImpl implements IMetadataService {
StatementResult statementResult = session.run(cypher);
Map<Long, ReturnNode> nodesMap = new HashMap<>();
Map<String, MetaModel> metaModelMap = new HashMap<>();
Map<String ,ReturnEdge> returnEdgeMap = new HashMap<>();
int size = 300;
while (statementResult.hasNext()) {
Record record = statementResult.next();
......@@ -572,7 +575,7 @@ public class MetadataServiceImpl implements IMetadataService {
getNodesMapFromNeo4jSystem(nodesMap, metaModelMap, nodes);
Iterable<Relationship> relationships = p.relationships();
getRelationFromneo4jRelationSystem(returnReslult, nodesMap, relationships);
getRelationFromneo4jRelationSystem(returnEdgeMap, nodesMap, relationships);
}
}
}
......@@ -580,13 +583,17 @@ public class MetadataServiceImpl implements IMetadataService {
ReturnNode node = nodesMap.get(object);
returnReslult.getNodes().add(node);
}
for(Object object:returnEdgeMap.keySet()){
ReturnEdge returnEdge = returnEdgeMap.get(object);
returnReslult.getEdges().add(returnEdge);
}
returnReslult.setMetaModelMap(metaModelMap);
return returnReslult;
}
private void getRelationFromneo4jRelationSystem(ReturnReslult returnReslult, Map<Long, ReturnNode> nodesMap,
private void getRelationFromneo4jRelationSystem(Map<String ,ReturnEdge> returnEdgeMap, Map<Long, ReturnNode> nodesMap,
Iterable<Relationship> relationships) {
for (Relationship relationship : relationships) {
......@@ -604,26 +611,26 @@ public class MetadataServiceImpl implements IMetadataService {
String yewushuoming =""+ relationship.asMap().get("业务说明");
String startMetaId = "";
String endMEtaId = "";
String endMetaId = "";
if (nodesMap.containsKey(startID)) {
startMetaId = nodesMap.get(startID).getId();
}
if (nodesMap.containsKey(endID)) {
endMEtaId = nodesMap.get(endID).getId();
endMetaId = nodesMap.get(endID).getId();
}
if(!StringUtils.isBlank(startMetaId) && !StringUtils.isBlank(endMEtaId)){
if(!StringUtils.isBlank(startMetaId) && !StringUtils.isBlank(endMetaId)){
ReturnEdge edge = new ReturnEdge();
edge.setEdgeId(String.valueOf(relationship.id()));
String edgeId = ""+relationship.id();
edge.setEdgeId(edgeId);
edge.setFromId(startMetaId);
edge.setToId(endMEtaId);
edge.setToId(endMetaId);
edge.setType(rType);
edge.getAttributeMaps().put("协议",xieyi);
edge.getAttributeMaps().put("业务说明",yewushuoming);
edge.getAttributeMaps().put("业务类别",yewuleibie);
edge.getAttributeMaps().put("数据结构",shujujiegou);
edge.getAttributeMaps().put("业务说明",yewushuoming);
returnReslult.getEdges().add(edge);
returnEdgeMap .put(edgeId,edge );
}
}
......
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