Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
a22110a9
提交
a22110a9
authored
3月 06, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'gwj' 到 'master'
Gwj 查看合并请求
!18
上级
cb50340c
640e88b5
流水线
#24
已取消 于阶段
变更
5
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
74 行增加
和
2 行删除
+74
-2
PasUserDao.java
...as/src/main/java/com/zjty/tynotes/pas/dao/PasUserDao.java
+1
-0
Department.java
...src/main/java/com/zjty/tynotes/pas/entity/Department.java
+3
-0
UserManageController.java
...notes/weekly/subject/controller/UserManageController.java
+29
-1
UserManageService.java
...jty/tynotes/weekly/subject/service/UserManageService.java
+16
-0
UserManageServiceImpl.java
...es/weekly/subject/service/impl/UserManageServiceImpl.java
+25
-1
没有找到文件。
notes-pas/src/main/java/com/zjty/tynotes/pas/dao/PasUserDao.java
浏览文件 @
a22110a9
...
...
@@ -89,4 +89,5 @@ public interface PasUserDao extends MongoRepository<User, String> {
List
<
User
>
findAllByDepartmentIdIn
(
List
<
String
>
departmentIds
);
}
notes-pas/src/main/java/com/zjty/tynotes/pas/entity/Department.java
浏览文件 @
a22110a9
...
...
@@ -32,6 +32,9 @@ public class Department {
@NotNull
(
message
=
"部门等级不可为空"
)
String
level
;
@ApiModelProperty
(
value
=
"部门描述"
,
example
=
"1"
)
String
description
;
@ApiModelProperty
(
value
=
"上级部门id"
,
example
=
"1"
)
String
parentId
;
...
...
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/controller/UserManageController.java
浏览文件 @
a22110a9
...
...
@@ -8,9 +8,12 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
javax.validation.constraints.NotNull
;
import
static
org
.
springframework
.
http
.
ResponseEntity
.
ok
;
...
...
@@ -29,7 +32,7 @@ public class UserManageController {
@ApiOperation
(
value
=
"根据id查询用户"
,
response
=
User
.
class
)
@GetMapping
(
"/findUser/{id}"
)
public
ResponseEntity
ad
dUser
(
@RequestBody
@Valid
String
id
)
{
public
ResponseEntity
fin
dUser
(
@RequestBody
@Valid
String
id
)
{
return
ok
(
userManageService
.
findUserById
(
id
));
}
...
...
@@ -53,4 +56,29 @@ public class UserManageController {
// return ok(userManageService.findUserWork(id,status));
// }
@ApiOperation
(
value
=
"更新当前用户自身信息"
)
@PutMapping
(
"/updateSelf"
)
public
ResponseEntity
updateSelf
(
@RequestBody
@NotNull
User
user
){
User
userById
=
userManageService
.
findUserById
(
user
.
getId
());
boolean
b
=
userManageService
.
updateSelf
(
user
,
userById
);
if
(
b
){
return
ok
(
"更改密码成功"
);
}
return
ok
(
"更改密码失败"
);
}
@ApiOperation
(
value
=
"更新当前用户密码"
)
@PutMapping
(
"/password"
)
public
ResponseEntity
updatePassword
(
@RequestBody
@NotNull
User
user
){
Authentication
authentication
=
SecurityContextHolder
.
getContext
().
getAuthentication
();
User
principal
=
(
User
)
authentication
.
getPrincipal
();
User
userByUsername
=
userManageService
.
findfindUserByUsername
(
principal
.
getUsername
());
userByUsername
.
setPassword
(
user
.
getPassword
());
boolean
b
=
userManageService
.
updatePas
(
userByUsername
);
if
(
b
){
return
ok
(
"更改密码成功"
);
}
return
ok
(
"更改密码失败"
);
}
}
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/service/UserManageService.java
浏览文件 @
a22110a9
...
...
@@ -34,6 +34,22 @@ public interface UserManageService {
*/
List
<
Department
>
findDepartmentList
(
String
id
);
boolean
updatePas
(
User
user
);
/**
* 根据用户名查询用户
* @param username
* @return
*/
User
findfindUserByUsername
(
String
username
);
/**
* 修改用户自身信息
* @param userById
* @return
*/
boolean
updateSelf
(
User
user
,
User
userById
);
// /**
// * 根据任务状态查询人员任务列表
// * @param id
...
...
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/service/impl/UserManageServiceImpl.java
浏览文件 @
a22110a9
...
...
@@ -11,6 +11,7 @@ import com.zjty.tynotes.pas.entity.vo.PageResponse;
import
com.zjty.tynotes.weekly.subject.entity.vo.UserVo
;
import
com.zjty.tynotes.weekly.subject.service.UserManageService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
...
...
@@ -21,7 +22,8 @@ import java.util.*;
*/
@Service
public
class
UserManageServiceImpl
implements
UserManageService
{
@Autowired
private
BCryptPasswordEncoder
bCryptPasswordEncoder
;
@Autowired
private
PasUserDao
pasUserDao
;
@Autowired
...
...
@@ -162,6 +164,28 @@ public class UserManageServiceImpl implements UserManageService {
}
@Override
public
boolean
updatePas
(
User
user
)
{
String
encode
=
bCryptPasswordEncoder
.
encode
(
user
.
getPassword
());
user
.
setPassword
(
encode
);
pasUserDao
.
save
(
user
);
return
true
;
}
@Override
public
User
findfindUserByUsername
(
String
username
)
{
return
pasUserDao
.
findByUsername
(
username
);
}
@Override
public
boolean
updateSelf
(
User
user
,
User
userById
)
{
userById
.
setPhone1
(
user
.
getPhone1
());
userById
.
setPhone2
(
user
.
getPhone2
());
userById
.
setEmail
(
user
.
getEmail
());
userById
.
setAddress
(
user
.
getAddress
());
return
false
;
}
private
List
<
Department
>
findDepartmentList
(
List
<
Department
>
des
,
List
<
Department
>
deps
){
for
(
Department
department
:
deps
)
{
if
(!
des
.
contains
(
department
)){
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论