Commit 64ce6229 by qiuchaofei

1.添加异常处理,2.添加自动匹配接口。

parent a9a410e1
......@@ -133,7 +133,7 @@ public class RelationalGraphController {
@RequestMapping(path = "/autoMatchByInputWord", method = RequestMethod.GET)
public List<ReturnNode> autoMatchByInputWord(String name,String count,String offset) {
if(count == null || count .equals("")){
count = "1000";
count = "100";
}
int offsetInt = Integer.valueOf(offset);
int countInt = Integer.valueOf(count);
......
......@@ -158,10 +158,9 @@ public class TableServiceImpl implements ITableService {
Neo4jConfig neo4jConfig = new Neo4jConfig();
Driver neo4jConnection = neo4jConfig.getNeo4jConnection();
Session session = neo4jConnection.session();
// match(n) where (n:Neo4jTable or n:Neo4jSchema ) and (n.name =~'.*部门1.*' or n.cnName =~'.*部门1.*') return n
//match (n:MetaData) where n.name=~'(?i).*APP.*' return n
String cypher ="match (n) where n.name=~'(?i).*"+name+".*' or n.name=~'(?i).*"+name+".*' return n skip "+offsetInt+" limit "+countInt;
//"match (n:MetaData ) where n.name =~\"" + name + ".*\" return n";
String cypher ="match (n) where ( n:Neo4jTable or n:Neo4jSchema ) and (n.name=~'(?i).*"+name+".*' or n.name=~'(?i).*"+name+".*') return n skip "+offsetInt+" limit "+countInt;
long starttime = System.currentTimeMillis();
StatementResult result = session.run(cypher);
......@@ -170,7 +169,6 @@ public class TableServiceImpl implements ITableService {
Record record = result.next();
List<Value> values = record.values();
for (Value value : values) {
System.out.println("type:"+value.type().name());
if(value.type().name().equals("NODE")){
Node node = value.asNode();
......@@ -225,9 +223,13 @@ public class TableServiceImpl implements ITableService {
private Map<String,String> getAttributeMap(String tableId){
Map<String,String> returnMap = new HashMap<>();
Map<String, Object> attriuteMap = null;
try{
attriuteMap = metadataRepoRemoteService.getMetadata(tableId);
}catch (Exception e){
logger.info("元数据服务异常:"+e.getMessage());
}
Map<String, Object> attriuteMap = metadataRepoRemoteService.getMetadata(tableId);
if (attriuteMap == null) {
logger.info("没有找到id:" + tableId + "的元数据。");
......@@ -237,6 +239,7 @@ public class TableServiceImpl implements ITableService {
returnMap.put("别名", neo4jTable.getCnName());
returnMap.put("中文名","");
returnMap.put("最后更新时间","");
returnMap.put("所属系统",neo4jTable.getDataPath());
return returnMap;
}
// 英文名称,中文名称,说明,表规模(行),表大小(字节),更新时间,
......@@ -271,7 +274,15 @@ public class TableServiceImpl implements ITableService {
//所属分层,从schema获取
String parentId = (String) attriuteMap.get("parentId");
Map<String, Object> schemaAttributeMap = metadataRepoRemoteService.getMetadata(parentId);
Map<String, Object> schemaAttributeMap = null;
try{
schemaAttributeMap = metadataRepoRemoteService.getMetadata(parentId);
}catch (Exception e){
logger.info("元数据服务异常:"+e.getMessage());
}
String label = (String)schemaAttributeMap.get("label");
if(label== null ){
List<String> layer = new ArrayList<>();
......
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