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
8febe2ad
Commit
8febe2ad
authored
Jul 01, 2021
by
gaodongdong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改组织机构树
parent
5103c452
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
7 deletions
+86
-7
OrgMenuVo.java
...va/com/yeejoin/amos/boot/module/jcs/api/vo/OrgMenuVo.java
+39
-6
OrgUsrController.java
...amos/boot/module/jcs/biz/controller/OrgUsrController.java
+15
-1
OrgUsrServiceImpl.java
...s/boot/module/jcs/biz/service/impl/OrgUsrServiceImpl.java
+32
-0
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-jcs-api/src/main/java/com/yeejoin/amos/boot/module/jcs/api/vo/OrgMenuVo.java
View file @
8febe2ad
...
...
@@ -6,6 +6,8 @@ import lombok.experimental.Accessors;
import
java.util.List
;
import
org.springframework.util.ObjectUtils
;
/**
* @author fengwang
* @date 2021-06-19.
...
...
@@ -14,12 +16,43 @@ import java.util.List;
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"OrgMenuVo"
,
description
=
"树菜单"
)
public
class
OrgMenuVo
{
public
Long
key
;
public
String
title
;
public
Long
parentId
;
public
boolean
leaf
=
true
;
public
List
<
OrgMenuVo
>
children
;
public
String
bizOrgType
;
private
Long
key
;
private
Long
value
;
private
String
title
;
private
String
name
;
private
Long
parentId
;
private
Boolean
leaf
=
true
;
private
Boolean
isLeaf
=
true
;
private
List
<
OrgMenuVo
>
children
;
private
String
bizOrgType
;
private
String
bizOrgCode
;
public
Boolean
getLeaf
()
{
return
ObjectUtils
.
isEmpty
(
children
);
}
public
Boolean
getIsLeaf
()
{
return
ObjectUtils
.
isEmpty
(
children
);
}
public
Long
getValue
()
{
return
key
;
}
public
String
getName
()
{
return
title
;
}
public
OrgMenuVo
(
Long
key
,
String
title
,
Long
parentId
,
String
bizOrgType
,
boolean
leaf
,
String
bizOrgCode
)
{
super
();
this
.
key
=
key
;
this
.
title
=
title
;
this
.
parentId
=
parentId
;
this
.
bizOrgType
=
bizOrgType
;
this
.
leaf
=
leaf
;
this
.
bizOrgCode
=
bizOrgCode
;
}
public
OrgMenuVo
(
Long
key
,
String
title
,
Long
parentId
,
String
bizOrgType
,
boolean
leaf
)
{
super
();
this
.
key
=
key
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/OrgUsrController.java
View file @
8febe2ad
...
...
@@ -138,11 +138,25 @@ public class OrgUsrController extends BaseController {
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/companyTree"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取单位部门树
"
,
notes
=
"获取单位部门树
"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取单位部门树
(key为物理主键)"
,
notes
=
"获取单位部门树(key为物理主键)\"
"
)
public
ResponseModel
<
List
<
OrgMenuVo
>>
selectCompanyTree
()
throws
Exception
{
List
<
OrgMenuVo
>
menus
=
iOrgUsrService
.
getTree
(
null
,
iOrgUsrService
.
selectCompanyDepartmentMsg
(),
OrgUsr
.
class
.
getName
(),
"getSequenceNbr"
,
2
,
"getBizOrgName"
,
"getParentId"
,
"getBizOrgType"
);
return
ResponseHelper
.
buildResponse
(
menus
);
}
/**
*
* 获取单位部门树
* @param
* @return
*/
@TycloudOperation
(
needAuth
=
false
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/orgTree"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取单位部门树(bizOrgCode为物理主键)"
,
notes
=
"获取单位部门树(bizOrgCode为物理主键)\""
)
public
ResponseModel
<
List
<
OrgMenuVo
>>
selectCompanyTreeCode
()
throws
Exception
{
List
<
OrgMenuVo
>
menus
=
iOrgUsrService
.
buildTreeParallel
(
iOrgUsrService
.
selectCompanyDepartmentMsg
());
return
ResponseHelper
.
buildResponse
(
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/OrgUsrServiceImpl.java
View file @
8febe2ad
...
...
@@ -9,6 +9,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Random
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -62,6 +63,37 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
public
String
selectUpUnitByParam
(
String
id
)
{
return
this
.
baseMapper
.
selectUpUnitByParam
(
id
);
}
public
static
List
<
OrgMenuVo
>
buildTreeParallel
(
List
<
OrgUsr
>
list
)
{
List
<
OrgMenuVo
>
menuList
=
list
.
stream
().
map
(
o
->
{
OrgMenuVo
menu
=
new
OrgMenuVo
(
o
.
getSequenceNbr
(),
o
.
getBizOrgName
(),
ObjectUtils
.
isEmpty
(
o
.
getParentId
())
?
0L
:
Long
.
valueOf
(
o
.
getParentId
()),
o
.
getBizOrgType
(),
false
,
o
.
getBizOrgCode
());
return
menu
;
}).
collect
(
Collectors
.
toList
());
List
<
OrgMenuVo
>
result
=
new
ArrayList
<>();
Map
<
Long
,
OrgMenuVo
>
map
=
new
HashMap
<>(
menuList
.
size
());
menuList
.
forEach
(
e
->
map
.
put
(
e
.
getKey
(),
e
));
Set
<?
extends
Map
.
Entry
<
Long
,
?
extends
OrgMenuVo
>>
entries
=
map
.
entrySet
();
entries
.
parallelStream
().
forEach
(
entry
->
{
OrgMenuVo
value
=
entry
.
getValue
();
if
(
value
!=
null
)
{
OrgMenuVo
treeDto
=
map
.
get
(
value
.
getParentId
());
if
(
treeDto
!=
null
)
{
List
<
OrgMenuVo
>
children
=
treeDto
.
getChildren
();
if
(
children
==
null
)
{
children
=
new
ArrayList
<>();
treeDto
.
setChildren
(
children
);
}
children
.
add
(
value
);
}
else
{
result
.
add
(
value
);
}
}
});
return
result
;
}
@Override
public
List
<
OrgMenuVo
>
getTree
(
Long
topId
,
Collection
entityList
,
String
packageURL
,
String
IDMethodName
,
int
IDHierarchy
,
String
NAMEMethodName
,
String
PARENTIDMethodName
,
String
OrgTypeMethodName
)
throws
Exception
{
...
...
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