Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
db383a16
Commit
db383a16
authored
Dec 24, 2018
by
fengshuonan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更改注释
parent
2a07f3ec
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
9 deletions
+79
-9
src/main/java/cn/stylefeng/guns/modular/system/controller/UserMgrController.java
+61
-9
src/main/java/cn/stylefeng/guns/modular/system/service/UserService.java
+18
-0
No files found.
src/main/java/cn/stylefeng/guns/modular/system/controller/UserMgrController.java
View file @
db383a16
...
...
@@ -39,7 +39,6 @@ import cn.stylefeng.roses.core.reqres.response.ResponseData;
import
cn.stylefeng.roses.core.util.ToolUtil
;
import
cn.stylefeng.roses.kernel.model.exception.RequestEmptyException
;
import
cn.stylefeng.roses.kernel.model.exception.ServiceException
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
...
...
@@ -74,6 +73,9 @@ public class UserMgrController extends BaseController {
/**
* 跳转到查看管理员列表的页面
*
* @author fengshuonan
* @Date 2018/12/24 22:43
*/
@RequestMapping
(
""
)
public
String
index
()
{
...
...
@@ -82,6 +84,9 @@ public class UserMgrController extends BaseController {
/**
* 跳转到查看管理员列表的页面
*
* @author fengshuonan
* @Date 2018/12/24 22:43
*/
@RequestMapping
(
"/user_add"
)
public
String
addView
()
{
...
...
@@ -90,6 +95,9 @@ public class UserMgrController extends BaseController {
/**
* 跳转到角色分配页面
*
* @author fengshuonan
* @Date 2018/12/24 22:43
*/
@Permission
@RequestMapping
(
"/role_assign"
)
...
...
@@ -97,14 +105,15 @@ public class UserMgrController extends BaseController {
if
(
ToolUtil
.
isEmpty
(
userId
))
{
throw
new
ServiceException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
User
user
=
this
.
userService
.
selectOne
(
new
EntityWrapper
<
User
>().
eq
(
"USER_ID"
,
userId
));
model
.
addAttribute
(
"userId"
,
userId
);
model
.
addAttribute
(
"userAccount"
,
user
.
getAccount
());
return
PREFIX
+
"user_roleassign.html"
;
}
/**
* 跳转到编辑管理员页面
*
* @author fengshuonan
* @Date 2018/12/24 22:43
*/
@Permission
@RequestMapping
(
"/user_edit"
)
...
...
@@ -119,14 +128,15 @@ public class UserMgrController extends BaseController {
/**
* 跳转到查看用户详情页面
*
* @author fengshuonan
* @Date 2018/12/24 22:43
*/
@RequestMapping
(
"/user_info"
)
public
String
userInfo
(
Model
model
)
{
Long
userId
=
ShiroKit
.
getUser
().
getId
();
if
(
ToolUtil
.
isEmpty
(
userId
))
{
throw
new
ServiceException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
Long
userId
=
ShiroKit
.
getUserNotNull
().
getId
();
User
user
=
this
.
userService
.
selectById
(
userId
);
model
.
addAllAttributes
(
BeanUtil
.
beanToMap
(
user
));
model
.
addAttribute
(
"roleName"
,
ConstantFactory
.
me
().
getRoleName
(
user
.
getRoleId
()));
model
.
addAttribute
(
"deptName"
,
ConstantFactory
.
me
().
getDeptName
(
user
.
getDeptId
()));
...
...
@@ -136,6 +146,9 @@ public class UserMgrController extends BaseController {
/**
* 跳转到修改密码界面
*
* @author fengshuonan
* @Date 2018/12/24 22:43
*/
@RequestMapping
(
"/user_chpwd"
)
public
String
chPwd
()
{
...
...
@@ -144,6 +157,9 @@ public class UserMgrController extends BaseController {
/**
* 获取用户详情
*
* @author fengshuonan
* @Date 2018/12/24 22:43
*/
@RequestMapping
(
"/getUserInfo"
)
@ResponseBody
...
...
@@ -165,6 +181,9 @@ public class UserMgrController extends BaseController {
/**
* 修改当前用户的密码
*
* @author fengshuonan
* @Date 2018/12/24 22:43
*/
@RequestMapping
(
"/changePwd"
)
@ResponseBody
...
...
@@ -172,7 +191,7 @@ public class UserMgrController extends BaseController {
if
(
ToolUtil
.
isOneEmpty
(
oldPassword
,
newPassword
))
{
throw
new
RequestEmptyException
();
}
Long
userId
=
ShiroKit
.
getUser
().
getId
();
Long
userId
=
ShiroKit
.
getUser
NotNull
().
getId
();
User
user
=
userService
.
selectById
(
userId
);
String
oldMd5
=
ShiroKit
.
md5
(
oldPassword
,
user
.
getSalt
());
if
(
user
.
getPassword
().
equals
(
oldMd5
))
{
...
...
@@ -187,6 +206,9 @@ public class UserMgrController extends BaseController {
/**
* 查询管理员列表
*
* @author fengshuonan
* @Date 2018/12/24 22:43
*/
@RequestMapping
(
"/list"
)
@Permission
...
...
@@ -217,6 +239,9 @@ public class UserMgrController extends BaseController {
/**
* 添加管理员
*
* @author fengshuonan
* @Date 2018/12/24 22:44
*/
@RequestMapping
(
"/add"
)
@BussinessLog
(
value
=
"添加管理员"
,
key
=
"account"
,
dict
=
UserDict
.
class
)
...
...
@@ -243,6 +268,9 @@ public class UserMgrController extends BaseController {
/**
* 修改管理员
*
* @author fengshuonan
* @Date 2018/12/24 22:44
*/
@RequestMapping
(
"/edit"
)
@BussinessLog
(
value
=
"修改管理员"
,
key
=
"account"
,
dict
=
UserDict
.
class
)
...
...
@@ -259,7 +287,7 @@ public class UserMgrController extends BaseController {
return
SUCCESS_TIP
;
}
else
{
assertAuth
(
user
.
getUserId
());
ShiroUser
shiroUser
=
ShiroKit
.
getUser
();
ShiroUser
shiroUser
=
ShiroKit
.
getUser
NotNull
();
if
(
shiroUser
.
getId
().
equals
(
user
.
getUserId
()))
{
this
.
userService
.
updateById
(
UserFactory
.
editUser
(
user
,
oldUser
));
return
SUCCESS_TIP
;
...
...
@@ -271,6 +299,9 @@ public class UserMgrController extends BaseController {
/**
* 删除管理员(逻辑删除)
*
* @author fengshuonan
* @Date 2018/12/24 22:44
*/
@RequestMapping
(
"/delete"
)
@BussinessLog
(
value
=
"删除管理员"
,
key
=
"userId"
,
dict
=
UserDict
.
class
)
...
...
@@ -291,6 +322,9 @@ public class UserMgrController extends BaseController {
/**
* 查看管理员详情
*
* @author fengshuonan
* @Date 2018/12/24 22:44
*/
@RequestMapping
(
"/view/{userId}"
)
@ResponseBody
...
...
@@ -304,6 +338,9 @@ public class UserMgrController extends BaseController {
/**
* 重置管理员的密码
*
* @author fengshuonan
* @Date 2018/12/24 22:44
*/
@RequestMapping
(
"/reset"
)
@BussinessLog
(
value
=
"重置管理员密码"
,
key
=
"userId"
,
dict
=
UserDict
.
class
)
...
...
@@ -323,6 +360,9 @@ public class UserMgrController extends BaseController {
/**
* 冻结用户
*
* @author fengshuonan
* @Date 2018/12/24 22:44
*/
@RequestMapping
(
"/freeze"
)
@BussinessLog
(
value
=
"冻结用户"
,
key
=
"userId"
,
dict
=
UserDict
.
class
)
...
...
@@ -343,6 +383,9 @@ public class UserMgrController extends BaseController {
/**
* 解除冻结用户
*
* @author fengshuonan
* @Date 2018/12/24 22:44
*/
@RequestMapping
(
"/unfreeze"
)
@BussinessLog
(
value
=
"解除冻结用户"
,
key
=
"userId"
,
dict
=
UserDict
.
class
)
...
...
@@ -359,6 +402,9 @@ public class UserMgrController extends BaseController {
/**
* 分配角色
*
* @author fengshuonan
* @Date 2018/12/24 22:44
*/
@RequestMapping
(
"/setRole"
)
@BussinessLog
(
value
=
"分配角色"
,
key
=
"userId,roleIds"
,
dict
=
UserDict
.
class
)
...
...
@@ -379,6 +425,9 @@ public class UserMgrController extends BaseController {
/**
* 上传图片
*
* @author fengshuonan
* @Date 2018/12/24 22:44
*/
@RequestMapping
(
method
=
RequestMethod
.
POST
,
path
=
"/upload"
)
@ResponseBody
...
...
@@ -396,6 +445,9 @@ public class UserMgrController extends BaseController {
/**
* 判断当前登录的用户是否有操作这个用户的权限
*
* @author fengshuonan
* @Date 2018/12/24 22:44
*/
private
void
assertAuth
(
Long
userId
)
{
if
(
ShiroKit
.
isAdmin
())
{
...
...
src/main/java/cn/stylefeng/guns/modular/system/service/UserService.java
View file @
db383a16
...
...
@@ -29,6 +29,9 @@ public class UserService extends ServiceImpl<UserMapper, User> {
/**
* 修改用户状态
*
* @author fengshuonan
* @Date 2018/12/24 22:45
*/
public
int
setStatus
(
Long
userId
,
String
status
)
{
return
this
.
baseMapper
.
setStatus
(
userId
,
status
);
...
...
@@ -36,6 +39,9 @@ public class UserService extends ServiceImpl<UserMapper, User> {
/**
* 修改密码
*
* @author fengshuonan
* @Date 2018/12/24 22:45
*/
public
int
changePwd
(
Long
userId
,
String
pwd
)
{
return
this
.
baseMapper
.
changePwd
(
userId
,
pwd
);
...
...
@@ -43,6 +49,9 @@ public class UserService extends ServiceImpl<UserMapper, User> {
/**
* 根据条件查询用户列表
*
* @author fengshuonan
* @Date 2018/12/24 22:45
*/
public
List
<
Map
<
String
,
Object
>>
selectUsers
(
DataScope
dataScope
,
String
name
,
String
beginTime
,
String
endTime
,
Long
deptId
)
{
return
this
.
baseMapper
.
selectUsers
(
dataScope
,
name
,
beginTime
,
endTime
,
deptId
);
...
...
@@ -50,6 +59,9 @@ public class UserService extends ServiceImpl<UserMapper, User> {
/**
* 设置用户的角色
*
* @author fengshuonan
* @Date 2018/12/24 22:45
*/
public
int
setRoles
(
Long
userId
,
String
roleIds
)
{
return
this
.
baseMapper
.
setRoles
(
userId
,
roleIds
);
...
...
@@ -57,6 +69,9 @@ public class UserService extends ServiceImpl<UserMapper, User> {
/**
* 通过账号获取用户
*
* @author fengshuonan
* @Date 2018/12/24 22:46
*/
public
User
getByAccount
(
String
account
)
{
return
this
.
baseMapper
.
getByAccount
(
account
);
...
...
@@ -64,6 +79,9 @@ public class UserService extends ServiceImpl<UserMapper, User> {
/**
* 获取用户菜单列表
*
* @author fengshuonan
* @Date 2018/12/24 22:46
*/
public
List
<
MenuNode
>
getUserMenuNodes
(
List
<
Long
>
roleList
)
{
if
(
roleList
==
null
||
roleList
.
size
()
==
0
)
{
...
...
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