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
df226832
Commit
df226832
authored
Jun 29, 2021
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加数据字典,表单批量查询接口
parent
24d0b99a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
217 additions
and
5 deletions
+217
-5
MenuFrom.java
...java/com/yeejoin/amos/boot/biz/common/utils/MenuFrom.java
+71
-0
RedisKey.java
...java/com/yeejoin/amos/boot/biz/common/utils/RedisKey.java
+2
-0
TreeParser.java
...va/com/yeejoin/amos/boot/biz/common/utils/TreeParser.java
+137
-0
DataDictionaryController.java
...t/module/jcs/biz/controller/DataDictionaryController.java
+7
-5
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/MenuFrom.java
0 → 100644
View file @
df226832
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
;
import
java.util.List
;
public
class
MenuFrom
{
public
String
id
;
public
String
key
;
public
String
value
;
public
String
title
;
public
String
label
;
public
String
name
;
public
String
parentId
;
public
Boolean
isLeaf
=
false
;
public
List
<
MenuFrom
>
children
;
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getLabel
()
{
return
label
;
}
public
void
setLabel
(
String
label
)
{
this
.
label
=
label
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
String
parentId
)
{
this
.
parentId
=
parentId
;
}
public
Boolean
getIsLeaf
()
{
return
isLeaf
;
}
public
void
setIsLeaf
(
Boolean
isLeaf
)
{
this
.
isLeaf
=
isLeaf
;
}
public
List
<
MenuFrom
>
getChildren
()
{
return
children
;
}
public
void
setChildren
(
List
<
MenuFrom
>
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
()
{
super
();
}
}
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/RedisKey.java
View file @
df226832
...
...
@@ -12,6 +12,8 @@ public class RedisKey {
public
static
final
String
FORM_CODE
=
"form_code_"
;
//根据字典code获取数据字典列表
public
static
final
String
DATA_DICTIONARY_CODE
=
"data_dictionary_code_"
;
//根据字典code获取数据字典列表
public
static
final
String
DATA_DICTIONARY_CODE_XIN
=
"data_dictionary_code_xin_"
;
//根据id获取消防人员基本信息
public
static
final
String
FIREFIGHTERS_ID
=
"firefighters_id_"
;
//根据id获取消防人员列表基本信息
...
...
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/TreeParser.java
View file @
df226832
...
...
@@ -128,4 +128,141 @@ public class TreeParser{
return
childList
;
}
/**
* @param topId 父id
* @param entityList 数据集合
* @param packageURL 集合对象包名+类名
* @param IDMethodName 集合对象获取树id 方法名
* @param IDHierarchy 集合对象获取树id 来源于自己 还是父级( 1自己,2 父级 ,3 父级的父级)
* @param NAMEMethodName 集合对象获取树name 方法名
* @param PARENTIDMethodName 集合对象获取树父id 方法名
* @return java.util.List<com.yeejoin.amos.boot.module.jcs.api.vo.Menu>
* <PRE>
* author tw
* date 2021/6/10
* </PRE>
*/
@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
{
List
<
MenuFrom
>
resultList
=
new
ArrayList
<>();
@SuppressWarnings
(
"rawtypes"
)
Class
clazz
=
Class
.
forName
(
packageURL
);
Method
IDMethodNameme
=
null
;
switch
(
IDHierarchy
)
{
case
1
:
IDMethodNameme
=
clazz
.
getDeclaredMethod
(
IDMethodName
);
break
;
case
2
:
IDMethodNameme
=
clazz
.
getSuperclass
().
getDeclaredMethod
(
IDMethodName
);
break
;
case
3
:
IDMethodNameme
=
clazz
.
getSuperclass
().
getSuperclass
().
getDeclaredMethod
(
IDMethodName
);
break
;
default
:
IDMethodNameme
=
clazz
.
getDeclaredMethod
(
IDMethodName
);
break
;
}
Method
NAMEMethodNameme
=
clazz
.
getDeclaredMethod
(
NAMEMethodName
);
Method
PARENTIDMethodNameme
=
clazz
.
getDeclaredMethod
(
PARENTIDMethodName
);
//获取顶层元素集合
String
parentId
;
for
(
Object
ob
:
entityList
)
{
Object
entity
=
clazz
.
cast
(
ob
);
parentId
=
PARENTIDMethodNameme
.
invoke
(
entity
)!=
null
?
String
.
valueOf
(
PARENTIDMethodNameme
.
invoke
(
entity
)):
null
;
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
);
resultList
.
add
(
menu
);
}
}
//获取每个顶层元素的子数据集合
for
(
MenuFrom
entity
:
resultList
)
{
List
<
MenuFrom
>
list
=
getSubxin
(
entity
.
getKey
(),
entityList
,
packageURL
,
IDMethodName
,
IDHierarchy
,
NAMEMethodName
,
PARENTIDMethodName
);
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
entity
.
setIsLeaf
(
true
);
}
entity
.
setChildren
(
list
);
}
return
resultList
;
}
/**
* 获取子数据集合
*/
@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
{
List
<
MenuFrom
>
childList
=
new
ArrayList
<>();
@SuppressWarnings
(
"rawtypes"
)
Class
clazz
=
Class
.
forName
(
packageURL
);
Method
IDMethodNameme
=
null
;
switch
(
IDHierarchy
)
{
case
1
:
IDMethodNameme
=
clazz
.
getDeclaredMethod
(
IDMethodName
);
break
;
case
2
:
IDMethodNameme
=
clazz
.
getSuperclass
().
getDeclaredMethod
(
IDMethodName
);
break
;
case
3
:
IDMethodNameme
=
clazz
.
getSuperclass
().
getSuperclass
().
getDeclaredMethod
(
IDMethodName
);
break
;
default
:
IDMethodNameme
=
clazz
.
getDeclaredMethod
(
IDMethodName
);
break
;
}
Method
NAMEMethodNameme
=
clazz
.
getDeclaredMethod
(
NAMEMethodName
);
Method
PARENTIDMethodNameme
=
clazz
.
getDeclaredMethod
(
PARENTIDMethodName
);
String
parentId
;
//子集的直接子对象
for
(
Object
ob
:
entityList
)
{
Object
entity
=
clazz
.
cast
(
ob
);
parentId
=
PARENTIDMethodNameme
.
invoke
(
entity
)!=
null
?
String
.
valueOf
(
PARENTIDMethodNameme
.
invoke
(
entity
)):
null
;
if
(
parentId
==
null
)
{
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
);
childList
.
add
(
menu
);
}
}
else
{
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
);
menu
.
setIsLeaf
(
true
);
childList
.
add
(
menu
);
}
}
}
//子集的间接子对象
for
(
MenuFrom
entity
:
childList
)
{
entity
.
setChildren
(
getSubxin
(
entity
.
getKey
(),
entityList
,
packageURL
,
IDMethodName
,
IDHierarchy
,
NAMEMethodName
,
PARENTIDMethodName
));
}
//递归退出条件
if
(
childList
.
size
()==
0
){
return
null
;
}
return
childList
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/DataDictionaryController.java
View file @
df226832
...
...
@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.jcs.biz.service.impl.DataDictionaryServiceIm
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.bouncycastle.jcajce.provider.asymmetric.ec.SignatureSpi.ecCVCDSA
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -177,18 +178,19 @@ public class DataDictionaryController extends BaseController {
QueryWrapper
<
DataDictionary
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
type
);
queryWrapper
.
orderByAsc
(
"sort_num"
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
)){
Object
obj
=
redisUtils
.
get
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
DATA_DICTIONARY_CODE
_XIN
+
type
)){
Object
obj
=
redisUtils
.
get
(
RedisKey
.
DATA_DICTIONARY_CODE
_XIN
+
type
);
objectObjectHashMap
.
put
(
type
,
obj
);
}
else
{
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
Menu
>
menus
=
null
;
menus
=
TreeParser
.
getTree
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE
+
type
,
JSON
.
toJSON
(
menus
),
time
);
List
<
Menu
From
>
menus
=
null
;
menus
=
TreeParser
.
getTree
xin
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
);
redisUtils
.
set
(
RedisKey
.
DATA_DICTIONARY_CODE
_XIN
+
type
,
JSON
.
toJSON
(
menus
),
time
);
objectObjectHashMap
.
put
(
type
,
menus
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"系统异常!"
);
}
return
ResponseHelper
.
buildResponse
(
objectObjectHashMap
);
...
...
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