Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
neo4jRelation
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qiuchaofei
neo4jRelation
Commits
7dce7e21
Commit
7dce7e21
authored
Oct 25, 2021
by
qiuchaofei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1修改图标的交互方式。2修改注解的tag与value
parent
8eb921b5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
12 deletions
+37
-12
MetaDataController.java
...adata/metadataRelation/controller/MetaDataController.java
+21
-11
ReturnReslult.java
...adata/metadataRelation/pojo/returnBean/ReturnReslult.java
+16
-1
No files found.
src/main/java/com/keymobile/metadata/metadataRelation/controller/MetaDataController.java
View file @
7dce7e21
...
...
@@ -30,7 +30,7 @@ import java.util.UUID;
@RequestMapping
(
value
=
"api/metadata"
)
@RestController
@Api
(
value
=
"
metadata"
,
tags
=
"把metadata写入neo4j数据库
"
)
@Api
(
value
=
"
把metadata写入neo4j数据库"
,
tags
=
"metadata to neo4j
"
)
public
class
MetaDataController
{
...
...
@@ -43,22 +43,31 @@ public class MetaDataController {
private
IBaseRelationshipService
baseRelationshipService
;
/**
* 查询元数据,关系
* 返回 node,edge,icon
*/
@ApiOperation
(
"获取所有的节点与关系"
)
@ApiOperation
(
tags
=
""
,
value
=
"获取所有的节点与关系"
)
@RequestMapping
(
path
=
"/result"
,
method
=
RequestMethod
.
GET
)
public
ReturnReslult
getAllNodeAndRelation
()
{
logger
.
info
(
"开始获取所有的节点与关系"
);
ReturnReslult
result
=
new
ReturnReslult
();
List
<
MetaData
>
metaDataList
=
metadataService
.
finAllMetaData
();
Map
<
Long
,
Node
>
nodeMap
=
new
HashMap
<>();
Map
<
String
,
String
>
iconMap
=
new
HashMap
<>();
for
(
MetaData
metaData:
metaDataList
){
Node
node
=
new
Node
();
String
[]
strings
=
metaData
.
getMetadataId
().
split
(
"="
);
String
modelName
=
strings
[
0
];
node
.
setId
(
metaData
.
getMetadataId
());
node
.
setIcon
(
getIconByModelId
(
modelName
));
node
.
setIcon
(
modelName
);
if
(!
iconMap
.
containsKey
(
modelName
)){
String
iconContext
=
getIconByModelId
(
modelName
);
iconMap
.
put
(
modelName
,
iconContext
);
}
node
.
setName
(
metaData
.
getName
());
node
.
setType
(
"MetaData"
);
result
.
getNodes
().
add
(
node
);
...
...
@@ -89,6 +98,7 @@ public class MetaDataController {
}
logger
.
info
(
"关系的数量:"
+
result
.
getEdges
().
size
());
result
.
setIconMap
(
iconMap
);
return
result
;
}
...
...
@@ -108,10 +118,10 @@ public class MetaDataController {
* 修改图片的接口,传入元模型id,新图标
*/
@ApiOperation
(
"修改元模型图标的接口"
)
@ApiOperation
(
tags
=
""
,
value
=
"修改元模型图标的接口"
)
@PostMapping
(
value
=
"/modifyIcon"
,
consumes
=
"multipart/*"
,
headers
=
"content-type=multipart/form-date"
)
public
String
modifyIcon
(
String
modelId
,
@ApiParam
(
value
=
"上传的文件"
,
required
=
true
)
MultipartFile
file
)
{
MultipartFile
file
)
{
if
(
file
.
isEmpty
())
{
logger
.
info
(
"文件为空空"
);
}
...
...
@@ -126,7 +136,7 @@ public class MetaDataController {
// fileName = "Icon_"+modelId + suffixName; // 新文件名
File
dest
=
new
File
(
dirPath
+
fileName
);
if
(!
dest
.
getParentFile
().
exists
())
{
//如果文件夹不存在,就创建,
dest
.
getParentFile
().
mkdirs
();
dest
.
getParentFile
().
mkdirs
();
}
else
{
//如果文件夹存在,就先清空里面的文件
File
[]
files
=
dest
.
getParentFile
().
listFiles
();
...
...
@@ -154,7 +164,7 @@ public class MetaDataController {
/**
* 获取元模型的图标,
*/
@ApiOperation
(
"获取元模型的图标"
)
@ApiOperation
(
tags
=
""
,
value
=
"获取元模型的图标"
)
@RequestMapping
(
value
=
"/getIconByModelId"
,
method
=
RequestMethod
.
GET
)
public
String
getIconByModelId
(
String
modelId
)
{
ApplicationHome
applicationHome
=
new
ApplicationHome
(
getClass
());
...
...
@@ -196,7 +206,7 @@ public class MetaDataController {
/**
* 查询所有的关系类型
*/
@ApiOperation
(
"查询所有的关系类型"
)
@ApiOperation
(
tags
=
""
,
value
=
"查询所有的关系类型"
)
@RequestMapping
(
path
=
"/listAllRelationType"
,
method
=
RequestMethod
.
GET
)
public
List
<
String
>
getAllRelationType
()
{
...
...
@@ -206,7 +216,7 @@ public class MetaDataController {
/**
* 查询所有的节点类型
*/
@ApiOperation
(
"查询所有的节点类型"
)
@ApiOperation
(
tags
=
""
,
value
=
"查询所有的节点类型"
)
@RequestMapping
(
path
=
"/listAllNodeType"
,
method
=
RequestMethod
.
GET
)
public
List
<
String
>
getAllNodeType
()
{
...
...
@@ -215,7 +225,7 @@ public class MetaDataController {
/**
* 传入元数据id,显示的层数,查找出与该元数据有关系的数据
*/
@ApiOperation
(
"传入元数据id,显示的层数,查找出与该元数据有关系的数据"
)
@ApiOperation
(
tags
=
""
,
value
=
"传入元数据id,显示的层数,查找出与该元数据有关系的数据"
)
@RequestMapping
(
path
=
"/getNodeByDataId"
,
method
=
RequestMethod
.
GET
)
public
ReturnReslult
getNodeByDataId
(
String
metadataId
,
int
depth
)
{
...
...
@@ -248,7 +258,7 @@ public class MetaDataController {
* 同步元数据关系的接口,传入一个环境名称(catalognName),从mongo读取关系,存入到neo4j中
* @return
*/
@ApiOperation
(
"同步元数据关系的接口"
)
@ApiOperation
(
tags
=
""
,
value
=
"同步元数据关系的接口"
)
@RequestMapping
(
path
=
"/syschroRelationFromMongo"
,
method
=
RequestMethod
.
GET
)
public
String
syschroRelationFromMongo
(
String
catalogName
){
logger
.
info
(
"开始同步元数据:从mongo到neo4j"
);
...
...
src/main/java/com/keymobile/metadata/metadataRelation/pojo/returnBean/ReturnReslult.java
View file @
7dce7e21
package
com
.
keymobile
.
metadata
.
metadataRelation
.
pojo
.
returnBean
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
ReturnReslult
{
private
List
<
Edge
>
edges
=
new
ArrayList
<>();
private
List
<
Node
>
nodes
=
new
ArrayList
<>();
private
Map
<
String
,
String
>
iconMap
=
new
HashMap
<>();
public
Map
<
String
,
String
>
getIconMap
()
{
return
iconMap
;
}
public
void
setIconMap
(
Map
<
String
,
String
>
iconMap
)
{
this
.
iconMap
=
iconMap
;
}
public
List
<
Edge
>
getEdges
()
{
return
edges
;
}
...
...
@@ -23,6 +39,5 @@ public class ReturnReslult {
this
.
nodes
=
nodes
;
}
private
List
<
Node
>
nodes
=
new
ArrayList
<>();
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment