Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
2b5deeb5
Commit
2b5deeb5
authored
Jul 08, 2021
by
taabe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改树节点对象,添加节点类型字段
parent
5c0be843
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
187 additions
and
116 deletions
+187
-116
MenuFrom.java
...java/com/yeejoin/amos/boot/biz/common/utils/MenuFrom.java
+57
-23
TreeParser.java
...va/com/yeejoin/amos/boot/biz/common/utils/TreeParser.java
+102
-76
FireTeamListDto.java
...join/amos/boot/module/common/api/dto/FireTeamListDto.java
+6
-0
FireTeamMapper.xml
...e-common-api/src/main/resources/mapper/FireTeamMapper.xml
+6
-4
DataDictionaryController.java
...odule/common/biz/controller/DataDictionaryController.java
+5
-3
EquipmentServiceImpl.java
...oot/module/jcs/biz/service/impl/EquipmentServiceImpl.java
+5
-3
FireTeamServiceImpl.java
...boot/module/jcs/biz/service/impl/FireTeamServiceImpl.java
+6
-7
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/MenuFrom.java
View file @
2b5deeb5
...
@@ -2,6 +2,9 @@ package com.yeejoin.amos.boot.biz.common.utils;
...
@@ -2,6 +2,9 @@ package com.yeejoin.amos.boot.biz.common.utils;
import
java.util.List
;
import
java.util.List
;
/**
* @author DELL
*/
public
class
MenuFrom
{
public
class
MenuFrom
{
public
String
id
;
public
String
id
;
public
String
key
;
public
String
key
;
...
@@ -10,73 +13,104 @@ public class MenuFrom {
...
@@ -10,73 +13,104 @@ public class MenuFrom {
public
String
label
;
public
String
label
;
public
String
name
;
public
String
name
;
public
String
parentId
;
public
String
parentId
;
public
Boolean
isLeaf
=
true
;
public
Boolean
isLeaf
=
true
;
public
List
<
MenuFrom
>
children
;
public
List
<
MenuFrom
>
children
;
/**
* 节点类型
*/
public
String
nodeType
;
public
MenuFrom
(
String
id
,
String
value
,
String
key
,
String
title
,
String
label
,
String
name
,
String
parentId
,
String
nodeType
)
{
super
();
this
.
id
=
id
;
this
.
value
=
value
;
this
.
key
=
key
;
this
.
title
=
title
;
this
.
label
=
label
;
this
.
name
=
name
;
this
.
parentId
=
parentId
;
this
.
nodeType
=
nodeType
;
}
public
MenuFrom
(
String
key
,
String
name
,
String
parentId
,
String
nodeType
)
{
super
();
this
.
id
=
key
;
this
.
value
=
key
;
this
.
key
=
key
;
this
.
title
=
name
;
this
.
label
=
name
;
this
.
name
=
name
;
this
.
parentId
=
parentId
;
this
.
nodeType
=
nodeType
;
}
public
MenuFrom
()
{
super
();
}
public
String
getKey
()
{
public
String
getKey
()
{
return
key
;
return
key
;
}
}
public
void
setKey
(
String
key
)
{
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
this
.
key
=
key
;
}
}
public
String
getTitle
()
{
public
String
getTitle
()
{
return
title
;
return
title
;
}
}
public
void
setTitle
(
String
title
)
{
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
this
.
title
=
title
;
}
}
public
String
getLabel
()
{
public
String
getLabel
()
{
return
label
;
return
label
;
}
}
public
void
setLabel
(
String
label
)
{
public
void
setLabel
(
String
label
)
{
this
.
label
=
label
;
this
.
label
=
label
;
}
}
public
String
getName
()
{
public
String
getName
()
{
return
name
;
return
name
;
}
}
public
void
setName
(
String
name
)
{
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
this
.
name
=
name
;
}
}
public
String
getParentId
()
{
public
String
getParentId
()
{
return
parentId
;
return
parentId
;
}
}
public
void
setParentId
(
String
parentId
)
{
public
void
setParentId
(
String
parentId
)
{
this
.
parentId
=
parentId
;
this
.
parentId
=
parentId
;
}
}
public
Boolean
getIsLeaf
()
{
public
Boolean
getIsLeaf
()
{
return
isLeaf
;
return
isLeaf
;
}
}
public
void
setIsLeaf
(
Boolean
isLeaf
)
{
public
void
setIsLeaf
(
Boolean
isLeaf
)
{
this
.
isLeaf
=
isLeaf
;
this
.
isLeaf
=
isLeaf
;
}
}
public
List
<
MenuFrom
>
getChildren
()
{
public
List
<
MenuFrom
>
getChildren
()
{
return
children
;
return
children
;
}
}
public
void
setChildren
(
List
<
MenuFrom
>
children
)
{
public
void
setChildren
(
List
<
MenuFrom
>
children
)
{
this
.
children
=
children
;
this
.
children
=
children
;
}
}
public
MenuFrom
(
String
id
,
String
value
,
String
key
,
String
title
,
String
label
,
String
name
,
String
parentId
)
{
super
();
this
.
id
=
id
;
this
.
value
=
value
;
this
.
key
=
key
;
this
.
title
=
title
;
this
.
label
=
label
;
this
.
name
=
name
;
this
.
parentId
=
parentId
;
}
public
MenuFrom
(
String
key
,
String
name
,
String
parentId
)
{
public
String
getNodeType
()
{
super
();
return
nodeType
;
this
.
id
=
key
;
this
.
value
=
key
;
this
.
key
=
key
;
this
.
title
=
name
;
this
.
label
=
name
;
this
.
name
=
name
;
this
.
parentId
=
parentId
;
}
public
MenuFrom
()
{
super
();
}
}
public
void
setNodeType
(
String
nodeType
)
{
this
.
nodeType
=
nodeType
;
}
}
}
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/TreeParser.java
View file @
2b5deeb5
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
;
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* 生成树工具类
* 生成树工具类
*
@return
*
* <PRE>
*
@return
<PRE>
* author tw
* author tw
* date 2021/6/10
* date 2021/6/10
* </PRE>
* </PRE>
*/
*/
public
class
TreeParser
{
public
class
TreeParser
{
/**
/**
* @param topId 父id
* @param topId 父id
* @param entityList 数据集合
* @param entityList 数据集合
...
@@ -30,12 +32,13 @@ public class TreeParser{
...
@@ -30,12 +32,13 @@ public class TreeParser{
* </PRE>
* </PRE>
*/
*/
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
static
List
<
Menu
>
getTree
(
Long
topId
,
@SuppressWarnings
(
"rawtypes"
)
Collection
entityList
,
String
packageURL
,
String
IDMethodName
,
int
IDHierarchy
,
String
NAMEMethodName
,
String
PARENTIDMethodName
,
List
<
FirefightersTreeDto
>
list
)
throws
Exception
{
public
static
List
<
Menu
>
getTree
(
Long
topId
,
@SuppressWarnings
(
"rawtypes"
)
Collection
entityList
,
String
packageURL
,
String
IDMethodName
,
int
IDHierarchy
,
String
NAMEMethodName
,
String
PARENTIDMethodName
,
List
<
FirefightersTreeDto
>
list
)
throws
Exception
{
List
<
Menu
>
resultList
=
new
ArrayList
<>();
List
<
Menu
>
resultList
=
new
ArrayList
<>();
@SuppressWarnings
(
"rawtypes"
)
@SuppressWarnings
(
"rawtypes"
)
Class
clazz
=
Class
.
forName
(
packageURL
);
Class
clazz
=
Class
.
forName
(
packageURL
);
Method
IDMethodNameme
=
null
;
Method
IDMethodNameme
=
null
;
switch
(
IDHierarchy
)
{
case
1
:
switch
(
IDHierarchy
)
{
case
1
:
IDMethodNameme
=
clazz
.
getDeclaredMethod
(
IDMethodName
);
IDMethodNameme
=
clazz
.
getDeclaredMethod
(
IDMethodName
);
break
;
break
;
case
2
:
case
2
:
...
@@ -57,27 +60,28 @@ public class TreeParser{
...
@@ -57,27 +60,28 @@ public class TreeParser{
Object
entity
=
clazz
.
cast
(
ob
);
Object
entity
=
clazz
.
cast
(
ob
);
parentId
=
PARENTIDMethodNameme
.
invoke
(
entity
)!=
null
?
Long
.
valueOf
(
String
.
valueOf
(
PARENTIDMethodNameme
.
invoke
(
entity
))):
null
;
parentId
=
PARENTIDMethodNameme
.
invoke
(
entity
)
!=
null
?
Long
.
valueOf
(
String
.
valueOf
(
PARENTIDMethodNameme
.
invoke
(
entity
)))
:
null
;
if
(
parentId
==
null
||
topId
==
parentId
){
if
(
parentId
==
null
||
topId
==
parentId
)
{
String
codeString
=
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
));
String
codeString
=
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
));
Integer
num
=
0
;
Integer
num
=
0
;
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
for
(
FirefightersTreeDto
map
:
list
)
{
for
(
FirefightersTreeDto
map
:
list
)
{
if
(
map
.
getJobTitleCode
().
equals
(
codeString
)
)
{
if
(
map
.
getJobTitleCode
().
equals
(
codeString
))
{
num
=
Integer
.
valueOf
((
String
)
map
.
getNum
());
num
=
Integer
.
valueOf
((
String
)
map
.
getNum
());
break
;
break
;
}
}
};
}
;
}
}
Menu
menu
=
new
Menu
(
Long
.
valueOf
(
codeString
),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
parentId
,
num
);
Menu
menu
=
new
Menu
(
Long
.
valueOf
(
codeString
),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
parentId
,
num
);
resultList
.
add
(
menu
);
resultList
.
add
(
menu
);
}
}
}
}
//获取每个顶层元素的子数据集合
//获取每个顶层元素的子数据集合
for
(
Menu
entity
:
resultList
)
{
for
(
Menu
entity
:
resultList
)
{
entity
.
setChildren
(
getSub
(
entity
.
getId
(),
entityList
,
packageURL
,
IDMethodName
,
IDHierarchy
,
NAMEMethodName
,
PARENTIDMethodName
,
list
));
entity
.
setChildren
(
getSub
(
entity
.
getId
(),
entityList
,
packageURL
,
IDMethodName
,
IDHierarchy
,
NAMEMethodName
,
PARENTIDMethodName
,
list
));
}
}
return
resultList
;
return
resultList
;
...
@@ -87,10 +91,10 @@ public class TreeParser{
...
@@ -87,10 +91,10 @@ public class TreeParser{
* 获取子数据集合
* 获取子数据集合
*/
*/
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
private
static
List
<
Menu
>
getSub
(
Long
topId
,
@SuppressWarnings
(
"rawtypes"
)
Collection
entityList
,
String
packageURL
,
String
IDMethodName
,
int
IDHierarchy
,
String
NAMEMethodName
,
String
PARENTIDMethodName
,
List
<
FirefightersTreeDto
>
list
)
throws
Exception
{
private
static
List
<
Menu
>
getSub
(
Long
topId
,
@SuppressWarnings
(
"rawtypes"
)
Collection
entityList
,
String
packageURL
,
String
IDMethodName
,
int
IDHierarchy
,
String
NAMEMethodName
,
String
PARENTIDMethodName
,
List
<
FirefightersTreeDto
>
list
)
throws
Exception
{
List
<
Menu
>
childList
=
new
ArrayList
<>();
List
<
Menu
>
childList
=
new
ArrayList
<>();
@SuppressWarnings
(
"rawtypes"
)
@SuppressWarnings
(
"rawtypes"
)
Class
clazz
=
Class
.
forName
(
packageURL
);
Class
clazz
=
Class
.
forName
(
packageURL
);
Method
IDMethodNameme
=
null
;
Method
IDMethodNameme
=
null
;
switch
(
IDHierarchy
)
{
switch
(
IDHierarchy
)
{
case
1
:
case
1
:
...
@@ -113,41 +117,43 @@ public class TreeParser{
...
@@ -113,41 +117,43 @@ public class TreeParser{
for
(
Object
ob
:
entityList
)
{
for
(
Object
ob
:
entityList
)
{
Object
entity
=
clazz
.
cast
(
ob
);
Object
entity
=
clazz
.
cast
(
ob
);
parentId
=
PARENTIDMethodNameme
.
invoke
(
entity
)!=
null
?
Long
.
valueOf
(
String
.
valueOf
(
PARENTIDMethodNameme
.
invoke
(
entity
))):
null
;
parentId
=
PARENTIDMethodNameme
.
invoke
(
entity
)
!=
null
?
Long
.
valueOf
(
String
.
valueOf
(
PARENTIDMethodNameme
.
invoke
(
entity
)))
:
null
;
if
(
parentId
==
null
)
{
if
(
parentId
==
null
)
{
if
(
topId
==
parentId
){
if
(
topId
==
parentId
)
{
String
codeString
=
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
));
String
codeString
=
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
));
Integer
num
=
0
;
Integer
num
=
0
;
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
for
(
FirefightersTreeDto
map
:
list
)
{
for
(
FirefightersTreeDto
map
:
list
)
{
if
(
map
.
getJobTitleCode
().
equals
(
codeString
)
)
{
if
(
map
.
getJobTitleCode
().
equals
(
codeString
))
{
num
=
Integer
.
valueOf
((
String
)
map
.
getNum
());
num
=
Integer
.
valueOf
((
String
)
map
.
getNum
());
break
;
break
;
}
}
};
}
;
}
}
Menu
menu
=
new
Menu
(
Long
.
valueOf
(
codeString
),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
parentId
,
num
);
Menu
menu
=
new
Menu
(
Long
.
valueOf
(
codeString
),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
parentId
,
num
);
childList
.
add
(
menu
);
childList
.
add
(
menu
);
}
}
}
else
{
}
else
{
if
(
topId
.
longValue
()==
parentId
.
longValue
()){
if
(
topId
.
longValue
()
==
parentId
.
longValue
())
{
String
codeString
=
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
));
String
codeString
=
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
));
Integer
num
=
0
;
Integer
num
=
0
;
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
for
(
FirefightersTreeDto
map
:
list
)
{
for
(
FirefightersTreeDto
map
:
list
)
{
if
(
map
.
getJobTitleCode
().
equals
(
codeString
)
)
{
if
(
map
.
getJobTitleCode
().
equals
(
codeString
))
{
num
=
Integer
.
valueOf
((
String
)
map
.
getNum
());
num
=
Integer
.
valueOf
((
String
)
map
.
getNum
());
break
;
break
;
}
}
};
}
;
}
}
Menu
menu
=
new
Menu
(
Long
.
valueOf
(
codeString
),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
parentId
,
num
);
Menu
menu
=
new
Menu
(
Long
.
valueOf
(
codeString
),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
parentId
,
num
);
childList
.
add
(
menu
);
childList
.
add
(
menu
);
}
}
}
}
...
@@ -156,11 +162,11 @@ public class TreeParser{
...
@@ -156,11 +162,11 @@ public class TreeParser{
//子集的间接子对象
//子集的间接子对象
for
(
Menu
entity
:
childList
)
{
for
(
Menu
entity
:
childList
)
{
entity
.
setChildren
(
getSub
(
entity
.
getId
(),
entityList
,
packageURL
,
IDMethodName
,
IDHierarchy
,
NAMEMethodName
,
PARENTIDMethodName
,
list
));
entity
.
setChildren
(
getSub
(
entity
.
getId
(),
entityList
,
packageURL
,
IDMethodName
,
IDHierarchy
,
NAMEMethodName
,
PARENTIDMethodName
,
list
));
}
}
//递归退出条件
//递归退出条件
if
(
childList
.
size
()==
0
){
if
(
childList
.
size
()
==
0
)
{
return
null
;
return
null
;
}
}
...
@@ -168,9 +174,6 @@ public class TreeParser{
...
@@ -168,9 +174,6 @@ public class TreeParser{
}
}
/**
/**
* @param topId 父id
* @param topId 父id
* @param entityList 数据集合
* @param entityList 数据集合
...
@@ -186,12 +189,16 @@ public class TreeParser{
...
@@ -186,12 +189,16 @@ public class TreeParser{
* </PRE>
* </PRE>
*/
*/
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
public
static
List
<
MenuFrom
>
getTreexin
(
String
topId
,
@SuppressWarnings
(
"rawtypes"
)
Collection
entityList
,
String
packageURL
,
String
IDMethodName
,
int
IDHierarchy
,
String
NAMEMethodName
,
String
PARENTIDMethodName
)
throws
Exception
{
public
static
List
<
MenuFrom
>
getTreexin
(
String
topId
,
@SuppressWarnings
(
"rawtypes"
)
Collection
entityList
,
List
<
MenuFrom
>
resultList
=
new
ArrayList
<>();
String
packageURL
,
String
IDMethodName
,
int
IDHierarchy
,
String
NAMEMethodName
,
String
PARENTIDMethodName
,
String
nodeTypeMethodName
)
throws
Exception
{
List
<
MenuFrom
>
resultList
=
new
ArrayList
<>();
@SuppressWarnings
(
"rawtypes"
)
@SuppressWarnings
(
"rawtypes"
)
Class
clazz
=
Class
.
forName
(
packageURL
);
Class
clazz
=
Class
.
forName
(
packageURL
);
Method
IDMethodNameme
=
null
;
Method
IDMethodNameme
=
null
;
switch
(
IDHierarchy
)
{
case
1
:
switch
(
IDHierarchy
)
{
case
1
:
IDMethodNameme
=
clazz
.
getDeclaredMethod
(
IDMethodName
);
IDMethodNameme
=
clazz
.
getDeclaredMethod
(
IDMethodName
);
break
;
break
;
case
2
:
case
2
:
...
@@ -207,23 +214,33 @@ public class TreeParser{
...
@@ -207,23 +214,33 @@ public class TreeParser{
Method
NAMEMethodNameme
=
clazz
.
getDeclaredMethod
(
NAMEMethodName
);
Method
NAMEMethodNameme
=
clazz
.
getDeclaredMethod
(
NAMEMethodName
);
Method
PARENTIDMethodNameme
=
clazz
.
getDeclaredMethod
(
PARENTIDMethodName
);
Method
PARENTIDMethodNameme
=
clazz
.
getDeclaredMethod
(
PARENTIDMethodName
);
Method
nodeTypeMethod
=
null
;
if
(!
ValidationUtil
.
isEmpty
(
nodeTypeMethodName
))
{
nodeTypeMethod
=
clazz
.
getDeclaredMethod
(
nodeTypeMethodName
);
}
//获取顶层元素集合
//获取顶层元素集合
String
parentId
;
String
parentId
;
for
(
Object
ob
:
entityList
)
{
for
(
Object
ob
:
entityList
)
{
Object
entity
=
clazz
.
cast
(
ob
);
Object
entity
=
clazz
.
cast
(
ob
);
parentId
=
PARENTIDMethodNameme
.
invoke
(
entity
)!=
null
?
String
.
valueOf
(
PARENTIDMethodNameme
.
invoke
(
entity
)):
null
;
parentId
=
PARENTIDMethodNameme
.
invoke
(
entity
)
!=
null
?
String
.
valueOf
(
PARENTIDMethodNameme
.
invoke
(
entity
))
:
null
;
if
(
parentId
==
null
||
parentId
.
equals
(
topId
)){
if
(
parentId
==
null
||
parentId
.
equals
(
topId
))
{
MenuFrom
menu
=
new
MenuFrom
(
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
parentId
);
MenuFrom
menu
=
new
MenuFrom
(
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
parentId
,
String
.
valueOf
(
nodeTypeMethod
==
null
?
"0"
:
nodeTypeMethod
.
invoke
(
entity
)));
resultList
.
add
(
menu
);
resultList
.
add
(
menu
);
}
}
}
}
//获取每个顶层元素的子数据集合
//获取每个顶层元素的子数据集合
for
(
MenuFrom
entity
:
resultList
)
{
for
(
MenuFrom
entity
:
resultList
)
{
List
<
MenuFrom
>
list
=
getSubxin
(
entity
.
getKey
(),
entityList
,
packageURL
,
IDMethodName
,
IDHierarchy
,
NAMEMethodName
,
PARENTIDMethodName
);
List
<
MenuFrom
>
list
=
getSubxin
(
entity
.
getKey
(),
entityList
,
packageURL
,
IDMethodName
,
IDHierarchy
,
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
NAMEMethodName
,
PARENTIDMethodName
,
nodeTypeMethodName
);
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
entity
.
setIsLeaf
(
false
);
entity
.
setIsLeaf
(
false
);
}
}
entity
.
setChildren
(
list
);
entity
.
setChildren
(
list
);
...
@@ -236,10 +253,13 @@ public class TreeParser{
...
@@ -236,10 +253,13 @@ public class TreeParser{
* 获取子数据集合
* 获取子数据集合
*/
*/
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
private
static
List
<
MenuFrom
>
getSubxin
(
String
topId
,
@SuppressWarnings
(
"rawtypes"
)
Collection
entityList
,
String
packageURL
,
String
IDMethodName
,
int
IDHierarchy
,
String
NAMEMethodName
,
String
PARENTIDMethodName
)
throws
Exception
{
private
static
List
<
MenuFrom
>
getSubxin
(
String
topId
,
@SuppressWarnings
(
"rawtypes"
)
Collection
entityList
,
List
<
MenuFrom
>
childList
=
new
ArrayList
<>();
String
packageURL
,
String
IDMethodName
,
int
IDHierarchy
,
String
NAMEMethodName
,
String
PARENTIDMethodName
,
String
nodeTypeMethodName
)
throws
Exception
{
List
<
MenuFrom
>
childList
=
new
ArrayList
<>();
@SuppressWarnings
(
"rawtypes"
)
@SuppressWarnings
(
"rawtypes"
)
Class
clazz
=
Class
.
forName
(
packageURL
);
Class
clazz
=
Class
.
forName
(
packageURL
);
Method
IDMethodNameme
=
null
;
Method
IDMethodNameme
=
null
;
switch
(
IDHierarchy
)
{
switch
(
IDHierarchy
)
{
case
1
:
case
1
:
...
@@ -257,21 +277,36 @@ public class TreeParser{
...
@@ -257,21 +277,36 @@ public class TreeParser{
}
}
Method
NAMEMethodNameme
=
clazz
.
getDeclaredMethod
(
NAMEMethodName
);
Method
NAMEMethodNameme
=
clazz
.
getDeclaredMethod
(
NAMEMethodName
);
Method
PARENTIDMethodNameme
=
clazz
.
getDeclaredMethod
(
PARENTIDMethodName
);
Method
PARENTIDMethodNameme
=
clazz
.
getDeclaredMethod
(
PARENTIDMethodName
);
Method
nodeTypeMethod
=
null
;
if
(!
ValidationUtil
.
isEmpty
(
nodeTypeMethodName
))
{
nodeTypeMethod
=
clazz
.
getDeclaredMethod
(
nodeTypeMethodName
);
}
String
parentId
;
String
parentId
;
//子集的直接子对象
//子集的直接子对象
for
(
Object
ob
:
entityList
)
{
for
(
Object
ob
:
entityList
)
{
Object
entity
=
clazz
.
cast
(
ob
);
Object
entity
=
clazz
.
cast
(
ob
);
parentId
=
PARENTIDMethodNameme
.
invoke
(
entity
)!=
null
?
String
.
valueOf
(
PARENTIDMethodNameme
.
invoke
(
entity
)):
null
;
parentId
=
PARENTIDMethodNameme
.
invoke
(
entity
)
!=
null
?
String
.
valueOf
(
PARENTIDMethodNameme
.
invoke
(
entity
))
:
null
;
if
(
parentId
==
null
)
{
if
(
parentId
==
null
)
{
if
(
parentId
==
topId
){
if
(
parentId
==
topId
)
{
MenuFrom
menu
=
new
MenuFrom
(
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
parentId
);
MenuFrom
menu
=
new
MenuFrom
(
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
parentId
,
String
.
valueOf
(
nodeTypeMethod
==
null
?
"0"
:
nodeTypeMethod
.
invoke
(
entity
)));
childList
.
add
(
menu
);
childList
.
add
(
menu
);
}
}
}
else
{
}
else
{
if
(
topId
!=
null
&&
topId
.
equals
(
parentId
)){
if
(
topId
!=
null
&&
topId
.
equals
(
parentId
))
{
MenuFrom
menu
=
new
MenuFrom
(
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
parentId
);
MenuFrom
menu
=
new
MenuFrom
(
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
IDMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
String
.
valueOf
(
NAMEMethodNameme
.
invoke
(
entity
)),
parentId
,
String
.
valueOf
(
nodeTypeMethod
==
null
?
"0"
:
nodeTypeMethod
.
invoke
(
entity
)));
menu
.
setIsLeaf
(
false
);
menu
.
setIsLeaf
(
false
);
childList
.
add
(
menu
);
childList
.
add
(
menu
);
}
}
...
@@ -281,11 +316,12 @@ public class TreeParser{
...
@@ -281,11 +316,12 @@ public class TreeParser{
//子集的间接子对象
//子集的间接子对象
for
(
MenuFrom
entity
:
childList
)
{
for
(
MenuFrom
entity
:
childList
)
{
entity
.
setChildren
(
getSubxin
(
entity
.
getKey
(),
entityList
,
packageURL
,
IDMethodName
,
IDHierarchy
,
NAMEMethodName
,
PARENTIDMethodName
));
entity
.
setChildren
(
getSubxin
(
entity
.
getKey
(),
entityList
,
packageURL
,
IDMethodName
,
IDHierarchy
,
NAMEMethodName
,
PARENTIDMethodName
,
nodeTypeMethodName
));
}
}
//递归退出条件
//递归退出条件
if
(
childList
.
size
()==
0
){
if
(
childList
.
size
()
==
0
)
{
return
null
;
return
null
;
}
}
...
@@ -293,14 +329,4 @@ public class TreeParser{
...
@@ -293,14 +329,4 @@ public class TreeParser{
}
}
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/dto/FireTeamListDto.java
View file @
2b5deeb5
...
@@ -21,4 +21,10 @@ public class FireTeamListDto {
...
@@ -21,4 +21,10 @@ public class FireTeamListDto {
@ApiModelProperty
(
value
=
"父级id"
)
@ApiModelProperty
(
value
=
"父级id"
)
private
Long
parent
;
private
Long
parent
;
@ApiModelProperty
(
value
=
"树节点类型(1:单位,0:队伍)"
)
private
String
nodeType
;
@ApiModelProperty
(
value
=
"树节点id"
)
private
Long
id
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/resources/mapper/FireTeamMapper.xml
View file @
2b5deeb5
...
@@ -26,10 +26,12 @@
...
@@ -26,10 +26,12 @@
cb_fire_team a
cb_fire_team a
WHERE
WHERE
a.is_delete = 0
a.is_delete = 0
<if
test=
'par.parent!=null'
>
and a.parent = #{par.parent}
</if>
<if
test=
'par.parent != null'
>
and a.parent = #{par.parent}
</if>
<if
test=
'par.typeCode!=null'
>
and a.type_code = #{par.typeCode}
</if>
<if
test=
'par.typeCode != null'
>
and a.type_code = #{par.typeCode}
</if>
<if
test=
'par.companyCode!=null'
>
and a.company_code = #{par.companyCode}
</if>
<if
test=
'par.companyCode != null'
>
and a.company_code = #{par.companyCode}
</if>
<if
test=
'par.name!=null'
>
and a.name like concat('%', #{par.name}, '%')
</if>
<if
test=
'par.name != null'
>
and a.name like concat('%', #{par.name}, '%')
</if>
<if
test=
'par.nodeType != null and par.nodeType == "1"'
>
and a.company = #{par.id}
</if>
<if
test=
'par.nodeType != null and par.nodeType == "0"'
>
and a.parent = #{par.id}
</if>
</select>
</select>
<select
id=
"listFireTeamDto"
resultType=
"com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto"
>
<select
id=
"listFireTeamDto"
resultType=
"com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto"
>
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/DataDictionaryController.java
View file @
2b5deeb5
...
@@ -211,8 +211,9 @@ public class DataDictionaryController extends BaseController {
...
@@ -211,8 +211,9 @@ public class DataDictionaryController extends BaseController {
return
ResponseHelper
.
buildResponse
(
obj
);
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
}
else
{
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
MenuFrom
>
menus
=
TreeParser
.
getTreexin
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
);
List
<
MenuFrom
>
menus
=
TreeParser
.
getTreexin
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
MenuFrom
Me
=
new
MenuFrom
(
"-1"
,
"-1"
,
"-1"
,
"危化品库"
,
"危化品库"
,
"危化品库"
,
"-1"
);
"getName"
,
"getParent"
,
"getNodeType"
);
MenuFrom
Me
=
new
MenuFrom
(
"-1"
,
"-1"
,
"-1"
,
"危化品库"
,
"危化品库"
,
"危化品库"
,
"-1"
,
null
);
Me
.
setIsLeaf
(
false
);
Me
.
setIsLeaf
(
false
);
Me
.
setChildren
(
menus
);
Me
.
setChildren
(
menus
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
,
JSON
.
toJSON
(
Me
),
time
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
,
JSON
.
toJSON
(
Me
),
time
);
...
@@ -240,7 +241,8 @@ public class DataDictionaryController extends BaseController {
...
@@ -240,7 +241,8 @@ public class DataDictionaryController extends BaseController {
}
else
{
}
else
{
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
MenuFrom
>
menus
=
null
;
List
<
MenuFrom
>
menus
=
null
;
menus
=
TreeParser
.
getTreexin
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
);
menus
=
TreeParser
.
getTreexin
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
,
"getNodeType"
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE_XIN
+
type
,
JSON
.
toJSON
(
menus
),
time
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE_XIN
+
type
,
JSON
.
toJSON
(
menus
),
time
);
objectObjectHashMap
.
put
(
type
,
menus
);
objectObjectHashMap
.
put
(
type
,
menus
);
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/EquipmentServiceImpl.java
View file @
2b5deeb5
...
@@ -30,7 +30,7 @@ public class EquipmentServiceImpl {
...
@@ -30,7 +30,7 @@ public class EquipmentServiceImpl {
List
<
Map
<
String
,
Object
>>
fireSystemMapList
=
(
List
<
Map
<
String
,
Object
>>)
response
.
getResult
();
List
<
Map
<
String
,
Object
>>
fireSystemMapList
=
(
List
<
Map
<
String
,
Object
>>)
response
.
getResult
();
List
<
MenuFrom
>
fireSystemDtoList
=
Lists
.
newArrayList
();
List
<
MenuFrom
>
fireSystemDtoList
=
Lists
.
newArrayList
();
fireSystemMapList
.
forEach
(
system
->
{
fireSystemMapList
.
forEach
(
system
->
{
MenuFrom
menuFrom
=
new
MenuFrom
((
String
)
system
.
get
(
"id"
),
(
String
)
system
.
get
(
"name"
),
"0"
);
MenuFrom
menuFrom
=
new
MenuFrom
((
String
)
system
.
get
(
"id"
),
(
String
)
system
.
get
(
"name"
),
"0"
,
"0"
);
fireSystemDtoList
.
add
(
menuFrom
);
fireSystemDtoList
.
add
(
menuFrom
);
});
});
return
fireSystemDtoList
;
return
fireSystemDtoList
;
...
@@ -45,7 +45,8 @@ public class EquipmentServiceImpl {
...
@@ -45,7 +45,8 @@ public class EquipmentServiceImpl {
List
<
Map
<
String
,
Object
>>
buildingMapList
=
(
List
<
Map
<
String
,
Object
>>)
response
.
getResult
();
List
<
Map
<
String
,
Object
>>
buildingMapList
=
(
List
<
Map
<
String
,
Object
>>)
response
.
getResult
();
List
<
MenuFrom
>
buildingTreeList
=
Lists
.
newArrayList
();
List
<
MenuFrom
>
buildingTreeList
=
Lists
.
newArrayList
();
buildingMapList
.
forEach
(
building
->
{
buildingMapList
.
forEach
(
building
->
{
MenuFrom
menuFrom
=
new
MenuFrom
((
String
)
building
.
get
(
"id"
),
"全部建筑"
,
(
String
)
building
.
get
(
"parentId"
));
MenuFrom
menuFrom
=
new
MenuFrom
((
String
)
building
.
get
(
"id"
),
"全部建筑"
,
(
String
)
building
.
get
(
"parentId"
),
"0"
);
List
<
Map
<
String
,
Object
>>
children
=
(
List
<
Map
<
String
,
Object
>>)
building
.
get
(
"children"
);
List
<
Map
<
String
,
Object
>>
children
=
(
List
<
Map
<
String
,
Object
>>)
building
.
get
(
"children"
);
menuFrom
.
setChildren
(
parseTree
(
menuFrom
,
children
));
menuFrom
.
setChildren
(
parseTree
(
menuFrom
,
children
));
menuFrom
.
setIsLeaf
(
false
);
menuFrom
.
setIsLeaf
(
false
);
...
@@ -58,7 +59,8 @@ public class EquipmentServiceImpl {
...
@@ -58,7 +59,8 @@ public class EquipmentServiceImpl {
List
<
MenuFrom
>
menuFromList
=
Lists
.
newArrayList
();
List
<
MenuFrom
>
menuFromList
=
Lists
.
newArrayList
();
if
(!
ValidationUtil
.
isEmpty
(
children
))
{
if
(!
ValidationUtil
.
isEmpty
(
children
))
{
children
.
forEach
(
child
->
{
children
.
forEach
(
child
->
{
MenuFrom
menuFrom
=
new
MenuFrom
((
String
)
child
.
get
(
"id"
),
(
String
)
child
.
get
(
"name"
),
(
String
)
child
.
get
(
"parentId"
));
MenuFrom
menuFrom
=
new
MenuFrom
((
String
)
child
.
get
(
"id"
),
(
String
)
child
.
get
(
"name"
),
(
String
)
child
.
get
(
"parentId"
),
"0"
);
if
(!
ValidationUtil
.
isEmpty
(
child
.
get
(
"children"
)))
{
if
(!
ValidationUtil
.
isEmpty
(
child
.
get
(
"children"
)))
{
parseTree
(
menuFrom
,
(
List
<
Map
<
String
,
Object
>>)
child
.
get
(
"children"
));
parseTree
(
menuFrom
,
(
List
<
Map
<
String
,
Object
>>)
child
.
get
(
"children"
));
}
else
{
}
else
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/service/impl/FireTeamServiceImpl.java
View file @
2b5deeb5
...
@@ -14,7 +14,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto;
...
@@ -14,7 +14,6 @@ import com.yeejoin.amos.boot.module.common.api.dto.FireTeamListDto;
import
com.yeejoin.amos.boot.module.common.api.entity.FireTeam
;
import
com.yeejoin.amos.boot.module.common.api.entity.FireTeam
;
import
com.yeejoin.amos.boot.module.common.api.entity.OrgUsr
;
import
com.yeejoin.amos.boot.module.common.api.entity.OrgUsr
;
import
com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper
;
import
com.yeejoin.amos.boot.module.common.api.mapper.FireTeamMapper
;
import
com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper
;
import
com.yeejoin.amos.boot.module.common.api.service.IFireTeamService
;
import
com.yeejoin.amos.boot.module.common.api.service.IFireTeamService
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl
;
import
com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient
;
import
com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient
;
...
@@ -29,7 +28,6 @@ import java.util.Collection;
...
@@ -29,7 +28,6 @@ import java.util.Collection;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
/**
* 消防队伍 服务实现类
* 消防队伍 服务实现类
...
@@ -112,7 +110,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
...
@@ -112,7 +110,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
* @return
* @return
*/
*/
public
List
<
MenuFrom
>
getCompanyTeamTree
()
throws
Exception
{
public
List
<
MenuFrom
>
getCompanyTeamTree
()
throws
Exception
{
MenuFrom
root
=
new
MenuFrom
(
"-1"
,
"消防队伍"
,
null
);
MenuFrom
root
=
new
MenuFrom
(
"-1"
,
"消防队伍"
,
null
,
null
);
// 机场单位
// 机场单位
List
<
OrgUsr
>
companyDeptList
=
orgUsrService
.
selectCompanyDepartmentMsg
();
List
<
OrgUsr
>
companyDeptList
=
orgUsrService
.
selectCompanyDepartmentMsg
();
List
<
MenuFrom
>
companyDeptMenuList
=
Lists
.
newArrayList
();
List
<
MenuFrom
>
companyDeptMenuList
=
Lists
.
newArrayList
();
...
@@ -120,7 +118,8 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
...
@@ -120,7 +118,8 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
if
(
ValidationUtil
.
isEmpty
(
o
.
getParentId
()))
{
if
(
ValidationUtil
.
isEmpty
(
o
.
getParentId
()))
{
o
.
setParentId
(
"-1"
);
o
.
setParentId
(
"-1"
);
}
}
companyDeptMenuList
.
add
(
new
MenuFrom
(
o
.
getSequenceNbr
().
toString
(),
o
.
getBizOrgName
(),
o
.
getParentId
()));
companyDeptMenuList
.
add
(
new
MenuFrom
(
o
.
getSequenceNbr
().
toString
(),
o
.
getBizOrgName
(),
o
.
getParentId
(),
"1"
));
});
});
// 消防队伍
// 消防队伍
List
<
MenuFrom
>
teamMenuList
=
Lists
.
newArrayList
();
List
<
MenuFrom
>
teamMenuList
=
Lists
.
newArrayList
();
...
@@ -130,12 +129,12 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
...
@@ -130,12 +129,12 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
// 将单位下没有上级队伍的队伍直接挂在单位下(方便组成树结构)
// 将单位下没有上级队伍的队伍直接挂在单位下(方便组成树结构)
team
.
setParent
(
team
.
getCompany
());
team
.
setParent
(
team
.
getCompany
());
}
}
teamMenuList
.
add
(
new
MenuFrom
(
team
.
getSequenceNbr
().
toString
(),
team
.
getName
(),
team
.
getParent
().
toString
()));
teamMenuList
.
add
(
new
MenuFrom
(
team
.
getSequenceNbr
().
toString
(),
team
.
getName
(),
team
.
getParent
().
toString
(),
"1"
));
});
});
companyDeptMenuList
.
addAll
(
teamMenuList
);
companyDeptMenuList
.
addAll
(
teamMenuList
);
List
<
MenuFrom
>
menuList
=
TreeParser
.
getTreexin
(
"-1"
,
companyDeptMenuList
,
MenuFrom
.
class
.
getName
(),
"getKey"
,
List
<
MenuFrom
>
menuList
=
TreeParser
.
getTreexin
(
"-1"
,
companyDeptMenuList
,
MenuFrom
.
class
.
getName
(),
"getKey"
,
1
,
"getName"
,
1
,
"getName"
,
"getParentId"
,
"getNodeType"
);
"getParentId"
);
root
.
setChildren
(
menuList
);
root
.
setChildren
(
menuList
);
return
Lists
.
newArrayList
(
root
);
return
Lists
.
newArrayList
(
root
);
}
}
...
...
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