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
8d13ac95
Commit
8d13ac95
authored
Jun 08, 2022
by
huyuchen
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into develop
# Conflicts: # yifu-auth/src/main/resources/application.yml
parents
7c3cc077
d8e32a0e
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
295 additions
and
46 deletions
+295
-46
MenuTypeEnum.java
...plus.v1/yifu/common/core/constant/enums/MenuTypeEnum.java
+5
-0
ErrorCodes.java
....cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
+10
-0
messages_zh_CN.properties
...on-core/src/main/resources/i18n/messages_zh_CN.properties
+17
-14
UserDTO.java
...va/com/yifu.cloud.plus.v1/yifu/admin/api/dto/UserDTO.java
+0
-5
SysDictItem.java
...yifu.cloud.plus.v1/yifu/admin/api/entity/SysDictItem.java
+9
-0
SysMenu.java
...com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysMenu.java
+11
-0
SysUser.java
...com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysUser.java
+22
-0
UserVO.java
...java/com/yifu.cloud.plus.v1/yifu/admin/api/vo/UserVO.java
+14
-0
pom.xml
yifu-upms/yifu-upms-biz/pom.xml
+5
-0
DictController.java
...u.cloud.plus.v1/yifu/admin/controller/DictController.java
+12
-0
SysDictItemService.java
....cloud.plus.v1/yifu/admin/service/SysDictItemService.java
+10
-0
SysDictItemServiceImpl.java
...us.v1/yifu/admin/service/impl/SysDictItemServiceImpl.java
+62
-0
SysMenuServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysMenuServiceImpl.java
+5
-0
SysUserServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysUserServiceImpl.java
+10
-17
Swagger3Config.java
.../yifu/cloud/plus/v1/yifu/admin/config/Swagger3Config.java
+2
-0
application.yml
yifu-upms/yifu-upms-biz/src/main/resources/application.yml
+4
-3
SysMenuMapper.xml
...yifu-upms-biz/src/main/resources/mapper/SysMenuMapper.xml
+4
-0
SysUserMapper.xml
...yifu-upms-biz/src/main/resources/mapper/SysUserMapper.xml
+18
-3
pom.xml
yifu-visual/yifu-sentinel-dashboard/pom.xml
+11
-1
AuthController.java
...aba/csp/sentinel/dashboard/controller/AuthController.java
+64
-3
No files found.
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/constant/enums/MenuTypeEnum.java
View file @
8d13ac95
...
...
@@ -29,6 +29,11 @@ import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public
enum
MenuTypeEnum
{
/**
* 字典类型-系统内置(不可修改)
*/
SYSTEM
(
"0"
,
"系统内置"
),
/**
* 左侧菜单
*/
...
...
yifu-common/yifu-common-core/src/main/java/com/yifu.cloud.plus.v1/yifu/common/core/exception/ErrorCodes.java
View file @
8d13ac95
...
...
@@ -63,6 +63,11 @@ public interface ErrorCodes {
*/
String
SYS_ROLE_NAMEORCODE_EXISTING
=
"sys.role.nameOrCode.existing"
;
/**
* 系统内置菜单不允许删除
*/
String
SYS_MENU_DELETE_SYSTEM
=
"sys.menu.delete.system"
;
/**
* 菜单存在下级节点 删除失败
*/
...
...
@@ -88,4 +93,9 @@ public interface ErrorCodes {
*/
String
SYS_APP_PHONE_UNREGISTERED
=
"sys.app.phone.unregistered"
;
/**
* 字典存在下级节点 删除失败
*/
String
SYS_DICT_DELETE_EXISTING
=
"sys.dict.delete.existing"
;
}
yifu-common/yifu-common-core/src/main/resources/i18n/messages_zh_CN.properties
View file @
8d13ac95
sys.user.update.passwordError
=
\u
539
f
\u
5bc6
\u7801\u9519\u
8bef
\u
ff0c
\u
4fee
\u6539\u5931\u
8d
25
sys.user.query.error
=
\u
83
b7
\u
53d6
\u
5f53
\u
524d
\u7528\u6237\u
4fe1
\u
606f
\u5931\u
8d
25
sys.user.update.passwordError
=
\u
539
F
\u
5BC6
\u7801\u9519\u
8BEF
\u
FF0C
\u
4FEE
\u6539\u5931\u
8D
25
sys.user.query.error
=
\u
83
B7
\u
53D6
\u
5F53
\u
524D
\u7528\u6237\u
4FE1
\u
606F
\u5931\u
8D
25
sys.user.username.existing
=
{0}
\u7528\u6237\u
540D
\u
5DF2
\u
5B58
\u5728
sys.user.userInfo.empty
=
{0}
\u7528\u6237\u
4
fe1
\u
606f
\u
4e3a
\u
7a7a
sys.user.userInfo.empty
=
{0}
\u7528\u6237\u
4
FE1
\u
606F
\u
4E3A
\u
7A7A
sys.dept.deptName.inexistence
=
{0}
\u
90
e8
\u
95e8
\u
540d
\u
79f0
\u
4e0d
\u
5b
58
\u5728
sys.dept.deptName.inexistence
=
{0}
\u
90
E8
\u
95E8
\u
540D
\u
79F0
\u
4E0D
\u
5B
58
\u5728
sys.post.postName.inexistence
=
{0}
\u
5
c97
\u
4f4d
\u
540d
\u
79f0
\u
4e0d
\u
5b
58
\u5728
sys.post.nameOrCode.existing
=
{0} {1}
\u
5
c97
\u
4f4d
\u
540d
\u6216\u
5c97
\u
4f4d
\u
7f16
\u7801\u
5df2
\u
7ecf
\u
5b
58
\u5728
sys.post.postName.inexistence
=
{0}
\u
5
C97
\u
4F4D
\u
540D
\u
79F0
\u
4E0D
\u
5B
58
\u5728
sys.post.nameOrCode.existing
=
{0} {1}
\u
5
C97
\u
4F4D
\u
540D
\u6216\u
5C97
\u
4F4D
\u
7F16
\u7801\u
5DF2
\u
7ECF
\u
5B
58
\u5728
sys.role.roleName.inexistence
=
{0}
\u
89
d2
\u8272\u
540d
\u
79f0
\u
4e0d
\u
5b
58
\u5728
sys.role.nameOrCode.existing
=
{0} {1}
\u
89
d2
\u8272\u
540d
\u6216\u
89d2
\u8272\u
7f16
\u7801\u
5df2
\u
7ecf
\u
5b
58
\u5728
sys.role.roleName.inexistence
=
{0}
\u
89
D2
\u8272\u
540D
\u
79F0
\u
4E0D
\u
5B
58
\u5728
sys.role.nameOrCode.existing
=
{0} {1}
\u
89
D2
\u8272\u
540D
\u6216\u
89D2
\u8272\u
7F16
\u7801\u
5DF2
\u
7ECF
\u
5B
58
\u5728
sys.param.delete.system
=
\u
7
cfb
\u
7edf
\u5185\u
7f6e
\u
53c2
\u6570\u
4e0d
\u
80fd
\u5220\u9664
sys.param.delete.system
=
\u
7
CFB
\u
7EDF
\u5185\u
7F6E
\u
53C2
\u6570\u
4E0D
\u
80FD
\u5220\u9664
sys.param.config.error
=
{0}
\u
7CFB
\u
7EDF
\u
53C2
\u6570\u
914D
\u
7F6E
\u9519\u
8BEF
sys.menu.delete.existing
=
\u
83dc
\u5355\u
542b
\u6709\u
4e0b
\u
7ea7
\u
4e0d
\u
80fd
\u5220\u9664
sys.menu.delete.existing
=
\u
83DC
\u5355\u
542B
\u6709\u
4E0B
\u
7EA7
\u
4E0D
\u
80FD
\u5220\u9664
sys.menu.delete.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u
83DC
\u5355\u
4E0D
\u
80FD
\u5220\u9664
sys.app.sms.often
=
\u
9
a8c
\u
8bc1
\u7801\u
53d1
\u9001\u
8fc7
\u9891\u
7e
41
sys.app.phone.unregistered
=
{0}
\u
624
b
\u
673a
\u
53f7
\u
672a
\u
6ce8
\u
518c
sys.app.sms.often
=
\u
9
A8C
\u
8BC1
\u7801\u
53D1
\u9001\u
8FC7
\u9891\u
7E
41
sys.app.phone.unregistered
=
{0}
\u
624
B
\u
673A
\u
53F7
\u
672A
\u
6CE8
\u
518C
sys.dict.delete.system
=
\u
7cfb
\u
7edf
\u5185\u
7f6e
\u
5b57
\u5178\u9879\u
76ee
\u
4e0d
\u
80fd
\u5220\u9664
sys.dict.update.system
=
\u
7cfb
\u
7edf
\u5185\u
7f6e
\u
5b57
\u5178\u9879\u
76ee
\u
4e0d
\u
80fd
\u
4fee
\u6539
sys.dict.delete.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u
5B57
\u5178\u9879\u
76EE
\u
4E0D
\u
80FD
\u5220\u9664
sys.dict.update.system
=
\u
7CFB
\u
7EDF
\u5185\u
7F6E
\u
5B57
\u5178\u9879\u
76EE
\u
4E0D
\u
80FD
\u
4FEE
\u6539
sys.dict.delete.existing
=
\u
5B57
\u5178\u
5B58
\u5728\u
4E0B
\u
7EA7
\u8282\u
70B9
\u
4E0D
\u
80FD
\u5931\u
8D25
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/dto/UserDTO.java
View file @
8d13ac95
...
...
@@ -37,11 +37,6 @@ public class UserDTO extends SysUser {
private
Long
deptId
;
/**
* 岗位ID
*/
private
List
<
Long
>
post
;
/**
* 新密码
*/
...
...
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysDictItem.java
View file @
8d13ac95
...
...
@@ -23,6 +23,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
javax.validation.constraints.NotNull
;
/**
* 字典项
*
...
...
@@ -85,6 +87,13 @@ public class SysDictItem extends BaseEntity {
@Schema
(
description
=
"备注信息"
)
private
String
remark
;
/**
* 父节点ID
*/
@NotNull
(
message
=
"字典父节点ID不能为空"
)
@Schema
(
description
=
"字典父节点id"
)
private
Long
parentId
;
/**
* 删除标记
*/
...
...
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysMenu.java
View file @
8d13ac95
...
...
@@ -104,4 +104,15 @@ public class SysMenu extends BaseEntity {
@TableLogic
private
String
delFlag
;
/**
* 是否支持数据权限设置 (0是 1否)
*/
@Schema
(
description
=
"是否支持数据权限标识"
)
private
String
flag
;
/**
* 是否是系统内置
*/
@Schema
(
description
=
"是否系统内置"
)
private
String
systemFlag
;
}
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/entity/SysUser.java
View file @
8d13ac95
...
...
@@ -25,6 +25,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
javax.validation.constraints.NotNull
;
/**
* <p>
* 用户表
...
...
@@ -95,6 +97,26 @@ public class SysUser extends BaseEntity {
@Schema
(
description
=
"用户所属部门id"
)
private
Long
deptId
;
/**
* 用户分组
*/
@NotNull
(
message
=
"用户分组不能为空"
)
@Schema
(
description
=
"用户分组"
)
private
String
userGroup
;
/**
* 职务
*/
@Schema
(
description
=
"职务"
)
private
String
post
;
/**
* 邮箱
*/
@NotNull
(
message
=
"邮箱不能为空"
)
@Schema
(
description
=
"邮箱"
)
private
String
email
;
/**
* 0-正常,1-删除
*/
...
...
yifu-upms/yifu-upms-api/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/api/vo/UserVO.java
View file @
8d13ac95
...
...
@@ -108,4 +108,18 @@ public class UserVO implements Serializable {
*/
private
List
<
SysPost
>
postList
;
/**
* 用户分组
*/
private
String
userGroup
;
/**
* 职务
*/
private
String
post
;
/**
* 邮箱
*/
private
String
email
;
}
yifu-upms/yifu-upms-biz/pom.xml
View file @
8d13ac95
...
...
@@ -104,6 +104,11 @@
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-test
</artifactId>
</dependency>
<dependency>
<groupId>
io.swagger.core.v3
</groupId>
<artifactId>
swagger-models
</artifactId>
<version>
2.1.12
</version>
</dependency>
</dependencies>
<build>
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/controller/DictController.java
View file @
8d13ac95
...
...
@@ -16,6 +16,7 @@
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
admin
.
controller
;
import
cn.hutool.core.lang.tree.Tree
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
...
...
@@ -191,4 +192,15 @@ public class DictController {
return
R
.
ok
();
}
/**
* 返回树形字典集合
* @param lazy 是否是懒加载
* @param parentId 父节点ID
* @return 树形菜单
*/
@GetMapping
(
value
=
"/tree"
)
public
R
<
List
<
Tree
<
Long
>>>
getTree
(
boolean
lazy
,
Long
parentId
)
{
return
R
.
ok
(
sysDictItemService
.
treeMenu
(
lazy
,
parentId
));
}
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/SysDictItemService.java
View file @
8d13ac95
...
...
@@ -15,9 +15,12 @@
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
admin
.
service
;
import
cn.hutool.core.lang.tree.Tree
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDictItem
;
import
java.util.List
;
/**
* 字典项
*
...
...
@@ -40,4 +43,11 @@ public interface SysDictItemService extends IService<SysDictItem> {
*/
void
updateDictItem
(
SysDictItem
item
);
/**
* 构建树
* @param lazy 是否是懒加载
* @param parentId 父节点ID
* @return
*/
List
<
Tree
<
Long
>>
treeMenu
(
boolean
lazy
,
Long
parentId
);
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysDictItemServiceImpl.java
View file @
8d13ac95
...
...
@@ -15,6 +15,11 @@
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
admin
.
service
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.lang.tree.Tree
;
import
cn.hutool.core.lang.tree.TreeNode
;
import
cn.hutool.core.lang.tree.TreeUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDict
;
import
com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDictItem
;
...
...
@@ -22,6 +27,7 @@ import com.yifu.cloud.plus.v1.yifu.admin.mapper.SysDictItemMapper;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysDictItemService
;
import
com.yifu.cloud.plus.v1.yifu.admin.service.SysDictService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.enums.DictTypeEnum
;
import
com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.MsgUtils
;
...
...
@@ -30,6 +36,13 @@ import org.springframework.cache.annotation.CacheEvict;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.Assert
;
import
javax.validation.constraints.NotNull
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* 字典项
*
...
...
@@ -50,6 +63,9 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
@Override
@CacheEvict
(
value
=
CacheConstants
.
DICT_DETAILS
,
allEntries
=
true
)
public
void
removeDictItem
(
Long
id
)
{
// 查询父节点为当前节点的节点
List
<
SysDictItem
>
dictList
=
this
.
list
(
Wrappers
.<
SysDictItem
>
query
().
lambda
().
eq
(
SysDictItem:
:
getParentId
,
id
));
Assert
.
isTrue
(
CollUtil
.
isEmpty
(
dictList
),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_MENU_DELETE_EXISTING
));
// 根据ID查询字典ID
SysDictItem
dictItem
=
this
.
getById
(
id
);
SysDict
dict
=
dictService
.
getById
(
dictItem
.
getDictId
());
...
...
@@ -75,4 +91,50 @@ public class SysDictItemServiceImpl extends ServiceImpl<SysDictItemMapper, SysDi
this
.
updateById
(
item
);
}
/**
* 构建树查询 1. 不是懒加载情况,查询全部 2. 是懒加载,根据parentId 查询 2.1 父节点为空,则查询ID -1
* @param lazy 是否是懒加载
* @param parentId 父节点ID
* @return
*/
@Override
public
List
<
Tree
<
Long
>>
treeMenu
(
boolean
lazy
,
Long
parentId
)
{
if
(!
lazy
)
{
List
<
TreeNode
<
Long
>>
collect
=
baseMapper
.
selectList
(
Wrappers
.<
SysDictItem
>
lambdaQuery
().
orderByAsc
(
SysDictItem:
:
getSortOrder
)).
stream
()
.
map
(
getNodeFunction
()).
collect
(
Collectors
.
toList
());
return
TreeUtil
.
build
(
collect
,
CommonConstants
.
MENU_TREE_ROOT_ID
);
}
Long
parent
=
parentId
==
null
?
CommonConstants
.
MENU_TREE_ROOT_ID
:
parentId
;
List
<
TreeNode
<
Long
>>
collect
=
baseMapper
.
selectList
(
Wrappers
.<
SysDictItem
>
lambdaQuery
().
eq
(
SysDictItem:
:
getParentId
,
parent
)
.
orderByAsc
(
SysDictItem:
:
getSortOrder
))
.
stream
().
map
(
getNodeFunction
()).
collect
(
Collectors
.
toList
());
return
TreeUtil
.
build
(
collect
,
parent
);
}
@NotNull
private
Function
<
SysDictItem
,
TreeNode
<
Long
>>
getNodeFunction
()
{
return
sysDictItem
->
{
TreeNode
<
Long
>
node
=
new
TreeNode
<>();
node
.
setId
(
sysDictItem
.
getId
());
node
.
setName
(
sysDictItem
.
getLabel
());
node
.
setParentId
(
sysDictItem
.
getParentId
());
node
.
setWeight
(
sysDictItem
.
getSortOrder
());
// 扩展属性
Map
<
String
,
Object
>
extra
=
new
HashMap
<>();
extra
.
put
(
"value"
,
sysDictItem
.
getValue
());
extra
.
put
(
"dictId"
,
sysDictItem
.
getDictId
());
extra
.
put
(
"type"
,
sysDictItem
.
getType
());
extra
.
put
(
"label"
,
sysDictItem
.
getLabel
());
extra
.
put
(
"sortOrder"
,
sysDictItem
.
getSortOrder
());
node
.
setExtra
(
extra
);
return
node
;
};
}
}
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysMenuServiceImpl.java
View file @
8d13ac95
...
...
@@ -79,6 +79,11 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
Assert
.
isTrue
(
CollUtil
.
isEmpty
(
menuList
),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_MENU_DELETE_EXISTING
));
SysMenu
sysMenu
=
this
.
getById
(
id
);
// 系统内置
Assert
.
state
(!
MenuTypeEnum
.
SYSTEM
.
getType
().
equals
(
sysMenu
.
getSystemFlag
()),
MsgUtils
.
getMessage
(
ErrorCodes
.
SYS_MENU_DELETE_SYSTEM
));
sysRoleMenuMapper
.
delete
(
Wrappers
.<
SysRoleMenu
>
query
().
lambda
().
eq
(
SysRoleMenu:
:
getMenuId
,
id
));
// 删除当前菜单及其子菜单
return
this
.
removeById
(
id
);
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysUserServiceImpl.java
View file @
8d13ac95
...
...
@@ -97,14 +97,14 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return
userRole
;
}).
forEach
(
sysUserRoleMapper:
:
insert
);
// 保存用户岗位信息
Optional
.
ofNullable
(
userDto
.
getPost
()).
ifPresent
(
posts
->
{
posts
.
stream
().
map
(
postId
->
{
SysUserPost
userPost
=
new
SysUserPost
();
userPost
.
setUserId
(
sysUser
.
getUserId
());
userPost
.
setPostId
(
postId
);
return
userPost
;
}).
forEach
(
sysUserPostMapper:
:
insert
);
});
//
Optional.ofNullable(userDto.getPost()).ifPresent(posts -> {
//
posts.stream().map(postId -> {
//
SysUserPost userPost = new SysUserPost();
//
userPost.setUserId(sysUser.getUserId());
//
userPost.setPostId(postId);
//
return userPost;
//
}).forEach(sysUserPostMapper::insert);
//
});
return
Boolean
.
TRUE
;
}
...
...
@@ -215,13 +215,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
userRole
.
setRoleId
(
roleId
);
userRole
.
insert
();
});
sysUserPostMapper
.
delete
(
Wrappers
.<
SysUserPost
>
lambdaQuery
().
eq
(
SysUserPost:
:
getUserId
,
userDto
.
getUserId
()));
userDto
.
getPost
().
forEach
(
postId
->
{
SysUserPost
userPost
=
new
SysUserPost
();
userPost
.
setUserId
(
sysUser
.
getUserId
());
userPost
.
setPostId
(
postId
);
userPost
.
insert
();
});
return
Boolean
.
TRUE
;
}
...
...
@@ -361,8 +354,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
// 根据角色名称查询角色ID
List
<
Long
>
roleIdList
=
roleCollList
.
stream
().
map
(
SysRole:
:
getRoleId
).
collect
(
Collectors
.
toList
());
userDTO
.
setRole
(
roleIdList
);
List
<
Long
>
postIdList
=
postCollList
.
stream
().
map
(
SysPost:
:
getPostId
).
collect
(
Collectors
.
toList
());
userDTO
.
setPost
(
postIdList
);
//
List<Long> postIdList = postCollList.stream().map(SysPost::getPostId).collect(Collectors.toList());
//
userDTO.setPost(postIdList);
// 插入用户
this
.
saveUser
(
userDTO
);
}
...
...
yifu-upms/yifu-upms-biz/src/main/java/com/yifu/cloud/plus/v1/yifu/admin/config/Swagger3Config.java
View file @
8d13ac95
...
...
@@ -26,6 +26,8 @@ import io.swagger.v3.oas.annotations.security.SecurityScheme;
)
)
@SecurityScheme
(
type
=
SecuritySchemeType
.
HTTP
,
name
=
"JWT"
,
scheme
=
"bearer"
,
in
=
SecuritySchemeIn
.
HEADER
)
//@SecurityScheme(type = SecuritySchemeType.OAUTH2,flows = @OAuthFlow( implicit = @OAuthFlow(authorizationUrl = "http://yifu-auth/oauth/check_token",
// scopes = @OAuthScope(name = "write:pets", description = "modify pets in your account"))))
public
class
Swagger3Config
{
}
yifu-upms/yifu-upms-biz/src/main/resources/application.yml
View file @
8d13ac95
...
...
@@ -93,7 +93,8 @@ spring:
activate
:
on-profile
:
test
redis
:
host
:
127.0.0.1
host
:
192.168.1.65
port
:
22379
password
:
'
@yf_2017'
datasource
:
type
:
com.zaxxer.hikari.HikariDataSource
...
...
@@ -112,8 +113,8 @@ spring:
activate
:
on-profile
:
dev
redis
:
host
:
1
92.168.1.65
port
:
22
379
host
:
1
27.0.0.1
port
:
6
379
password
:
'
@yf_2017'
datasource
:
type
:
com.zaxxer.hikari.HikariDataSource
...
...
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysMenuMapper.xml
View file @
8d13ac95
...
...
@@ -33,6 +33,8 @@
<result
column=
"update_by"
property=
"updateBy"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"del_flag"
property=
"delFlag"
/>
<result
column=
"flag"
property=
"flag"
/>
<result
column=
"system_flag"
property=
"systemFlag"
/>
</resultMap>
<!--通过角色查询菜单信息-->
...
...
@@ -47,6 +49,8 @@
sys_menu.keep_alive,
sys_menu.type,
sys_menu.del_flag,
sys_menu.flag,
sys_menu.system_flag,
sys_menu.create_by,
sys_menu.create_time,
sys_menu.update_by,
...
...
yifu-upms/yifu-upms-biz/src/main/resources/mapper/SysUserMapper.xml
View file @
8d13ac95
...
...
@@ -32,12 +32,12 @@
<result
column=
"deptId"
property=
"deptId"
/>
<result
column=
"deptName"
property=
"deptName"
/>
<result
column=
"nickname"
property=
"nickname"
/>
<result
column=
"user_group"
property=
"userGroup"
/>
<result
column=
"post"
property=
"post"
/>
<result
column=
"email"
property=
"email"
/>
<collection
property=
"roleList"
ofType=
"com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole"
select=
"com.yifu.cloud.plus.v1.yifu.admin.mapper.SysRoleMapper.listRolesByUserId"
column=
"user_id"
>
</collection>
<collection
property=
"postList"
ofType=
"com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysPost"
select=
"com.yifu.cloud.plus.v1.yifu.admin.mapper.SysPostMapper.listPostsByUserId"
column=
"user_id"
>
</collection>
</resultMap>
<!-- userVo结果集 -->
...
...
@@ -55,6 +55,9 @@
<result
column=
"deptId"
property=
"deptId"
/>
<result
column=
"deptName"
property=
"deptName"
/>
<result
column=
"nickname"
property=
"nickname"
/>
<result
column=
"user_group"
property=
"userGroup"
/>
<result
column=
"post"
property=
"post"
/>
<result
column=
"email"
property=
"email"
/>
<collection
property=
"roleList"
ofType=
"com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRole"
>
<id
column=
"role_id"
property=
"roleId"
/>
<result
column=
"role_name"
property=
"roleName"
/>
...
...
@@ -79,6 +82,9 @@
sys_user.del_flag AS udel_flag,
sys_user.lock_flag AS lock_flag,
sys_user.dept_id AS deptId,
sys_user.user_group AS userGroup,
sys_user.post,
sys_user.email,
r.role_id,
r.role_name,
r.role_code,
...
...
@@ -99,6 +105,9 @@
sys_user.update_time AS uupdate_time,
sys_user.del_flag AS udel_flag,
sys_user.lock_flag AS lock_flag,
sys_user.user_group AS userGroup,
sys_user.post,
sys_user.email,
r.role_id,
r.role_name,
r.role_code,
...
...
@@ -141,6 +150,9 @@
sys_user.del_flag AS udel_flag,
sys_user.lock_flag AS lock_flag,
sys_user.dept_id AS deptId,
sys_user.user_group AS userGroup,
sys_user.post,
sys_user.email,
sys_dept.name AS deptName
FROM sys_user
LEFT JOIN sys_dept ON sys_dept.dept_id = sys_user.dept_id
...
...
@@ -167,6 +179,9 @@
u.update_time uupdate_time,
u.del_flag,
u.lock_flag,
u.group,
u.user_group userGroup,
u.email,
d.name AS deptName
FROM sys_user u
LEFT JOIN sys_dept d ON d.dept_id = u.dept_id
...
...
yifu-visual/yifu-sentinel-dashboard/pom.xml
View file @
8d13ac95
...
...
@@ -74,7 +74,17 @@
<artifactId>
httpcore-nio
</artifactId>
<version>
4.4.6
</version>
</dependency>
</dependencies>
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-core
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.security.oauth
</groupId>
<artifactId>
spring-security-oauth2
</artifactId>
<version>
2.3.5.RELEASE
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
<build>
<finalName>
yifu-sentinel-dashboard
</finalName>
...
...
yifu-visual/yifu-sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/controller/AuthController.java
View file @
8d13ac95
...
...
@@ -15,18 +15,30 @@
*/
package
com
.
alibaba
.
csp
.
sentinel
.
dashboard
.
controller
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.csp.sentinel.dashboard.auth.AuthService
;
import
com.alibaba.csp.sentinel.dashboard.auth.SimpleWebAuthServiceImpl
;
import
com.alibaba.csp.sentinel.dashboard.config.DashboardConfig
;
import
com.alibaba.csp.sentinel.dashboard.domain.Result
;
import
com.google.common.net.HttpHeaders
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.SpringContextHolder
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.cache.CacheManager
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.security.authentication.event.LogoutSuccessEvent
;
import
org.springframework.security.oauth2.common.OAuth2AccessToken
;
import
org.springframework.security.oauth2.common.OAuth2RefreshToken
;
import
org.springframework.security.oauth2.provider.ClientDetailsService
;
import
org.springframework.security.oauth2.provider.OAuth2Authentication
;
import
org.springframework.security.oauth2.provider.token.TokenStore
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -34,10 +46,19 @@ import javax.servlet.http.HttpServletRequest;
* @author cdfive
* @since 1.6.0
*/
@RequiredArgsConstructor
@RestController
@RequestMapping
(
"/auth"
)
public
class
AuthController
{
private
final
ClientDetailsService
clientDetailsService
;
private
final
TokenStore
tokenStore
;
private
final
RedisTemplate
redisTemplate
;
private
final
CacheManager
cacheManager
;
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
AuthController
.
class
);
@Value
(
"${auth.username:sentinel}"
)
...
...
@@ -91,4 +112,44 @@ public class AuthController {
return
Result
.
ofSuccess
(
authUser
);
}
/* *//**
* 退出并删除token
* @param authHeader Authorization
*//*
@DeleteMapping("/logout")
public R<Boolean> logout(@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authHeader) {
if (StrUtil.isBlank(authHeader)) {
return R.ok();
}
String tokenValue = authHeader.replace(OAuth2AccessToken.BEARER_TYPE, StrUtil.EMPTY).trim();
return removeToken(tokenValue);
}
*//**
* 令牌管理调用
* @param token token
*//*
@DeleteMapping("/{token}")
public R<Boolean> removeToken(@PathVariable("token") String token) {
OAuth2AccessToken accessToken = tokenStore.readAccessToken(token);
if (accessToken == null || StrUtil.isBlank(accessToken.getValue())) {
return R.ok();
}
OAuth2Authentication auth2Authentication = tokenStore.readAuthentication(accessToken);
// 清空用户信息
cacheManager.getCache(CacheConstants.USER_DETAILS).evict(auth2Authentication.getName());
// 清空access token
tokenStore.removeAccessToken(accessToken);
// 清空 refresh token
OAuth2RefreshToken refreshToken = accessToken.getRefreshToken();
tokenStore.removeRefreshToken(refreshToken);
// 处理自定义退出事件,保存相关日志
SpringContextHolder.publishEvent(new LogoutSuccessEvent(auth2Authentication));
return R.ok();
}*/
}
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