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
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
haoban3.0
haoban-manage3.0
Commits
83380e85
Commit
83380e85
authored
Sep 07, 2023
by
songyinghui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature: 好办权限刷新
parent
93dc42c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
3 deletions
+56
-3
HaobanRoleApiServiceImpl.java
...rvice/service/out/impl/role/HaobanRoleApiServiceImpl.java
+56
-3
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/role/HaobanRoleApiServiceImpl.java
View file @
83380e85
...
...
@@ -611,16 +611,69 @@ public class HaobanRoleApiServiceImpl implements HaobanRoleApiService {
if
(
StringUtils
.
isNotBlank
(
params
)
&&
!
StringUtils
.
equals
(
"-1"
,
params
))
{
enterpriseId
=
params
;
}
List
<
String
>
menuCodes
=
new
ArrayList
<>();
menuCodes
.
add
(
"publishMaterial"
);
menuCodes
.
add
(
"userCenter_createCenter"
);
for
(
String
tempId
:
enterpriseIds
)
{
if
(
StringUtils
.
isNotBlank
(
enterpriseId
)
&&
!
StringUtils
.
equalsIgnoreCase
(
enterpriseId
,
tempId
))
{
logger
.
info
(
"当前企业:{} 不是目标企业:{}, 忽略"
,
tempId
,
enterpriseId
);
logger
.
info
(
"
【flushRightOneTime】
当前企业:{} 不是目标企业:{}, 忽略"
,
tempId
,
enterpriseId
);
continue
;
}
ContentMaterialROleInitQDTO
contentMaterialROleInitQDTO
=
new
ContentMaterialROleInitQDTO
();
contentMaterialROleInitQDTO
.
setEnterpriseId
(
tempId
);
contentMaterialROleInitQDTO
.
setVersion
(
MaterialEnterpriseAdaptor
.
MaterialLevel
.
HIGH
.
getCode
());
logger
.
info
(
"添加企业素材纬度权限: {}"
,
JSON
.
toJSONString
(
contentMaterialROleInitQDTO
));
this
.
contentMaterialRoleInit
(
contentMaterialROleInitQDTO
);
logger
.
info
(
"【flushRightOneTime】添加企业素材纬度权限: {}"
,
JSON
.
toJSONString
(
contentMaterialROleInitQDTO
));
// 查询企业下所有的微信企业id
List
<
TabHaobanWxEnterprise
>
tabHaobanWxEnterprises
=
wxEnterpriseRelatedService
.
listByEnterpriseId
(
contentMaterialROleInitQDTO
.
getEnterpriseId
());
if
(
CollectionUtils
.
isEmpty
(
tabHaobanWxEnterprises
))
{
logger
.
info
(
"【flushRightOneTime】企业 {} 未关联企微 "
,
contentMaterialROleInitQDTO
.
getEnterpriseId
());
return
ServiceResponse
.
success
();
}
for
(
TabHaobanWxEnterprise
wxEnterpris
:
tabHaobanWxEnterprises
)
{
// 查询企微下 导购、店长、区经 的role_id
String
wxEnterpriseId
=
wxEnterpris
.
getWxEnterpriseId
();
// 处理商户权限
// 运维 + 好办后台
List
<
HaobanRoleBO
>
haobanRoleBOS
=
haobanRoleService
.
getListByWxEnterpriseId
(
wxEnterpriseId
,
null
);
if
(
CollectionUtils
.
isEmpty
(
haobanRoleBOS
))
{
logger
.
info
(
"【flushRightOneTime】企业{} 企微 {} 下没有角色 "
,
contentMaterialROleInitQDTO
.
getEnterpriseId
(),
wxEnterpriseId
);
continue
;
}
logger
.
info
(
"【flushRightOneTime】企业 {} 企微 {} 下角色个数: {}"
,
enterpriseId
,
wxEnterpriseId
,
haobanRoleBOS
.
size
());
// 为role 添加菜单
List
<
TabHaobanRoleMenu
>
haobanRoleMenus
=
new
ArrayList
<>();
for
(
HaobanRoleBO
haobanRoleBO
:
haobanRoleBOS
)
{
logger
.
info
(
"本次对应的menuCode:{}"
,
JSON
.
toJSONString
(
menuCodes
));
List
<
String
>
hasExistMenuCodes
=
haobanRoleMenuService
.
getByWxEnterpriseIdAndRoleId
(
wxEnterpriseId
,
haobanRoleBO
.
getRoleId
());
if
(
CollectionUtils
.
isEmpty
(
hasExistMenuCodes
))
{
hasExistMenuCodes
=
new
ArrayList
<>();
}
List
<
String
>
excludeMenuCodes
=
hasExistMenuCodes
;
List
<
TabHaobanRoleMenu
>
tabHaobanRoleMenus
=
menuCodes
.
stream
()
.
filter
(
item
->
!
excludeMenuCodes
.
contains
(
item
))
.
map
(
item
->
{
TabHaobanRoleMenu
temp
=
new
TabHaobanRoleMenu
();
temp
.
setRoleMenuId
(
UniqueIdUtils
.
uniqueLong
());
temp
.
setRoleId
(
haobanRoleBO
.
getRoleId
());
temp
.
setWxEnterpriseId
(
wxEnterpriseId
);
temp
.
setStatusFlag
(
1
);
temp
.
setMenuCode
(
item
);
temp
.
setCreateTime
(
new
Date
());
temp
.
setUpdateTime
(
new
Date
());
return
temp
;
})
.
collect
(
Collectors
.
toList
());
logger
.
info
(
"【flushRightOneTime】企微:{} roleId:{} 新增权限code: {}"
,
wxEnterpriseId
,
haobanRoleBO
.
getRoleId
(),
JSON
.
toJSONString
(
tabHaobanRoleMenus
));
haobanRoleMenus
.
addAll
(
tabHaobanRoleMenus
);
}
logger
.
info
(
"【flushRightOneTime】企微:{} 新增权限code: {}"
,
wxEnterpriseId
,
JSON
.
toJSONString
(
haobanRoleMenus
));
if
(
CollectionUtils
.
isNotEmpty
(
haobanRoleMenus
))
{
haobanRoleMenuService
.
insertBatch
(
haobanRoleMenus
);
}
}
}
return
ServiceResponse
.
success
();
}
...
...
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