Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
1
Merge Requests
1
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
haoban3.0
haoban-manage3.0
Commits
1b0dbadc
Commit
1b0dbadc
authored
Apr 22, 2024
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
好办小程序权限
parent
2de8f46b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
39 deletions
+64
-39
HaobanRoleApiServiceImpl.java
...rvice/service/out/impl/role/HaobanRoleApiServiceImpl.java
+4
-10
HaobanMenuService.java
...haoban/manage/service/service/role/HaobanMenuService.java
+4
-0
HaobanMenuServiceImpl.java
...nage/service/service/role/impl/HaobanMenuServiceImpl.java
+49
-29
Constant.java
...ain/java/com/gic/haoban/manage/service/util/Constant.java
+7
-0
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/role/HaobanRoleApiServiceImpl.java
View file @
1b0dbadc
...
...
@@ -258,15 +258,9 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
Long
superRoleId
=
superRoleBO
.
getRoleId
()
;
List
<
String
>
superMenuCodeList
=
this
.
listRoleMenuCode
(
allMenuList
,
wxEnterpriseId
,
superRoleId
);
// 查询gic配置的权限
if
(
StringUtils
.
isNotBlank
(
enterpriseId
)
&&
!
"-1"
.
equals
(
enterpriseId
))
{
EnterpriseSuperAdminRightMenuQDTO
qdto
=
new
EnterpriseSuperAdminRightMenuQDTO
()
;
qdto
.
setEnterpriseId
(
enterpriseId
);
qdto
.
setNamespace
(
"haoban-wxa"
);
List
<
RightMenuDTO
>
list
=
this
.
rightService
.
listSuperAdminRightMenu
(
qdto
)
;
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
List
<
String
>
subGicList
=
list
.
stream
().
map
(
o
->
o
.
getMenuCode
()).
collect
(
Collectors
.
toList
());
superMenuCodeList
.
addAll
(
subGicList
)
;
}
List
<
String
>
gicBuyCodes
=
this
.
haobanMenuService
.
getGicBuyCodes
(
enterpriseId
)
;
if
(
CollectionUtils
.
isNotEmpty
(
gicBuyCodes
))
{
superMenuCodeList
.
addAll
(
gicBuyCodes
)
;
}
logger
.
info
(
"超管的权限={}"
,
superMenuCodeList
);
// 如果查询的后台的子管理员权限
...
...
@@ -280,7 +274,7 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
Long
subRoleId
=
subRoleBO
.
getRoleId
()
;
subMenuCodes
=
this
.
listRoleMenuCode
(
allMenuList
,
wxEnterpriseId
,
subRoleId
)
;
}
HaobanRoleBO
retBO
=
n
ew
HaobanRoleBO
()
;
HaobanRoleBO
retBO
=
n
ull
;
if
(
systemFlag
==
0
)
{
retBO
=
superRoleBO
;
retBO
.
setMenuCodes
(
superMenuCodeList
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/role/HaobanMenuService.java
View file @
1b0dbadc
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
role
;
import
com.gic.clerk.api.dto.right.RightMenuDTO
;
import
com.gic.haoban.manage.service.entity.role.TabHaobanMenu
;
import
com.gic.haoban.manage.service.pojo.bo.role.HaobanMenuBO
;
...
...
@@ -65,6 +66,9 @@ public interface HaobanMenuService {
*/
List
<
HaobanMenuBO
>
getHaobanMenuTreeList
(
String
wxEnterpriseId
,
String
enterpriseId
,
Integer
clerkType
);
public
List
<
RightMenuDTO
>
getGicBuyMenus
(
String
enterpriseId
)
;
public
List
<
String
>
getGicBuyCodes
(
String
enterpriseId
)
;
/**
* 得到haoban菜单列表
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/role/impl/HaobanMenuServiceImpl.java
View file @
1b0dbadc
...
...
@@ -21,6 +21,7 @@ import com.gic.haoban.manage.service.entity.role.TabHaobanRoleMenu;
import
com.gic.haoban.manage.service.pojo.bo.role.HaobanMenuBO
;
import
com.gic.haoban.manage.service.service.MemberQueryService
;
import
com.gic.haoban.manage.service.service.role.HaobanMenuService
;
import
com.gic.haoban.manage.service.util.Constant
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -116,27 +117,45 @@ public class HaobanMenuServiceImpl implements HaobanMenuService {
}
@Override
public
List
<
RightMenuDTO
>
getGicBuyMenus
(
String
enterpriseId
)
{
if
(
StringUtils
.
isBlank
(
enterpriseId
)
||
"-1"
.
equals
(
enterpriseId
))
{
return
null
;
}
// 查询gic购买的好办小程序权限
EnterpriseSuperAdminRightMenuQDTO
qdto
=
new
EnterpriseSuperAdminRightMenuQDTO
()
;
qdto
.
setEnterpriseId
(
enterpriseId
);
qdto
.
setNamespace
(
Constant
.
hb_wxa_namespace
);
List
<
RightMenuDTO
>
list
=
this
.
rightService
.
listSuperAdminRightMenu
(
qdto
)
;
logger
.
info
(
"查询gic购买的好办小程序权限={}"
,
enterpriseId
,
JSONObject
.
toJSONString
(
list
));
return
list
;
}
@Override
public
List
<
String
>
getGicBuyCodes
(
String
enterpriseId
)
{
List
<
RightMenuDTO
>
list
=
this
.
getGicBuyMenus
(
enterpriseId
)
;
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
list
.
stream
().
map
(
o
->
o
.
getMenuCode
()).
collect
(
Collectors
.
toList
());
}
return
null
;
}
@Override
public
List
<
HaobanMenuBO
>
getHaobanMenuTreeList
(
String
wxEnterpriseId
,
String
enterpriseId
,
Integer
clerkType
)
{
List
<
TabHaobanMenu
>
pidMenuList
=
tabHaobanMenuMapper
.
getHaobanPidMenuList
(
wxEnterpriseId
,
clerkType
,
0
);
List
<
TabHaobanMenu
>
notPidMenuList
=
tabHaobanMenuMapper
.
getHaobanNotPidMenuList
(
wxEnterpriseId
,
clerkType
,
0
);
List
<
HaobanMenuBO
>
pidMenuBOList
=
EntityUtil
.
changeEntityListNew
(
HaobanMenuBO
.
class
,
pidMenuList
);
List
<
HaobanMenuBO
>
notPidMenuBOList
=
EntityUtil
.
changeEntityListNew
(
HaobanMenuBO
.
class
,
notPidMenuList
);
// 查询gic默认带的
// this.rightService.listSuperAdminRightMenu()
EnterpriseSuperAdminRightMenuQDTO
qdto
=
new
EnterpriseSuperAdminRightMenuQDTO
()
;
qdto
.
setEnterpriseId
(
enterpriseId
);
qdto
.
setNamespace
(
"haoban-wxa"
);
List
<
RightMenuDTO
>
list
=
this
.
rightService
.
listSuperAdminRightMenu
(
qdto
)
;
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
List
<
String
>
gicMenulist
=
this
.
getGicBuyCodes
(
enterpriseId
)
;
if
(
CollectionUtils
.
isNotEmpty
(
gicMenulist
))
{
List
<
HaobanMenuBO
>
allMenuList
=
this
.
getAllMenuList
();
Map
<
String
,
HaobanMenuBO
>
map
=
allMenuList
.
stream
().
collect
(
Collectors
.
toMap
(
HaobanMenuBO:
:
getMenuCode
,
o
->
o
,(
k1
,
k2
)->
k1
))
;
for
(
RightMenuDTO
gicMenu
:
list
)
{
String
menuCode
=
gicMenu
.
getMenuCode
(
)
;
if
(
null
!=
map
.
get
(
menuCode
)
)
{
if
(
menuCode
.
equals
(
map
.
get
(
menuCode
)
.
getParentCode
()))
{
notPidMenuBOList
.
add
(
map
.
get
(
menuCode
)
)
;
for
(
String
menuCode
:
gicMenu
list
)
{
HaobanMenuBO
bo
=
map
.
get
(
menuCode
)
;
if
(
null
!=
bo
)
{
if
(
menuCode
.
equals
(
bo
.
getParentCode
()))
{
notPidMenuBOList
.
add
(
bo
)
;
}
else
{
pidMenuBOList
.
add
(
map
.
get
(
menuCode
)
)
;
pidMenuBOList
.
add
(
bo
)
;
}
}
}
...
...
@@ -227,50 +246,51 @@ public class HaobanMenuServiceImpl implements HaobanMenuService {
logger
.
info
(
"取消不处理"
);
return
;
}
List
<
TabHaobanWxEnterpriseRelated
>
wxEnterpriseList
=
this
.
wxEnterpriseRelatedMapper
.
listByEnterpriseId
(
enterpriseId
)
;
if
(
CollectionUtils
.
isEmpty
(
wxEnterpriseList
))
{
logger
.
info
(
"无好办={}"
,
enterpriseId
);
return
;
}
MenuListQDTO
qdto
=
new
MenuListQDTO
()
;
qdto
.
setNamespace
(
"haoban-wxa"
);
qdto
.
setNamespace
(
Constant
.
hb_wxa_namespace
);
qdto
.
setServiceCode
(
serviceCode
);
qdto
.
setPackageCode
(
packageCode
);
ServiceResponse
<
List
<
MenuDTO
>>
resp
=
this
.
menuApiService
.
listMenu
(
qdto
)
;
logger
.
info
(
"查询gic权限={},{}"
,
JSONObject
.
toJSONString
(
qdto
),
JSONObject
.
toJSONString
(
resp
));
if
(!
resp
.
isSuccess
())
{
if
(!
resp
.
isSuccess
()
||
CollectionUtils
.
isEmpty
(
resp
.
getResult
()))
{
logger
.
info
(
"无相关菜单,不处理"
);
return
;
}
List
<
TabHaobanWxEnterpriseRelated
>
wxEnterpriseList
=
this
.
wxEnterpriseRelatedMapper
.
listByEnterpriseId
(
enterpriseId
)
;
if
(
CollectionUtils
.
isEmpty
(
wxEnterpriseList
))
{
logger
.
info
(
"未关联企微={}"
,
enterpriseId
);
return
;
}
logger
.
info
(
"gic关联的企微={}"
,
JSONObject
.
toJSONString
(
wxEnterpriseList
));
List
<
MenuDTO
>
menuDTOList
=
resp
.
getResult
()
;
if
(
CollectionUtils
.
isEmpty
(
menuDTOList
))
{
logger
.
info
(
"无相关菜单"
);
return
;
}
for
(
MenuDTO
gicMenu
:
menuDTOList
)
{
// 授权方式,是否自动授权给子管理员 0,不做处理 1:自动授权子管理员
Integer
authType
=
gicMenu
.
getAuthType
()
;
String
gicMenuCode
=
gicMenu
.
getMenuCode
();
String
haobanRoles
=
gicMenu
.
getHaobanRoles
()
;
if
(
null
==
authType
||
authType
==
0
)
{
logger
.
info
(
"authType=0 {}"
,
gicMenuCode
);
continue
;
}
List
<
String
>
menuCodeList
=
Arrays
.
asList
(
gicMenuCode
)
;
String
haobanRoles
=
gicMenu
.
getHaobanRoles
()
;
if
(
StringUtils
.
isBlank
(
haobanRoles
))
{
logger
.
info
(
"haobanRoles null {}"
,
gicMenuCode
);
continue
;
}
List
<
String
>
menuCodeList
=
Arrays
.
asList
(
gicMenuCode
)
;
String
[]
arr
=
haobanRoles
.
split
(
","
)
;
List
<
Integer
>
addRoleTypeList
=
Arrays
.
stream
(
arr
).
map
(
o
->
Integer
.
valueOf
(
o
)).
collect
(
Collectors
.
toList
());
List
<
Integer
>
addRoleTypeList
=
Arrays
.
stream
(
arr
).
filter
(
o
->
StringUtils
.
isNotBlank
(
o
)).
map
(
o
->
Integer
.
valueOf
(
o
)).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
addRoleTypeList
))
{
logger
.
info
(
"haobanRoles null {} , {}"
,
gicMenuCode
,
haobanRoles
);
continue
;
}
Date
now
=
new
Date
()
;
for
(
int
i
=
0
;
i
<
wxEnterpriseList
.
size
();
i
++)
{
TabHaobanWxEnterpriseRelated
item
=
wxEnterpriseList
.
get
(
i
)
;
String
wxEnterpriseId
=
item
.
getWxEnterpriseId
()
;
List
<
TabHaobanRoleMenu
>
insertMenuList
=
new
ArrayList
<>()
;
List
<
TabHaobanRole
>
l
ist
=
this
.
roleMapper
.
getListByWxEnterpriseId
(
wxEnterpriseId
,
1
)
;
List
<
TabHaobanRole
>
hbRoleL
ist
=
this
.
roleMapper
.
getListByWxEnterpriseId
(
wxEnterpriseId
,
1
)
;
TabHaobanRoleMenu
menu
=
null
;
for
(
TabHaobanRole
role
:
l
ist
)
{
for
(
TabHaobanRole
role
:
hbRoleL
ist
)
{
int
roleType
=
role
.
getClerkType
()
;
if
(!
addRoleTypeList
.
contains
(
roleType
))
{
continue
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/util/Constant.java
0 → 100644
View file @
1b0dbadc
package
com
.
gic
.
haoban
.
manage
.
service
.
util
;
public
class
Constant
{
public
static
final
String
hb_wxa_namespace
=
"haoban-wxa"
;
}
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