Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
Project
Project
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
station
YeeAmosFireAutoSysRoot
Commits
89341cd3
Commit
89341cd3
authored
Mar 13, 2020
by
单奇雲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改TOPO图 查询保存删除接口
parent
ff9d0ebf
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
122 additions
and
41 deletions
+122
-41
TopographyLine.java
.../java/com/yeejoin/amos/fas/dao/entity/TopographyLine.java
+18
-0
TopographyNode.java
.../java/com/yeejoin/amos/fas/dao/entity/TopographyNode.java
+9
-0
TopographyController.java
...in/amos/fas/business/controller/TopographyController.java
+24
-13
ITopographyLineDao.java
.../amos/fas/business/dao/repository/ITopographyLineDao.java
+1
-1
ITopographyNodeDao.java
.../amos/fas/business/dao/repository/ITopographyNodeDao.java
+6
-4
ITopographyLineServiceImpl.java
...fas/business/service/impl/ITopographyLineServiceImpl.java
+2
-2
ITopographyNodeServiceImpl.java
...fas/business/service/impl/ITopographyNodeServiceImpl.java
+18
-15
ITopographyLineService.java
...os/fas/business/service/intfc/ITopographyLineService.java
+1
-1
ITopographyNodeService.java
...os/fas/business/service/intfc/ITopographyNodeService.java
+6
-5
fas-1.0.2.xml
...utoSysStart/src/main/resources/db/changelog/fas-1.0.2.xml
+37
-0
No files found.
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/dao/entity/TopographyLine.java
View file @
89341cd3
...
...
@@ -68,6 +68,12 @@ public class TopographyLine extends BusinessEntity{
@Column
(
name
=
"to_port"
,
columnDefinition
=
"varchar(32) COMMENT '终点'"
)
private
String
toPort
;
@Column
(
name
=
"type"
,
columnDefinition
=
"varchar(32) COMMENT '1 领导架构 | 2 任务流程'"
)
private
String
type
;
@Column
(
name
=
"category"
,
columnDefinition
=
"varchar(32) COMMENT '类别'"
)
private
String
category
;
public
String
getId
()
{
return
id
;
}
...
...
@@ -128,6 +134,18 @@ public class TopographyLine extends BusinessEntity{
public
void
setToPort
(
String
toPort
)
{
this
.
toPort
=
toPort
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
String
getCategory
()
{
return
category
;
}
public
void
setCategory
(
String
category
)
{
this
.
category
=
category
;
}
}
YeeAmosFireAutoSysCommon/src/main/java/com/yeejoin/amos/fas/dao/entity/TopographyNode.java
View file @
89341cd3
...
...
@@ -75,6 +75,9 @@ public class TopographyNode extends BusinessEntity{
@Column
(
name
=
"source_id"
,
columnDefinition
=
"varchar(32) COMMENT '资源id'"
)
private
String
sourceId
;
@Column
(
name
=
"type"
,
columnDefinition
=
"varchar(32) COMMENT '1 领导架构 | 2 任务流程'"
)
private
String
type
;
public
String
getId
()
{
return
id
;
}
...
...
@@ -141,4 +144,10 @@ public class TopographyNode extends BusinessEntity{
public
void
setSourceId
(
String
sourceId
)
{
this
.
sourceId
=
sourceId
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/TopographyController.java
View file @
89341cd3
...
...
@@ -42,11 +42,11 @@ public class TopographyController {
@Autowired
private
ITopographyLineService
lineService
;
@ApiOperation
(
value
=
"根据appI
D
查询节点及线"
,
notes
=
"根据appID查询节点及线"
)
@GetMapping
(
value
=
"/{appId}"
)
public
CommonResponse
getTextPlanById
(
@PathVariable
(
value
=
"appId"
)
String
appId
)
{
List
<
TopographyNode
>
nodes
=
nodeService
.
getNodesByAppId
(
appId
);
List
<
TopographyLine
>
links
=
lineService
.
getLin
ksByAppId
(
appId
);
@ApiOperation
(
value
=
"根据appI
d
查询节点及线"
,
notes
=
"根据appID查询节点及线"
)
@GetMapping
(
value
=
"/
query/{type}/
{appId}"
)
public
CommonResponse
getTextPlanById
AndType
(
@PathVariable
(
value
=
"appId"
)
String
appId
,
@PathVariable
(
value
=
"type"
)
String
type
)
{
List
<
TopographyNode
>
nodes
=
nodeService
.
getNodesByAppId
AndType
(
appId
,
type
);
List
<
TopographyLine
>
links
=
lineService
.
getLin
esByAppIdAndType
(
appId
,
type
);
Map
<
String
,
Object
>
results
=
new
HashMap
<>();
results
.
put
(
"nodeData"
,
nodes
);
results
.
put
(
"linkData"
,
links
);
...
...
@@ -62,33 +62,43 @@ public class TopographyController {
@ApiOperation
(
value
=
"保存拓扑图"
,
notes
=
"保存拓扑图"
)
public
CommonResponse
savedonghuanNodes
(
@ApiParam
(
value
=
""
,
required
=
false
)
@RequestBody
JSONObject
topographyParam
)
{
String
appId
=
topographyParam
.
getString
(
"appId"
);
String
type
=
topographyParam
.
getString
(
"type"
);
//节点
JSONArray
nodes
=
topographyParam
.
getJSONArray
(
"nodeData"
);
List
<
TopographyNode
>
nodeData
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
nodes
),
TopographyNode
.
class
);
HashMap
<
String
,
String
>
convertKeyMap
=
new
HashMap
<>();
int
curSize
=
nodeService
.
queryMaxKeyByAppId
(
appId
);
int
curSize
=
nodeService
.
queryMaxKeyByAppId
AndType
(
appId
,
type
);
for
(
TopographyNode
e:
nodeData
){
if
(
Integer
.
valueOf
(
e
.
getKey
())
<
0
)
{
curSize
=
curSize
+
1
;
String
newKey
=
String
.
format
(
"%05d"
,
curSize
);
convertKeyMap
.
put
(
e
.
getKey
(),
newKey
);
e
.
setKey
(
newKey
);
e
.
setType
(
type
);
e
.
setAppId
(
appId
);
e
.
setGroup
(
""
);
if
(
e
.
getGroup
()
==
null
)
{
e
.
setGroup
(
""
);
}
else
if
(
Integer
.
valueOf
(
e
.
getGroup
())
<
0
){
//修改新节点组
e
.
setGroup
(
convertKeyMap
.
get
(
e
.
getGroup
()));
}
}
};
//线
JSONArray
links
=
topographyParam
.
getJSONArray
(
"linkData"
);
List
<
TopographyLine
>
lineData
=
JSON
.
parseArray
(
JSON
.
toJSONString
(
links
),
TopographyLine
.
class
);
lineData
.
forEach
(
l
->
{
lineData
.
forEach
(
l
->
{
//修改新增节点之间线的连接
if
(
Integer
.
parseInt
(
l
.
getFrom
())
<
0
)
{
l
.
setFrom
(
convertKeyMap
.
get
(
l
.
getFrom
()));
}
if
(
Integer
.
parseInt
(
l
.
getTo
())
<
0
)
{
l
.
setTo
(
convertKeyMap
.
get
(
l
.
getTo
()));
}
if
(
l
.
getCategory
()
==
null
)
{
l
.
setCategory
(
""
);
}
if
(
l
.
getAppId
()
==
null
)
{
l
.
setAppId
(
appId
);
l
.
setType
(
type
);
}
});
...
...
@@ -101,14 +111,14 @@ public class TopographyController {
TopographyNodeDetail
nodeDetail
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
nodeDetailJson
),
TopographyNodeDetail
.
class
);
String
nodekey
=
nodeDetail
.
getNodekey
();
if
(
nodekey
!=
null
&&
Integer
.
parseInt
(
nodekey
)
<
0
)
{
TopographyNode
node
=
nodeService
.
queryByKeyAndAppId
(
convertKeyMap
.
get
(
nodekey
),
appId
);
TopographyNode
node
=
nodeService
.
queryByKeyAndAppId
AndType
(
convertKeyMap
.
get
(
nodekey
),
appId
,
type
);
nodeDetail
.
setNodeid
(
node
.
getId
());
}
nodeService
.
saveNodeDetail
(
nodeDetail
);
}
List
<
TopographyNode
>
newNodes
=
nodeService
.
getNodesByAppId
(
appId
);
List
<
TopographyLine
>
newLinks
=
lineService
.
getLin
ksByAppId
(
appId
);
//返回保存后的数据
List
<
TopographyNode
>
newNodes
=
nodeService
.
getNodesByAppId
AndType
(
appId
,
type
);
List
<
TopographyLine
>
newLinks
=
lineService
.
getLin
esByAppIdAndType
(
appId
,
type
);
Map
<
String
,
Object
>
results
=
new
HashMap
<>();
results
.
put
(
"nodeData"
,
newNodes
);
results
.
put
(
"linkData"
,
newLinks
);
...
...
@@ -143,7 +153,8 @@ public class TopographyController {
if
(
"Link"
.
equals
(
type
))
{
lineService
.
deleteLine
(
id
);
}
else
{
nodeService
.
deleteNode
(
id
);
TopographyNode
node
=
nodeService
.
queryById
(
id
);
nodeService
.
deleteNode
(
node
);
}
return
CommonResponseUtil
.
success
();
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/ITopographyLineDao.java
View file @
89341cd3
...
...
@@ -10,7 +10,7 @@ import com.yeejoin.amos.fas.dao.entity.TopographyLine;
@Repository
(
"iTopographyLineDao"
)
public
interface
ITopographyLineDao
extends
BaseDao
<
TopographyLine
,
Long
>
{
List
<
TopographyLine
>
findByAppId
(
String
appId
);
List
<
TopographyLine
>
findByAppId
AndType
(
String
appId
,
String
type
);
TopographyLine
findById
(
String
id
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/repository/ITopographyNodeDao.java
View file @
89341cd3
...
...
@@ -11,16 +11,18 @@ import com.yeejoin.amos.fas.dao.entity.TopographyNode;
@Repository
(
"iTopographyNodeDao"
)
public
interface
ITopographyNodeDao
extends
BaseDao
<
TopographyNode
,
Long
>
{
List
<
TopographyNode
>
findByAppId
(
String
appId
);
List
<
TopographyNode
>
findByAppId
AndType
(
String
appId
,
String
type
);
@Query
(
value
=
"select * from f_topography_node "
+
" where id in (?1)"
,
nativeQuery
=
true
)
List
<
TopographyNode
>
findAllByIds
(
@Param
(
"ids"
)
List
<
String
>
ids
);
TopographyNode
findById
(
String
id
);
TopographyNode
findByKeyAndAppId
(
String
nodekey
,
String
appId
);
TopographyNode
findByKeyAndAppId
AndType
(
String
nodekey
,
String
appId
,
String
type
);
@Query
(
value
=
"select max(`key`) from f_topography_node where app_id = (?1)"
,
nativeQuery
=
true
)
Integer
queryMaxKeyByAppId
(
String
appId
);
@Query
(
value
=
"select max(`key`) from f_topography_node where app_id = (?1) and type = (?2)"
,
nativeQuery
=
true
)
Integer
queryMaxKeyByAppIdAndType
(
String
appId
,
String
type
);
List
<
TopographyNode
>
findByGroupAndAppIdAndType
(
String
key
,
String
appId
,
String
type
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ITopographyLineServiceImpl.java
View file @
89341cd3
...
...
@@ -16,8 +16,8 @@ public class ITopographyLineServiceImpl implements ITopographyLineService{
private
ITopographyLineDao
topographyLineDao
;
@Override
public
List
<
TopographyLine
>
getLin
ksByAppId
(
String
appId
)
{
return
topographyLineDao
.
findByAppId
(
appId
);
public
List
<
TopographyLine
>
getLin
esByAppIdAndType
(
String
appId
,
String
type
)
{
return
topographyLineDao
.
findByAppId
AndType
(
appId
,
type
);
}
@Override
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ITopographyNodeServiceImpl.java
View file @
89341cd3
...
...
@@ -27,20 +27,13 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
private
ITopographyLineDao
lineDao
;
@Override
public
List
<
TopographyNode
>
getNodesByAppId
(
String
appId
)
{
return
nodeDao
.
findByAppId
(
appId
);
public
List
<
TopographyNode
>
getNodesByAppId
AndType
(
String
appId
,
String
type
)
{
return
nodeDao
.
findByAppId
AndType
(
appId
,
type
);
}
@Override
public
void
saveNodes
(
List
<
TopographyNode
>
nodeData
)
{
// List<TopographyNode> list = topographyNodeDao.findAllByIds(nodeData.stream().map(n->n.getId()).collect(Collectors.toList()));
// for (TopographyNode topographyNode : list) {
// TopographyNode node = nodeData.stream().filter(n->topographyNode.getId().equals(n.getId())).findFirst().get();
// topographyNode.setLoc(node.getLoc());
// }
// topographyNodeDao.save(list);
nodeDao
.
save
(
nodeData
);
}
@Override
...
...
@@ -61,8 +54,8 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
}
@Override
public
void
deleteNode
(
String
id
)
{
TopographyNode
node
=
nodeDao
.
findById
(
id
);
public
void
deleteNode
(
TopographyNode
node
)
{
//
TopographyNode node = nodeDao.findById(id);
if
(
node
!=
null
)
{
String
key
=
node
.
getKey
();
nodeDao
.
delete
(
node
);
...
...
@@ -70,17 +63,27 @@ public class ITopographyNodeServiceImpl implements ITopographyNodeService{
if
(
lines
!=
null
&&
lines
.
size
()
>
0
)
{
lineDao
.
delete
(
lines
);
}
if
(
node
.
getIsGroup
()
!=
null
&&
node
.
getIsGroup
())
{
List
<
TopographyNode
>
childNodes
=
nodeDao
.
findByGroupAndAppIdAndType
(
node
.
getKey
(),
node
.
getAppId
(),
node
.
getType
());
childNodes
.
forEach
(
c
->
deleteNode
(
c
));
}
return
;
}
}
@Override
public
TopographyNode
queryByKeyAndAppId
(
String
nodekey
,
String
appId
)
{
return
nodeDao
.
findByKeyAndAppId
(
nodekey
,
appId
);
public
TopographyNode
queryByKeyAndAppIdAndType
(
String
nodekey
,
String
appId
,
String
type
)
{
return
nodeDao
.
findByKeyAndAppIdAndType
(
nodekey
,
appId
,
type
);
}
@Override
public
int
queryMaxKeyByAppIdAndType
(
String
appId
,
String
type
)
{
return
nodeDao
.
queryMaxKeyByAppIdAndType
(
appId
,
type
);
}
@Override
public
int
queryMaxKeyByAppId
(
String
appI
d
)
{
return
nodeDao
.
queryMaxKeyByAppId
(
appI
d
);
public
TopographyNode
queryById
(
String
i
d
)
{
return
nodeDao
.
findById
(
i
d
);
}
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/ITopographyLineService.java
View file @
89341cd3
...
...
@@ -6,7 +6,7 @@ import com.yeejoin.amos.fas.dao.entity.TopographyLine;
public
interface
ITopographyLineService
{
public
List
<
TopographyLine
>
getLin
ksByAppId
(
String
appId
);
public
List
<
TopographyLine
>
getLin
esByAppIdAndType
(
String
appId
,
String
type
);
public
void
saveLines
(
List
<
TopographyLine
>
lineData
);
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/ITopographyNodeService.java
View file @
89341cd3
...
...
@@ -2,13 +2,12 @@ package com.yeejoin.amos.fas.business.service.intfc;
import
java.util.List
;
import
com.yeejoin.amos.fas.dao.entity.TopographyLine
;
import
com.yeejoin.amos.fas.dao.entity.TopographyNode
;
import
com.yeejoin.amos.fas.dao.entity.TopographyNodeDetail
;
public
interface
ITopographyNodeService
{
public
List
<
TopographyNode
>
getNodesByAppId
(
String
appId
);
public
List
<
TopographyNode
>
getNodesByAppId
AndType
(
String
appId
,
String
type
);
public
void
saveNodes
(
List
<
TopographyNode
>
nodeData
);
...
...
@@ -16,10 +15,12 @@ public interface ITopographyNodeService {
public
TopographyNodeDetail
saveNodeDetail
(
TopographyNodeDetail
nodeDetail
);
public
void
deleteNode
(
String
id
);
public
void
deleteNode
(
TopographyNode
node
);
public
TopographyNode
queryByKeyAndAppId
(
String
nodekey
,
String
appId
);
public
TopographyNode
queryByKeyAndAppId
AndType
(
String
nodekey
,
String
appId
,
String
type
);
public
int
queryMaxKeyByAppId
(
String
appId
);
public
int
queryMaxKeyByAppIdAndType
(
String
appId
,
String
type
);
public
TopographyNode
queryById
(
String
id
);
}
YeeAmosFireAutoSysStart/src/main/resources/db/changelog/fas-1.0.2.xml
View file @
89341cd3
...
...
@@ -277,5 +277,41 @@
ALTER TABLE `f_fmea_equipment_point` ADD COLUMN `important_equipment_id` bigint(20) NOT NULL COMMENT '所属重点设备id';
</sql>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1583983706412-1"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_topography_node"
columnName=
"type"
/>
</not>
</preConditions>
<comment>
f_topography_node add column type
</comment>
<sql>
ALTER TABLE `f_topography_node` ADD COLUMN `type` varchar(32) DEFAULT NULL COMMENT '1 领导架构 | 2 任务流程';
</sql>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1583983706412-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_topography_line"
columnName=
"type"
/>
</not>
</preConditions>
<comment>
f_topography_line add column type
</comment>
<sql>
ALTER TABLE `f_topography_line` ADD COLUMN `type` varchar(32) DEFAULT NULL COMMENT '1 领导架构 | 2 任务流程';
</sql>
</changeSet>
<changeSet
author=
"shanqiyun"
id=
"1583983706412-3"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"f_topography_line"
columnName=
"category"
/>
</not>
</preConditions>
<comment>
f_topography_line add column category
</comment>
<sql>
ALTER TABLE `f_topography_line` ADD COLUMN `category` varchar(32) DEFAULT '' COMMENT '类别';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
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