Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jeecg
jeecg-boot
提交
2bd8c559
J
jeecg-boot
项目概览
jeecg
/
jeecg-boot
上一次同步 3 年多
通知
865
Star
24375
Fork
84
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jeecg-boot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2bd8c559
编写于
7月 15, 2019
作者:
JEECG低代码平台
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化代码
上级
9c03c07e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
63 addition
and
17 deletion
+63
-17
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
...rg/jeecg/modules/system/controller/SysUserController.java
+63
-17
未找到文件。
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysUserController.java
浏览文件 @
2bd8c559
...
...
@@ -19,7 +19,9 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
import
org.apache.shiro.authz.annotation.RequiresRoles
;
import
org.jeecg.common.api.vo.Result
;
import
org.jeecg.common.constant.CommonConstant
;
import
org.jeecg.common.system.api.ISysBaseAPI
;
import
org.jeecg.common.system.query.QueryGenerator
;
import
org.jeecg.common.system.util.JwtUtil
;
import
org.jeecg.common.system.vo.LoginUser
;
import
org.jeecg.common.util.PasswordUtil
;
import
org.jeecg.common.util.RedisUtil
;
...
...
@@ -74,7 +76,9 @@ import lombok.extern.slf4j.Slf4j;
@RestController
@RequestMapping
(
"/sys/user"
)
public
class
SysUserController
{
@Autowired
private
ISysBaseAPI
sysBaseAPI
;
@Autowired
private
ISysUserService
sysUserService
;
...
...
@@ -94,7 +98,6 @@ public class SysUserController {
private
RedisUtil
redisUtil
;
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
//@RequiresPermissions("sys:user:list")
public
Result
<
IPage
<
SysUser
>>
queryPageList
(
SysUser
user
,
@RequestParam
(
name
=
"pageNo"
,
defaultValue
=
"1"
)
Integer
pageNo
,
@RequestParam
(
name
=
"pageSize"
,
defaultValue
=
"10"
)
Integer
pageSize
,
HttpServletRequest
req
)
{
Result
<
IPage
<
SysUser
>>
result
=
new
Result
<
IPage
<
SysUser
>>();
...
...
@@ -132,11 +135,12 @@ public class SysUserController {
}
@RequestMapping
(
value
=
"/edit"
,
method
=
RequestMethod
.
PUT
)
//
@RequiresPermissions("user:edit")
//
@RequiresPermissions("user:edit")
public
Result
<
SysUser
>
edit
(
@RequestBody
JSONObject
jsonObject
)
{
Result
<
SysUser
>
result
=
new
Result
<
SysUser
>();
try
{
SysUser
sysUser
=
sysUserService
.
getById
(
jsonObject
.
getString
(
"id"
));
sysBaseAPI
.
addLog
(
"编辑用户,id: "
+
jsonObject
.
getString
(
"id"
)
,
CommonConstant
.
LOG_TYPE_2
,
2
);
if
(
sysUser
==
null
)
{
result
.
error500
(
"未找到对应实体"
);
}
else
{
...
...
@@ -166,6 +170,7 @@ public class SysUserController {
// 定义SysUserDepart实体类的数据库查询LambdaQueryWrapper
LambdaQueryWrapper
<
SysUserDepart
>
query
=
new
LambdaQueryWrapper
<
SysUserDepart
>();
SysUser
sysUser
=
sysUserService
.
getById
(
id
);
sysBaseAPI
.
addLog
(
"删除用户,id: "
+
id
,
CommonConstant
.
LOG_TYPE_2
,
3
);
if
(
sysUser
==
null
)
{
result
.
error500
(
"未找到对应实体"
);
}
else
{
...
...
@@ -189,6 +194,7 @@ public class SysUserController {
// 定义SysUserDepart实体类的数据库查询对象LambdaQueryWrapper
LambdaQueryWrapper
<
SysUserDepart
>
query
=
new
LambdaQueryWrapper
<
SysUserDepart
>();
String
[]
idArry
=
ids
.
split
(
","
);
sysBaseAPI
.
addLog
(
"批量删除用户, id: "
+
idArry
.
toString
()
,
CommonConstant
.
LOG_TYPE_2
,
3
);
Result
<
SysUser
>
result
=
new
Result
<
SysUser
>();
if
(
ids
==
null
||
""
.
equals
(
ids
.
trim
()))
{
result
.
error500
(
"参数不识别!"
);
...
...
@@ -422,8 +428,8 @@ public class SysUserController {
* @param response
* @return
*/
@RequestMapping
(
value
=
"/importExcel"
,
method
=
RequestMethod
.
POST
)
@RequiresPermissions
(
"user:import"
)
@RequestMapping
(
value
=
"/importExcel"
,
method
=
RequestMethod
.
POST
)
public
Result
<?>
importExcel
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
MultipartHttpServletRequest
multipartRequest
=
(
MultipartHttpServletRequest
)
request
;
Map
<
String
,
MultipartFile
>
fileMap
=
multipartRequest
.
getFileMap
();
...
...
@@ -780,21 +786,25 @@ public class SysUserController {
String
username
=
sysUser
.
getUsername
();
Result
<
Map
<
String
,
Object
>>
result
=
new
Result
<
Map
<
String
,
Object
>>();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
if
(
oConvertUtils
.
isNotEmpty
(
phone
))
{
SysUser
userList
=
sysUserService
.
getUserByPhone
(
phone
);
map
.
put
(
"username"
,
userList
.
getUsername
());
map
.
put
(
"phone"
,
userList
.
getPhone
());
result
.
setSuccess
(
true
);
result
.
setResult
(
map
);
return
result
;
if
(
oConvertUtils
.
isNotEmpty
(
phone
))
{
SysUser
user
=
sysUserService
.
getUserByPhone
(
phone
);
if
(
user
!=
null
)
{
map
.
put
(
"username"
,
user
.
getUsername
());
map
.
put
(
"phone"
,
user
.
getPhone
());
result
.
setSuccess
(
true
);
result
.
setResult
(
map
);
return
result
;
}
}
if
(
oConvertUtils
.
isNotEmpty
(
username
))
{
SysUser
userList
=
sysUserService
.
getUserByName
(
username
);
map
.
put
(
"username"
,
userList
.
getUsername
());
map
.
put
(
"phone"
,
userList
.
getPhone
());
result
.
setSuccess
(
true
);
result
.
setResult
(
map
);
return
result
;
SysUser
user
=
sysUserService
.
getUserByName
(
username
);
if
(
user
!=
null
)
{
map
.
put
(
"username"
,
user
.
getUsername
());
map
.
put
(
"phone"
,
user
.
getPhone
());
result
.
setSuccess
(
true
);
result
.
setResult
(
map
);
return
result
;
}
}
result
.
setSuccess
(
false
);
result
.
setMessage
(
"验证失败"
);
...
...
@@ -857,4 +867,40 @@ public class SysUserController {
}
}
/**
* 根据TOKEN获取用户的部分信息(返回的数据是可供表单设计器使用的数据)
*
* @return
*/
@GetMapping
(
"/getUserSectionInfoByToken"
)
public
Result
<?>
getUserSectionInfoByToken
(
HttpServletRequest
request
,
@RequestParam
(
name
=
"token"
,
required
=
false
)
String
token
)
{
try
{
String
username
=
null
;
// 如果没有传递token,就从header中获取token并获取用户信息
if
(
oConvertUtils
.
isEmpty
(
token
))
{
username
=
JwtUtil
.
getUserNameByToken
(
request
);
}
else
{
username
=
JwtUtil
.
getUsername
(
token
);
}
log
.
info
(
" ------ 通过令牌获取部分用户信息,当前用户: "
+
username
);
// 根据用户名查询用户信息
SysUser
sysUser
=
sysUserService
.
getUserByName
(
username
);
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"sysUserId"
,
sysUser
.
getId
());
map
.
put
(
"sysUserCode"
,
sysUser
.
getUsername
());
// 当前登录用户登录账号
map
.
put
(
"sysUserName"
,
sysUser
.
getRealname
());
// 当前登录用户真实名称
map
.
put
(
"sysOrgCode"
,
sysUser
.
getOrgCode
());
// 当前登录用户部门编号
log
.
info
(
" ------ 通过令牌获取部分用户信息,已获取的用户信息: "
+
map
);
return
Result
.
ok
(
map
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
return
Result
.
error
(
500
,
"查询失败:"
+
e
.
getMessage
());
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录