Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
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
fangxinjiang
yifu-mvp
Commits
938b6ed6
Commit
938b6ed6
authored
Dec 28, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
B端服务-登录改造
parent
a465f883
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
43 additions
and
17 deletions
+43
-17
MSetttleCustomerUserMapper.xml
.../src/main/resources/mapper/MSetttleCustomerUserMapper.xml
+1
-1
YifuClientLoginSuccessHandler.java
...s.v1/yifu/auth/handler/YifuClientLoginSuccessHandler.java
+2
-2
ClientNameConstants.java
...lus/v1/yifu/common/core/constant/ClientNameConstants.java
+18
-0
YifuUser.java
.../com/yifu/cloud/plus/v1/yifu/common/core/vo/YifuUser.java
+3
-1
YifuUserDetailsService.java
.../yifu/common/security/service/YifuUserDetailsService.java
+1
-1
TreeUtil.java
.../com/yifu.cloud.plus.v1/yifu/admin/api/util/TreeUtil.java
+2
-2
BusinessUserController.java
...plus/v1/yifu/admin/controller/BusinessUserController.java
+2
-2
MenuController.java
...u/cloud/plus/v1/yifu/admin/controller/MenuController.java
+8
-2
RoleController.java
...u/cloud/plus/v1/yifu/admin/controller/RoleController.java
+3
-0
SysRoleMapper.xml
...yifu-upms-biz/src/main/resources/mapper/SysRoleMapper.xml
+1
-1
SysUserMapper.xml
...yifu-upms-biz/src/main/resources/mapper/SysUserMapper.xml
+2
-5
No files found.
yifu-archives/yifu-archives-biz/src/main/resources/mapper/MSetttleCustomerUserMapper.xml
View file @
938b6ed6
...
...
@@ -41,7 +41,7 @@
</select>
<select
id=
"getCustomerUser"
resultType=
"com.yifu.cloud.plus.v1.yifu.archives.vo.MSetttleCustomerUserVo"
>
select a.user_id,GROUP_CONCAT(DISTINCT b.CUSTOMER_NAME) as CUSTOMER_NAME from m_setttle_customer_user a
left join t_customer_info b on a.customer_id = b.id
left join t_settle_domain b on a.customer_id = b.CUSTOMER_ID
where a.user_id in
<foreach
item=
"item"
index=
"index"
collection=
"userIdList"
open=
"("
separator=
","
close=
")"
>
'${item}'
...
...
yifu-auth/src/main/java/com/yifu.cloud.plus.v1/yifu/auth/handler/YifuClientLoginSuccessHandler.java
View file @
938b6ed6
...
...
@@ -80,12 +80,12 @@ public class YifuClientLoginSuccessHandler implements AuthenticationSuccessHandl
}*/
/*if (null != user.getClientRoleMap()){//验证角色
List<
Integer
> thisClientRoleList = user.getClientRoleMap().get(clientId);
List<
Long
> thisClientRoleList = user.getClientRoleMap().get(clientId);
if(null == thisClientRoleList){
if(null != ServiceNameConstants.CLIENT_NAME_MAP.get(clientId)){
clientId = ServiceNameConstants.CLIENT_NAME_MAP.get(clientId);
}
throw new InvalidException(user.getNick
N
ame()+"没有\""+ clientId +"\"的角色!请联系管理员分配角色!");
throw new InvalidException(user.getNick
n
ame()+"没有\""+ clientId +"\"的角色!请联系管理员分配角色!");
}else{
if (null != user.getAuthorities()){//剔除非登录终端的权限(权限只能重建,不能修改)
final String finalClientId = clientId;
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/constant/ClientNameConstants.java
0 → 100644
View file @
938b6ed6
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
common
.
core
.
constant
;
/**
* @Author fxj
* @Date 2022/12/28
* @Description
* @Version 1.0
*/
public
interface
ClientNameConstants
{
/**
* MVP
*/
String
CLIENT_MVP
=
"yifu-mvp"
;
/**
* MVP
*/
String
CLIENT_B
=
"hrCustomer"
;
}
yifu-common/yifu-common-core/src/main/java/com/yifu/cloud/plus/v1/yifu/common/core/vo/YifuUser.java
View file @
938b6ed6
...
...
@@ -88,7 +88,8 @@ public class YifuUser extends User {
public
YifuUser
(
String
id
,
Long
deptId
,
String
deptName
,
String
username
,
String
nickname
,
String
systemFlag
,
String
password
,
String
phone
,
boolean
enabled
,
boolean
accountNonExpired
,
boolean
credentialsNonExpired
,
boolean
accountNonLocked
,
String
userGroup
,
Collection
<?
extends
GrantedAuthority
>
authorities
,
String
ldapDn
)
{
String
userGroup
,
Collection
<?
extends
GrantedAuthority
>
authorities
,
String
ldapDn
,
Map
<
String
,
List
<
Long
>>
clientRoleMap
)
{
super
(
username
,
password
,
enabled
,
accountNonExpired
,
credentialsNonExpired
,
accountNonLocked
,
authorities
);
this
.
id
=
id
;
this
.
deptId
=
deptId
;
...
...
@@ -98,6 +99,7 @@ public class YifuUser extends User {
this
.
systemFlag
=
systemFlag
;
this
.
userGroup
=
userGroup
;
this
.
ldapDn
=
ldapDn
;
this
.
clientRoleMap
=
clientRoleMap
;
}
}
yifu-common/yifu-common-security/src/main/java/com/yifu/cloud/plus/v1/yifu/common/security/service/YifuUserDetailsService.java
View file @
938b6ed6
...
...
@@ -73,7 +73,7 @@ public interface YifuUserDetailsService extends UserDetailsService, Ordered {
user
.
getNickname
(),
user
.
getSystemFlag
(),
SecurityConstants
.
BCRYPT
+
user
.
getPassword
(),
user
.
getPhone
(),
true
,
true
,
true
,
StrUtil
.
equals
(
user
.
getLockFlag
(),
CommonConstants
.
STATUS_NORMAL
),
user
.
getUserGroup
(),
authorities
,
user
.
getLdapDn
());
user
.
getUserGroup
(),
authorities
,
user
.
getLdapDn
()
,
info
.
getClientRoleMap
()
);
}
/**
...
...
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/util/TreeUtil.java
View file @
938b6ed6
...
...
@@ -23,12 +23,12 @@ public class TreeUtil {
for
(
T
treeNode
:
treeNodes
)
{
if
(
root
.
equals
(
treeNode
.
getParentId
()))
{
if
(
root
.
equals
(
treeNode
.
getParentId
())
||
"-1"
.
equals
(
treeNode
.
getParentId
())
)
{
trees
.
add
(
treeNode
);
}
for
(
T
it
:
treeNodes
)
{
if
(
it
.
getParentId
()
==
treeNode
.
getId
()
)
{
if
(
it
.
getParentId
()
.
equals
(
treeNode
.
getId
())
)
{
if
(
treeNode
.
getChildren
()
==
null
)
{
treeNode
.
setChildren
(
new
ArrayList
<>());
}
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/controller/BusinessUserController.java
View file @
938b6ed6
...
...
@@ -12,6 +12,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.MenuTreeForVue;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleMenuR
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.*
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ServiceNameConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
...
...
@@ -219,10 +220,9 @@ public class BusinessUserController {
@Operation
(
description
=
"返回当前用户的树形菜单集合"
)
@GetMapping
(
"/menu"
)
public
R
<
List
<
MenuTreeForVue
>>
getUserMenuForVue
(
@RequestHeader
(
value
=
HttpHeaders
.
AUTHORIZATION
,
required
=
false
)
String
authHeader
,
String
type
)
{
OAuth2Authentication
oAuth2Auth
=
remoteTokenServices
.
loadAuthentication
(
authHeader
.
replace
(
"bearer "
,
""
).
trim
());
// 获取符合条件的菜单
Set
<
SysMenu
>
all
=
new
HashSet
<>();
SecurityUtils
.
getRolesByClient
(
oAuth2Auth
.
getOAuth2Request
().
getClientId
()
)
SecurityUtils
.
getRolesByClient
(
ClientNameConstants
.
CLIENT_B
)
.
forEach
(
roleId
->
all
.
addAll
(
sysMenuService
.
findMenuByRoleId
(
roleId
)));
List
<
MenuTreeForVue
>
menuTreeList
;
if
(
Common
.
isNotNull
(
type
))
{
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/controller/MenuController.java
View file @
938b6ed6
...
...
@@ -22,7 +22,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysMenu
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysMenuService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ServiceNameConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
...
...
@@ -81,9 +83,12 @@ public class MenuController {
* @return 当前用户的树形菜单
*/
@GetMapping
public
R
<
List
<
Tree
<
Long
>>>
getUserMenu
(
Long
parentId
)
{
public
R
<
List
<
Tree
<
Long
>>>
getUserMenu
(
Long
parentId
,
String
clientId
)
{
// 获取符合条件的菜单
Set
<
SysMenu
>
menuSet
=
SecurityUtils
.
getRoles
().
stream
().
map
(
sysMenuService:
:
findMenuByRoleId
)
if
(
Common
.
isEmpty
(
clientId
)){
clientId
=
ClientNameConstants
.
CLIENT_MVP
;
}
Set
<
SysMenu
>
menuSet
=
SecurityUtils
.
getRolesByClient
(
clientId
).
stream
().
map
(
sysMenuService:
:
findMenuByRoleId
)
.
flatMap
(
Collection:
:
stream
).
collect
(
Collectors
.
toSet
());
return
R
.
ok
(
sysMenuService
.
filterMenu
(
menuSet
,
parentId
));
}
...
...
@@ -138,6 +143,7 @@ public class MenuController {
return
R
.
failed
(
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_MENU_ADD_NAME_EXIST
));
}
}
sysMenu
.
setClientId
(
ClientNameConstants
.
CLIENT_MVP
);
SysMenu
menu
=
sysMenuService
.
saveAsso
(
sysMenu
);
return
R
.
ok
(
menu
);
}
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/controller/RoleController.java
View file @
938b6ed6
...
...
@@ -26,11 +26,13 @@ import com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleExcelVO;
import
com.yifu.cloud.plus.v1.yifu.admin.api.vo.RoleVo
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysRoleMenuService
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysRoleService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.ClientNameConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.boot.autoconfigure.integration.IntegrationProperties
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -75,6 +77,7 @@ public class RoleController {
if
(
Common
.
isNotNull
(
check
))
{
return
check
;
}
sysRole
.
setClientId
(
ClientNameConstants
.
CLIENT_MVP
);
return
R
.
ok
(
sysRoleService
.
save
(
sysRole
));
}
...
...
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysRoleMapper.xml
View file @
938b6ed6
...
...
@@ -57,7 +57,7 @@
a.role_name,
c.menu_id,
c.name,
c.sort
c.sort
_order
FROM
sys_role a,
sys_role_menu b
...
...
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysUserMapper.xml
View file @
938b6ed6
...
...
@@ -300,8 +300,8 @@
select *
from sys_user AS `user`
<where>
`user`.del_flag = '0'
<if
test=
"query.
organId != null and query.organ
Id != ''"
>
and `user`.
organ_id = #{query.organ
Id}
<if
test=
"query.
deptId != null and query.dept
Id != ''"
>
and `user`.
dept_id = #{query.dept
Id}
</if>
<if
test=
"query.nickname != null and query.nickname != ''"
>
and `user`.nickname LIKE CONCAT('%',#{query.nickname},'%')
...
...
@@ -309,9 +309,6 @@
<if
test=
"query.username != null and query.username != ''"
>
and `user`.username LIKE CONCAT('%',#{query.username},'%')
</if>
<if
test=
"query.organCode != null and query.organCode != ''"
>
and `user`.organ_code LIKE CONCAT(#{query.organCode},'%')
</if>
<if
test=
"null != query.userIdsB and query.userIdsB.size > 0"
>
where b.user_id in
<foreach
collection=
"query.userIdsB"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
...
...
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