Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
notes2.0
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zjm
notes2.0
Commits
0a7c06a8
提交
0a7c06a8
authored
4月 24, 2020
作者:
gongwenjie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
log
上级
daf1ee60
隐藏空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
621 行增加
和
58 行删除
+621
-58
WorkController.java
...com/zjty/tynotes/job/basic/controller/WorkController.java
+18
-10
ControllerAspect.java
...va/com/zjty/tynotes/log/base/aspect/ControllerAspect.java
+8
-3
LogDao.java
notes-log/src/main/java/com/zjty/tynotes/log/dao/LogDao.java
+1
-0
LogServiceImpl.java
...java/com/zjty/tynotes/log/server/impl/LogServiceImpl.java
+7
-3
ResponseCode.java
...java/com/zjty/tynotes/pas/base/response/ResponseCode.java
+119
-0
ServerResponse.java
...va/com/zjty/tynotes/pas/base/response/ServerResponse.java
+177
-0
SecurityConfig.java
...main/java/com/zjty/tynotes/pas/config/SecurityConfig.java
+1
-0
MySuccessHandler.java
...com/zjty/tynotes/pas/config/handler/MySuccessHandler.java
+2
-0
ExcelController.java
...java/com/zjty/tynotes/pas/controller/ExcelController.java
+86
-0
UserController.java
.../java/com/zjty/tynotes/pas/controller/UserController.java
+1
-0
ImportUserExcel.java
.../java/com/zjty/tynotes/pas/entity/vo/ImportUserExcel.java
+31
-0
UserServiceImpl.java
...va/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
+16
-0
pom.xml
notes-union/pom.xml
+22
-22
UnionApplication.java
...rc/main/java/com/zjty/tynotes/union/UnionApplication.java
+7
-5
application.properties
notes-union/src/main/resources/application.properties
+3
-3
pom.xml
notes-weekly/pom.xml
+11
-0
WeeklyApplication.java
.../main/java/com/zjty/tynotes/weekly/WeeklyApplication.java
+3
-1
UserManageController.java
...notes/weekly/subject/controller/UserManageController.java
+41
-10
SimpleUserVo.java
...m/zjty/tynotes/weekly/subject/entity/vo/SimpleUserVo.java
+40
-0
UserVo.java
...ava/com/zjty/tynotes/weekly/subject/entity/vo/UserVo.java
+1
-1
UserManageService.java
...jty/tynotes/weekly/subject/service/UserManageService.java
+7
-0
UserManageServiceImpl.java
...es/weekly/subject/service/impl/UserManageServiceImpl.java
+19
-0
没有找到文件。
notes-job/src/main/java/com/zjty/tynotes/job/basic/controller/WorkController.java
浏览文件 @
0a7c06a8
...
@@ -107,10 +107,12 @@ public class WorkController {
...
@@ -107,10 +107,12 @@ public class WorkController {
@RequestParam
String
userId
,
@RequestParam
String
userId
,
@RequestParam
int
workloadCount
,
@RequestParam
int
workloadCount
,
@RequestParam
String
msg
)
{
@RequestParam
String
msg
)
{
Work
work
=
workService
.
findById
(
workId
);
workService
.
deleteWork
(
workId
,
personalWorkload
,
workloadCount
);
workService
.
deleteWork
(
workId
,
personalWorkload
,
workloadCount
);
businessTreeManagement
.
saveAction
(
userId
,
workId
,
Action
.
DELETE_WORK
,
new
Date
(),
msg
);
businessTreeManagement
.
saveAction
(
userId
,
workId
,
Action
.
DELETE_WORK
,
new
Date
(),
msg
);
logService
.
saveLog
(
new
Log
(
null
,
"删除任务"
,
new
Date
(),
userId
,
null
));
if
(
work
!=
null
){
logService
.
saveLog
(
new
Log
(
null
,
"删除任务"
+
work
.
getTitle
(),
new
Date
(),
userId
,
null
));
}
return
ok
(
new
JobResponse
(
workId
));
return
ok
(
new
JobResponse
(
workId
));
}
}
...
@@ -127,10 +129,12 @@ public class WorkController {
...
@@ -127,10 +129,12 @@ public class WorkController {
@PutMapping
(
value
=
"/upDate/Workload"
)
@PutMapping
(
value
=
"/upDate/Workload"
)
@ApiOperation
(
value
=
"修改任务的工作量、考评系数."
)
@ApiOperation
(
value
=
"修改任务的工作量、考评系数."
)
public
ResponseEntity
<
JobResponse
>
updateWorkload
(
@RequestBody
UpdateWorkload
updateWorkload
)
{
public
ResponseEntity
<
JobResponse
>
updateWorkload
(
@RequestBody
UpdateWorkload
updateWorkload
)
{
Work
work
=
workService
.
findById
(
updateWorkload
.
getWorkId
());
workService
.
updateWorkload
(
updateWorkload
.
getWorkId
(),
updateWorkload
.
getWorkload
(),
updateWorkload
.
getWorkCoefficient
());
workService
.
updateWorkload
(
updateWorkload
.
getWorkId
(),
updateWorkload
.
getWorkload
(),
updateWorkload
.
getWorkCoefficient
());
businessTreeManagement
.
saveAction
(
updateWorkload
.
getUserId
(),
updateWorkload
.
getWorkId
(),
Action
.
UPDATE_WORKLOAD
,
new
Date
(),
updateWorkload
.
getMsg
());
businessTreeManagement
.
saveAction
(
updateWorkload
.
getUserId
(),
updateWorkload
.
getWorkId
(),
Action
.
UPDATE_WORKLOAD
,
new
Date
(),
updateWorkload
.
getMsg
());
logService
.
saveLog
(
new
Log
(
null
,
"修改任务的工作量"
,
new
Date
(),
updateWorkload
.
getUserId
(),
null
));
if
(
work
!=
null
){
logService
.
saveLog
(
new
Log
(
null
,
"修改"
+
work
.
getTitle
()
+
"任务的工作量"
,
new
Date
(),
updateWorkload
.
getUserId
(),
null
));
}
return
ok
(
new
JobResponse
(
updateWorkload
.
getWorkId
()));
return
ok
(
new
JobResponse
(
updateWorkload
.
getWorkId
()));
}
}
...
@@ -148,7 +152,11 @@ public class WorkController {
...
@@ -148,7 +152,11 @@ public class WorkController {
@RequestParam
String
status
,
@RequestParam
String
status
,
@RequestParam
String
msg
,
@RequestParam
String
msg
,
@RequestParam
String
re
)
{
@RequestParam
String
re
)
{
Work
workServiceById
=
workService
.
findById
(
workId
);
String
title
=
null
;
if
(
workServiceById
!=
null
){
title
=
workServiceById
.
getTitle
();
}
switch
(
status
)
{
switch
(
status
)
{
case
"ongoing"
:
case
"ongoing"
:
Work
work
=
workService
.
findById
(
workId
);
Work
work
=
workService
.
findById
(
workId
);
...
@@ -157,30 +165,30 @@ public class WorkController {
...
@@ -157,30 +165,30 @@ public class WorkController {
//撤回
//撤回
workService
.
alterTaskStatus1
(
workId
,
status
,
userId
);
workService
.
alterTaskStatus1
(
workId
,
status
,
userId
);
businessTreeManagement
.
saveAction
(
userId
,
workId
,
Action
.
COMMIT_BACK_WORK
,
new
Date
(),
msg
);
businessTreeManagement
.
saveAction
(
userId
,
workId
,
Action
.
COMMIT_BACK_WORK
,
new
Date
(),
msg
);
logService
.
saveLog
(
new
Log
(
null
,
"撤回任务"
,
new
Date
(),
userId
,
null
));
logService
.
saveLog
(
new
Log
(
null
,
"撤回任务"
+
title
,
new
Date
(),
userId
,
null
));
}
else
{
}
else
{
workService
.
alterTaskStatus
(
workId
,
status
,
userId
);
workService
.
alterTaskStatus
(
workId
,
status
,
userId
);
businessTreeManagement
.
saveAction
(
userId
,
workId
,
Action
.
BACK_WORK
,
new
Date
(),
msg
);
businessTreeManagement
.
saveAction
(
userId
,
workId
,
Action
.
BACK_WORK
,
new
Date
(),
msg
);
//审核不通过
//审核不通过
logService
.
saveLog
(
new
Log
(
null
,
"审核任务"
,
new
Date
(),
userId
,
null
));
logService
.
saveLog
(
new
Log
(
null
,
"审核任务"
+
title
,
new
Date
(),
userId
,
null
));
}
}
break
;
break
;
case
"audit"
:
case
"audit"
:
//执行者提交
//执行者提交
workService
.
alterTaskStatus
(
workId
,
status
,
userId
);
workService
.
alterTaskStatus
(
workId
,
status
,
userId
);
businessTreeManagement
.
saveAction
(
userId
,
workId
,
Action
.
COMMIT_WORK
,
new
Date
(),
msg
);
businessTreeManagement
.
saveAction
(
userId
,
workId
,
Action
.
COMMIT_WORK
,
new
Date
(),
msg
);
logService
.
saveLog
(
new
Log
(
null
,
"提交任务"
,
new
Date
(),
userId
,
null
));
logService
.
saveLog
(
new
Log
(
null
,
"提交任务"
+
title
,
new
Date
(),
userId
,
null
));
break
;
break
;
case
"review"
:
case
"review"
:
//审核通过
//审核通过
workService
.
alterTaskStatus
(
workId
,
status
,
userId
);
workService
.
alterTaskStatus
(
workId
,
status
,
userId
);
businessTreeManagement
.
saveAction
(
userId
,
workId
,
Action
.
FINISH_WORK
,
new
Date
(),
msg
);
businessTreeManagement
.
saveAction
(
userId
,
workId
,
Action
.
FINISH_WORK
,
new
Date
(),
msg
);
logService
.
saveLog
(
new
Log
(
null
,
"审核任务"
,
new
Date
(),
userId
,
null
));
logService
.
saveLog
(
new
Log
(
null
,
"审核任务"
+
title
,
new
Date
(),
userId
,
null
));
break
;
break
;
case
WorkStatus
.
FINISHED
:
case
WorkStatus
.
FINISHED
:
workService
.
alterTaskStatus
(
workId
,
status
,
userId
);
workService
.
alterTaskStatus
(
workId
,
status
,
userId
);
businessTreeManagement
.
saveAction
(
userId
,
workId
,
Action
.
FINISHED_WORK
,
new
Date
(),
msg
);
businessTreeManagement
.
saveAction
(
userId
,
workId
,
Action
.
FINISHED_WORK
,
new
Date
(),
msg
);
logService
.
saveLog
(
new
Log
(
null
,
"完结任务"
,
new
Date
(),
userId
,
null
));
logService
.
saveLog
(
new
Log
(
null
,
"完结任务"
+
title
,
new
Date
(),
userId
,
null
));
break
;
break
;
default
:
default
:
log
.
warn
(
"[job] 修改任务状态传入的参数有误,传入值为:{}"
,
status
);
log
.
warn
(
"[job] 修改任务状态传入的参数有误,传入值为:{}"
,
status
);
...
...
notes-log/src/main/java/com/zjty/tynotes/log/base/aspect/ControllerAspect.java
浏览文件 @
0a7c06a8
...
@@ -54,6 +54,9 @@ public class ControllerAspect {
...
@@ -54,6 +54,9 @@ public class ControllerAspect {
@Pointcut
(
"execution(public * com.zjty.tynotes.attendance.controller.*.*(..))"
)
@Pointcut
(
"execution(public * com.zjty.tynotes.attendance.controller.*.*(..))"
)
public
void
privilege3
(){}
public
void
privilege3
(){}
@Pointcut
(
"execution(public * com.zjty.tynotes.pas.config.handler.MySuccessHandler.onAuthenticationSuccess(..))"
)
public
void
privilege4
(){}
// @Pointcut("execution(public * com.zjty.tynotes.weekly.subject.controller.*.*(..))")
// @Pointcut("execution(public * com.zjty.tynotes.weekly.subject.controller.*.*(..))")
// public void privilege4(){}
// public void privilege4(){}
...
@@ -62,7 +65,7 @@ public class ControllerAspect {
...
@@ -62,7 +65,7 @@ public class ControllerAspect {
* @param joinPoint
* @param joinPoint
* @throws Throwable
* @throws Throwable
*/
*/
@Around
(
"privilege1() || privilege3()"
)
@Around
(
"privilege1() || privilege3()
||privilege4()
"
)
public
Object
isLogMethod
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
public
Object
isLogMethod
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
try
{
try
{
// 接收到请求,记录请求内容
// 接收到请求,记录请求内容
...
@@ -107,11 +110,13 @@ public class ControllerAspect {
...
@@ -107,11 +110,13 @@ public class ControllerAspect {
}
}
}
}
Object
proceed
=
joinPoint
.
proceed
();
return
proceed
;
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
Object
proceed
=
joinPoint
.
proceed
();
e
.
printStackTrace
();
e
.
printStackTrace
();
logger
.
error
(
"aop日志记录出现异常:{}"
,
e
.
getMessage
());
logger
.
error
(
"aop日志记录出现异常:{}"
,
e
.
getMessage
());
return
proceed
;
}
}
return
null
;
}
}
}
}
notes-log/src/main/java/com/zjty/tynotes/log/dao/LogDao.java
浏览文件 @
0a7c06a8
...
@@ -25,4 +25,5 @@ public interface LogDao extends MongoRepository<Log,String> {
...
@@ -25,4 +25,5 @@ public interface LogDao extends MongoRepository<Log,String> {
* @return
* @return
*/
*/
List
<
Log
>
findAllByLogTimeBetween
(
Date
start
,
Date
end
);
List
<
Log
>
findAllByLogTimeBetween
(
Date
start
,
Date
end
);
}
}
notes-log/src/main/java/com/zjty/tynotes/log/server/impl/LogServiceImpl.java
浏览文件 @
0a7c06a8
...
@@ -13,9 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -13,9 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotEmpty
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Optional
;
/**
/**
* @Author gwj
* @Author gwj
...
@@ -78,6 +76,12 @@ public class LogServiceImpl implements LogService {
...
@@ -78,6 +76,12 @@ public class LogServiceImpl implements LogService {
logs
=
all
;
logs
=
all
;
}
}
}
}
Collections
.
sort
(
logs
,
new
Comparator
<
Log
>()
{
@Override
public
int
compare
(
Log
o1
,
Log
o2
)
{
return
o2
.
getLogTime
().
compareTo
(
o1
.
getLogTime
());
}
});
pageResponse
.
setPageSize
(
pageRequest
.
getPageSize
());
pageResponse
.
setPageSize
(
pageRequest
.
getPageSize
());
pageResponse
.
setCurrentPage
(
pageRequest
.
getCurrentPage
());
pageResponse
.
setCurrentPage
(
pageRequest
.
getCurrentPage
());
int
currentPage
=
pageRequest
.
getCurrentPage
();
int
currentPage
=
pageRequest
.
getCurrentPage
();
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/base/response/ResponseCode.java
0 → 100644
浏览文件 @
0a7c06a8
package
com
.
zjty
.
tynotes
.
pas
.
base
.
response
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
/**
* <p>Description : 异常结果枚举类,用于统一异常状态码与相关描述信息
*
* @author : M@tr!x [xhyrzldf@foxmail.com]
* @Date : 2017/12/13 0:51
*/
@AllArgsConstructor
@Getter
public
enum
ResponseCode
{
/**
* 服务器成功返回用户请求的数据
*/
OK
(
200
,
"[GET]:服务器成功返回用户请求的数据,返回资源对象"
),
/**
* 用户新建或修改数据成功
*/
CREATED
(
201
,
"[POST/PUT/PATCH]:用户新建或修改数据成功,返回新生成或修改的资源对象"
),
/**
* 表示一个请求已经进入后台排队(异步任务)
*/
ACCEPTED
(
202
,
"[*]:表示一个请求已经进入后台排队(异步任务)"
),
/**
* 用户上传文件成功
*/
UPLOADED
(
203
,
"[POST]文件上传成功"
),
/**
* 用户删除数据成功
*/
NO_CONTENT
(
204
,
" [DELETE]:用户删除数据成功"
),
/**
* 用户发出的请求有错误,服务器没有进行新建或修改数据的操作
*/
INVALID_REQUEST
(
400
,
"[POST/PUT/PATCH]:用户发出的请求有错误,服务器没有进行新建或修改数据的操作"
),
/**
* 表示用户没有权限(令牌、用户名、密码错误)
*/
UNAUTHORIZED
(
401
,
" [*]:表示用户没有权限(令牌、用户名、密码错误)"
),
/**
* 表示用户得到授权(与401错误相对),但是访问是被禁止的
*/
FORBIDDEN
(
403
,
" [*] 表示用户得到授权(与401错误相对),但是访问是被禁止的"
),
/**
* 用户发出的请求针对的是不存在的记录,服务器没有进行操作,该操作是幂等的
*/
NOT_FOUND
(
404
,
" [*]:用户发出的请求针对的是不存在的记录,服务器没有进行操作"
),
/**
* 非法参数,请求中附带的参数不符合要求规范
*/
ILLEGAL_PARAMETER
(
405
,
"[*]:非法参数,请求中附带的参数不符合要求规范"
),
/**
* 用户请求的格式不可得(比如用户请求JSON格式,但是只有XML格式)
*/
NOT_ACCEPTABLE
(
406
,
" [GET]:用户请求的格式不可得(比如用户请求JSON格式,但是只有XML格式)"
),
/**
* 用户的参数不得为空
*/
NOT_NULL_PARAMETER
(
408
,
"传递的参数不能为空"
),
/**
* 用户请求的资源被永久删除,且不会再得到的
*/
GONE
(
413
,
"[GET]:用户请求的资源被永久删除,且不会再得到的"
),
/**
* [PUT,PATCH,POST,DELETE]:操作没有成功,并没有数据发生变化
*/
NO_CHANGED
(
414
,
"[PUT,PATCH,POST,DELETE]:操作没有成功,并没有数据发生变化"
),
/**
* 创建一个对象时,发生一个验证错误
*/
UNPROCESSABLE_ENTITY
(
422
,
"[POST/PUT/PATCH] 当创建一个对象时,发生一个验证错误"
),
/**
* 服务器发生错误
*/
INTERNAL_SERVER_ERROR
(
500
,
"服务器发生错误"
),
SERVER_ERROR
(
500
,
"系统升级维护中!"
),
// SERVER_SUCCESED(200, "操作成功!"),
PRICE_CANNOT_BE_NULL
(
400
,
"价格不能为空!"
),
USER_ID_BE_NULL
(
400
,
"用户id不能为空!"
),
USER_NOT_LOGIN
(
400
,
"当前用户未登录或登录已超时!"
),
USER_LOGIN_TIME_OUT
(
400
,
"用户登录超时,请重新登录!"
),
USER_NOT_FIND
(
404
,
"用户不存在!"
),
/**
* 表示用户没有权限(令牌、用户名、密码错误)
*/
UN_POWER
(
401
,
"用户权限不足!"
);
/**
* 结果代码编号
*/
private
Integer
code
;
/**
* 结果信息
*/
private
String
msg
;
}
notes-pas/src/main/java/com/zjty/tynotes/pas/base/response/ServerResponse.java
0 → 100644
浏览文件 @
0a7c06a8
package
com
.
zjty
.
tynotes
.
pas
.
base
.
response
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Getter
;
import
lombok.Setter
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.Optional
;
import
static
com
.
zjty
.
tynotes
.
pas
.
base
.
response
.
ResponseCode
.*;
/**
* Description : 结果类,用于统一返回格式 对外提供关于响应结果的很多便利的静态方法
*
* @author : M@tr!x [xhyrzldf@foxmail.com]
* @Date : 2017/12/13 0:05
*/
@SuppressWarnings
({
"WeakerAccess"
,
"unused"
})
@Getter
@Setter
@ApiModel
(
value
=
"服务器返回体"
)
public
class
ServerResponse
<
T
>
{
/**
* 错误码
*/
@ApiModelProperty
(
value
=
"返回码"
,
example
=
"100"
)
private
Integer
code
;
/**
* 提示信息
*/
@ApiModelProperty
(
value
=
"信息"
,
example
=
"操作成功"
)
private
String
msg
;
/**
* 具体的内容
*/
@ApiModelProperty
(
value
=
"返回数据"
)
private
T
data
;
/* 以下为返回成功响应结果的各类重载静态方法 */
public
static
<
T
>
ServerResponse
<
T
>
success
()
{
return
new
ServerResponse
<>(
OK
.
getCode
(),
OK
.
getMsg
());
}
public
static
<
T
>
ServerResponse
<
T
>
success
(
T
data
)
{
return
new
ServerResponse
<>(
OK
.
getCode
(),
OK
.
getMsg
(),
data
);
}
public
static
<
T
>
ServerResponse
<
T
>
success
(
String
msg
,
T
data
)
{
return
new
ServerResponse
<>(
OK
.
getCode
(),
msg
,
data
);
}
public
static
<
T
>
ServerResponse
<
T
>
saveSuccess
(
T
data
)
{
return
new
ServerResponse
<>(
CREATED
.
getCode
(),
CREATED
.
getMsg
(),
data
);
}
public
static
<
T
>
ServerResponse
<
T
>
deleteSuccess
()
{
return
new
ServerResponse
<>(
NO_CONTENT
.
getCode
(),
NO_CONTENT
.
getMsg
());
}
public
static
<
T
>
ServerResponse
<
T
>
deleteSuccessWithCount
(
Number
effectCount
)
{
return
new
ServerResponse
<>(
NO_CONTENT
.
getCode
(),
"删除成功,操作删除的数据条数为: "
+
effectCount
);
}
public
static
<
T
>
ServerResponse
<
T
>
deleteSuccessWithId
(
Number
id
)
{
return
new
ServerResponse
<>(
NO_CONTENT
.
getCode
(),
"删除成功,操作删除的数据id为: "
+
id
);
}
public
static
<
T
>
ServerResponse
<
T
>
uploadSuccess
(
T
data
)
{
return
new
ServerResponse
<>(
UPLOADED
.
getCode
(),
UPLOADED
.
getMsg
(),
data
);
}
public
static
<
T
>
ServerResponse
<
T
>
messageSuccess
(
String
msg
)
{
return
new
ServerResponse
<>(
OK
.
getCode
(),
msg
);
}
/* 以下为返回失败响应结果的各类重载静态方法 */
public
static
<
T
>
ServerResponse
<
T
>
error
()
{
return
new
ServerResponse
<>(
INTERNAL_SERVER_ERROR
.
getCode
(),
INTERNAL_SERVER_ERROR
.
getMsg
());
}
public
static
<
T
>
ServerResponse
<
T
>
error
(
String
errorMessage
)
{
return
new
ServerResponse
<>(
INTERNAL_SERVER_ERROR
.
getCode
(),
errorMessage
);
}
public
static
<
T
>
ServerResponse
<
T
>
error
(
ResponseCode
responseCode
)
{
return
new
ServerResponse
<>(
responseCode
.
getCode
(),
responseCode
.
getMsg
());
}
public
static
<
T
>
ServerResponse
<
T
>
error
(
ResponseCode
responseCode
,
String
errorMessage
)
{
return
new
ServerResponse
<>(
responseCode
.
getCode
(),
errorMessage
);
}
public
static
<
T
>
ServerResponse
<
T
>
error
(
ResponseCode
responseCode
,
String
errorMessage
,
T
data
)
{
return
new
ServerResponse
<>(
responseCode
.
getCode
(),
errorMessage
,
data
);
}
// /* 以下为提供给CONTROL层向文件服务器操作文件获得相应结果的相关方法 */
//
// /**
// * <b>向文件服务器上传文件并且取得{@code {@link ServerResponse}}类型的响应结果</b>
// * <p>
// * <p>封装了control层的关于文件上传的代码
// * <p>
// * <p>例如file是a.txt,dirName=template, 在文件服务器上存放的位置就是{@code root(根目录)/template/a.txt }
// *
// * @param file {@link MultipartFile} 接受到的文件俺对象
// * @param dirName 在文件服务器上的文件夹名
// * @return {@link ServerResponse} (包含了成功与导致失败的结果)
// */
// public static ServerResponse uploadAndGet(
// @RequestParam("file") Optional<MultipartFile> file, String dirName) {
// // 空指针判断
// if (!file.isPresent()) return error(NOT_NULL_PARAMETER);
// // 上传文件并且获得相应结果
// MultipartFile uploadFile = file.get();
// FileServerResponse fsp =
// HttpClientUtil.uploadFileToServer(uploadFile, dirName, uploadFile.getOriginalFilename());
// // 根据返回结果的状态码确定相应的返回信息(200返回成功,否则error)
// return (fsp.getCode() == 200) ? uploadSuccess(fsp.getData()) : error(NO_CHANGED, fsp.getMsg());
// }
// /**
// * <b>向文件服务器删除文件并且取得{@code {@link ServerResponse}}类型的响应结果</b>
// * <p>
// * <p>封装了control层的关于文件上传的代码
// * <p>
// * <p>例如提供的参数如下
// * <li>fileName = reset-hv_20180115144834_wV9A9iVD.png
// * <li>dirName = templates
// * <li>那么实际删除的文件路径为: {@code root(根目录)/templates/reset-hv_20180115144834_wV9A9iVD.png}
// *
// * @param fileName 要删除的文件名<b>注意是文件服务器上的文件名,例如<b>reset-hv_20180115144834_wV9A9iVD.png</b> 格式为{@code
// * 原始文件名_timestamp_uuid8位}
// * @param dirName 要删除的文件所处的文件目录
// * @return {@link ServerResponse} (包含了成功与导致失败的结果)
// */
// public static ServerResponse deleteAndGet(
// @RequestParam(value = "fileName") Optional<String> fileName, String dirName) {
// // 空指针判断
// if (!fileName.isPresent()) return error(NOT_NULL_PARAMETER);
// // 发送删除文件的请求,附带文件所在的目录和在服务器中的文件名
// FileServerResponse fsp = HttpClientUtil.daleteFileToServer(dirName, fileName.get());
// // 根据返回结果的状态码确定相应的返回信息(200返回成功,否则error)
// return (fsp.getCode() == 200) ? deleteSuccess() : error(NO_CHANGED, fsp.getMsg());
// }
/* 将构造器私有,防止外部进行实例化 仅提供给内部静态方法调用 * */
private
ServerResponse
()
{
}
private
ServerResponse
(
Integer
code
)
{
this
.
code
=
code
;
}
private
ServerResponse
(
Integer
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
}
private
ServerResponse
(
String
msg
,
T
data
)
{
this
.
msg
=
msg
;
this
.
data
=
data
;
}
private
ServerResponse
(
Integer
code
,
String
msg
,
T
data
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
this
.
data
=
data
;
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/config/SecurityConfig.java
浏览文件 @
0a7c06a8
...
@@ -56,6 +56,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -56,6 +56,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
httpSecurity
httpSecurity
.
cors
().
and
()
.
cors
().
and
()
.
authorizeRequests
()
.
authorizeRequests
()
.
antMatchers
(
"/pas/excel/upload"
).
permitAll
()
.
antMatchers
(
"/pas/user/findPublishUsers"
).
permitAll
()
.
antMatchers
(
"/pas/user/findPublishUsers"
).
permitAll
()
.
antMatchers
(
"/ding/test/**"
).
permitAll
()
.
antMatchers
(
"/ding/test/**"
).
permitAll
()
.
antMatchers
(
"/pas/user/judgeParent/**"
).
permitAll
()
.
antMatchers
(
"/pas/user/judgeParent/**"
).
permitAll
()
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/config/handler/MySuccessHandler.java
浏览文件 @
0a7c06a8
package
com
.
zjty
.
tynotes
.
pas
.
config
.
handler
;
package
com
.
zjty
.
tynotes
.
pas
.
config
.
handler
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.zjty.tynotes.pas.base.advise.Content
;
import
com.zjty.tynotes.pas.entity.Authority
;
import
com.zjty.tynotes.pas.entity.Authority
;
import
com.zjty.tynotes.pas.entity.Role
;
import
com.zjty.tynotes.pas.entity.Role
;
import
com.zjty.tynotes.pas.dao.AuthorityDao
;
import
com.zjty.tynotes.pas.dao.AuthorityDao
;
...
@@ -74,6 +75,7 @@ public class MySuccessHandler implements AuthenticationSuccessHandler {
...
@@ -74,6 +75,7 @@ public class MySuccessHandler implements AuthenticationSuccessHandler {
RedisTemplate
redisTemplate
;
RedisTemplate
redisTemplate
;
@Override
@Override
@Content
(
value
=
"登录操作"
)
public
void
onAuthenticationSuccess
(
HttpServletRequest
httpServletRequest
,
HttpServletResponse
httpServletResponse
,
Authentication
authentication
)
throws
IOException
,
ServletException
{
public
void
onAuthenticationSuccess
(
HttpServletRequest
httpServletRequest
,
HttpServletResponse
httpServletResponse
,
Authentication
authentication
)
throws
IOException
,
ServletException
{
Cookie
[]
cookies
=
httpServletRequest
.
getCookies
();
Cookie
[]
cookies
=
httpServletRequest
.
getCookies
();
if
(
cookies
==
null
){
if
(
cookies
==
null
){
...
...
notes-pas/src/main/java/com/zjty/tynotes/pas/controller/ExcelController.java
0 → 100644
浏览文件 @
0a7c06a8
package
com
.
zjty
.
tynotes
.
pas
.
controller
;
import
cn.afterturn.easypoi.excel.ExcelExportUtil
;
import
cn.afterturn.easypoi.excel.ExcelImportUtil
;
import
cn.afterturn.easypoi.excel.entity.ExportParams
;
import
cn.afterturn.easypoi.excel.entity.ImportParams
;
import
cn.afterturn.easypoi.excel.entity.enmus.ExcelType
;
import
com.zjty.tynotes.misc.config.AutoDocument
;
import
com.zjty.tynotes.misc.utils.ExcelUtil
;
import
com.zjty.tynotes.pas.entity.Department
;
import
com.zjty.tynotes.pas.entity.User
;
import
com.zjty.tynotes.pas.entity.vo.ImportUserExcel
;
import
com.zjty.tynotes.pas.service.IUserService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @Author gwj
* @create 2020/4/24 9:36
* excel导入视图层
*/
@Api
(
tags
=
"用户管理权限管理模块"
,
protocols
=
"http"
)
@RestController
@RequestMapping
(
"/pas/excel"
)
@AutoDocument
public
class
ExcelController
{
@Autowired
private
IUserService
iUserService
;
@ApiOperation
(
value
=
"上传excel通讯录"
)
@PostMapping
(
"/import"
)
public
List
<
ImportUserExcel
>
upload
(
@RequestParam
(
"file"
)
MultipartFile
multipartFile
)
throws
Exception
{
ImportParams
params
=
new
ImportParams
();
params
.
setHeadRows
(
2
);
params
.
setNeedVerfiy
(
true
);
// params.setTitleRows(0);
List
<
ImportUserExcel
>
result
=
ExcelImportUtil
.
importExcel
(
multipartFile
.
getInputStream
(),
ImportUserExcel
.
class
,
params
);
System
.
out
.
println
(
result
);
return
result
;
}
@ApiOperation
(
value
=
"导出所有人的excel通讯录"
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
//把要导出的信息放在map里面
List
<
Map
<
String
,
Object
>>
excelList
=
new
ArrayList
<>();
//构建创建导出excel表格所需要的Workbook对象的map
//源数据
List
<
User
>
users
=
iUserService
.
findAll
();
List
<
ImportUserExcel
>
importUserExcels
=
new
ArrayList
<>();
if
(
users
!=
null
){
users
.
forEach
(
user
->
{
importUserExcels
.
add
(
new
ImportUserExcel
(
user
));
});
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
8
);
String
FpName
=
"用户通讯录"
;
map
.
put
(
"subFpName"
,
FpName
);
map
.
put
(
"title"
,
new
ExportParams
(
FpName
,
FpName
));
map
.
put
(
"entity"
,
ImportUserExcel
.
class
);
map
.
put
(
"data"
,
importUserExcels
);
excelList
.
add
(
map
);
Workbook
workbook
=
ExcelExportUtil
.
exportExcel
(
excelList
,
ExcelType
.
HSSF
);
ExcelUtil
.
downloadExcel
(
request
,
response
,
workbook
,
FpName
);
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/controller/UserController.java
浏览文件 @
0a7c06a8
...
@@ -160,4 +160,5 @@ public class UserController {
...
@@ -160,4 +160,5 @@ public class UserController {
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/entity/vo/ImportUserExcel.java
0 → 100644
浏览文件 @
0a7c06a8
package
com
.
zjty
.
tynotes
.
pas
.
entity
.
vo
;
import
cn.afterturn.easypoi.excel.annotation.Excel
;
import
com.zjty.tynotes.pas.entity.User
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @Author gwj
* @create 2020/4/24 9:33
* @des 导入excel模板的实体类
*/
@Data
@AllArgsConstructor
public
class
ImportUserExcel
{
@Excel
(
name
=
"姓名*"
)
private
String
name
;
@Excel
(
name
=
"性别*"
,
replace
=
{
"男_0"
,
"女_1"
})
private
Integer
gender
;
@Excel
(
name
=
"手机号*"
)
private
String
phone
;
public
ImportUserExcel
(
User
user
)
{
this
.
name
=
user
.
getUsername
();
this
.
phone
=
user
.
getPhone1
();
}
}
notes-pas/src/main/java/com/zjty/tynotes/pas/service/impl/UserServiceImpl.java
浏览文件 @
0a7c06a8
...
@@ -176,6 +176,10 @@ public class UserServiceImpl implements IUserService {
...
@@ -176,6 +176,10 @@ public class UserServiceImpl implements IUserService {
return
pasUserDao
.
findAllByIdIn
(
ids
);
return
pasUserDao
.
findAllByIdIn
(
ids
);
}
}
/**
* 查询所有用户
* @return
*/
@Override
@Override
public
List
<
User
>
findAll
()
{
public
List
<
User
>
findAll
()
{
List
<
User
>
userList
=
new
ArrayList
<>();
List
<
User
>
userList
=
new
ArrayList
<>();
...
@@ -256,6 +260,12 @@ public class UserServiceImpl implements IUserService {
...
@@ -256,6 +260,12 @@ public class UserServiceImpl implements IUserService {
return
save
;
return
save
;
}
}
/**
* 是否有某个权限
* @param userId
* @param authorityName
* @return
*/
@Override
@Override
public
boolean
isHaveAuthority
(
String
userId
,
String
authorityName
)
{
public
boolean
isHaveAuthority
(
String
userId
,
String
authorityName
)
{
List
<
UserRole
>
userRoles
=
userRoleDao
.
findAllByUserId
(
userId
);
List
<
UserRole
>
userRoles
=
userRoleDao
.
findAllByUserId
(
userId
);
...
@@ -324,6 +334,12 @@ public class UserServiceImpl implements IUserService {
...
@@ -324,6 +334,12 @@ public class UserServiceImpl implements IUserService {
return
null
;
return
null
;
}
}
/**
* 查询能够分解权限、发布权限给哪些人
* @param userId
* @param authoryName
* @return
*/
@Override
@Override
public
List
<
User
>
findUserList
(
String
userId
,
String
authoryName
){
public
List
<
User
>
findUserList
(
String
userId
,
String
authoryName
){
List
<
String
>
departmentList
=
findDepartmentList
(
userId
,
authoryName
);
List
<
String
>
departmentList
=
findDepartmentList
(
userId
,
authoryName
);
...
...
notes-union/pom.xml
浏览文件 @
0a7c06a8
...
@@ -10,8 +10,8 @@
...
@@ -10,8 +10,8 @@
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
notes-union
</artifactId>
<artifactId>
notes-union
</artifactId>
<
!--<packaging>jar</packaging>--
>
<
packaging>
jar
</packaging
>
<
packaging>
war
</packaging
>
<
!--<packaging>war</packaging>--
>
<profiles>
<profiles>
<!--模拟环境-->
<!--模拟环境-->
<profile>
<profile>
...
@@ -33,26 +33,26 @@
...
@@ -33,26 +33,26 @@
<dependencies>
<dependencies>
<!--
排除内置的tomcat
-->
<!--
<!– 排除内置的tomcat –>
-->
<
dependency
>
<
!--<dependency>--
>
<
groupId>
org.springframework.boot
</groupId
>
<
!--<groupId>org.springframework.boot</groupId>--
>
<
artifactId>
spring-boot-starter-web
</artifactId
>
<
!--<artifactId>spring-boot-starter-web</artifactId>--
>
<
exclusions
>
<
!--<exclusions>--
>
<
exclusion
>
<
!--<exclusion>--
>
<
groupId>
org.springframework.boot
</groupId
>
<
!--<groupId>org.springframework.boot</groupId>--
>
<
artifactId>
spring-boot-starter-tomcat
</artifactId
>
<
!--<artifactId>spring-boot-starter-tomcat</artifactId>--
>
<
/exclusion
>
<
!--</exclusion>--
>
<
/exclusions
>
<
!--</exclusions>--
>
<
/dependency
>
<
!--</dependency>--
>
<!--
使用自带的tomcat
-->
<!--
<!– 使用自带的tomcat –>
-->
<
dependency
>
<
!--<dependency>--
>
<
groupId>
org.springframework.boot
</groupId
>
<
!--<groupId>org.springframework.boot</groupId>--
>
<
artifactId>
spring-boot-starter-tomcat
</artifactId
>
<
!--<artifactId>spring-boot-starter-tomcat</artifactId>--
>
<!--
打包的时候可以不用包进去,别的设施会提供。事实上该依赖理论上可以参与编译,测试,运行等周期。
<!--
<!–打包的时候可以不用包进去,别的设施会提供。事实上该依赖理论上可以参与编译,测试,运行等周期。-->
相当于compile,但是打包阶段做了exclude操作
-->
<!--相当于compile,但是打包阶段做了exclude操作–>
-->
<
scope>
provided
</scope
>
<
!--<scope>provided</scope>--
>
<
/dependency
>
<
!--</dependency>--
>
...
...
notes-union/src/main/java/com/zjty/tynotes/union/UnionApplication.java
浏览文件 @
0a7c06a8
...
@@ -32,12 +32,14 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
...
@@ -32,12 +32,14 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
})
})
@EnableCaching
@EnableCaching
@EnableScheduling
@EnableScheduling
public
class
UnionApplication
extends
SpringBootServletInitializer
{
public
class
UnionApplication
// extends SpringBootServletInitializer
{
@Override
//
@Override
protected
SpringApplicationBuilder
configure
(
SpringApplicationBuilder
builder
)
{
//
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return
builder
.
sources
(
UnionApplication
.
class
);
//
return builder.sources(UnionApplication.class);
}
//
}
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
UnionApplication
.
class
,
args
);
SpringApplication
.
run
(
UnionApplication
.
class
,
args
);
...
...
notes-union/src/main/resources/application.properties
浏览文件 @
0a7c06a8
...
@@ -12,15 +12,15 @@ server.ssl.keyStoreType=PKCS12
...
@@ -12,15 +12,15 @@ server.ssl.keyStoreType=PKCS12
server.ssl.keyAlias
=
alias
server.ssl.keyAlias
=
alias
#mongodb configuration
#mongodb configuration
spring.data.mongodb.uri
=
mongodb://
localhost
:27017/notes5
spring.data.mongodb.uri
=
mongodb://
192.168.1.246
:27017/notes5
# servlet configuration
# servlet configuration
spring.servlet.multipart.max-file-size
=
100MB
spring.servlet.multipart.max-file-size
=
100MB
spring.servlet.multipart.max-request-size
=
1000MB
spring.servlet.multipart.max-request-size
=
1000MB
spring.redis.host
=
localhost
spring.redis.host
=
192.168.1.246
spring.redis.port
=
6379
spring.redis.port
=
6379
spring.redis.timeout
=
5000ms
spring.redis.timeout
=
5000ms
# es configuraiton
# es configuraiton
es.ip
=
localhost
es.ip
=
192.168.1.246
logging.file
=
./log/note.log
logging.file
=
./log/note.log
notes-weekly/pom.xml
浏览文件 @
0a7c06a8
...
@@ -35,6 +35,17 @@
...
@@ -35,6 +35,17 @@
</exclusions>
</exclusions>
</dependency>
</dependency>
<dependency>
<groupId>
com.zjty.tynotes
</groupId>
<artifactId>
notes-log
</artifactId>
<exclusions>
<exclusion>
<groupId>
com.zjty.tynotes
</groupId>
<artifactId>
notes-weekly
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<dependency>
<groupId>
com.zjty.tynotes
</groupId>
<groupId>
com.zjty.tynotes
</groupId>
<artifactId>
notes-pas
</artifactId>
<artifactId>
notes-pas
</artifactId>
...
...
notes-weekly/src/main/java/com/zjty/tynotes/weekly/WeeklyApplication.java
浏览文件 @
0a7c06a8
...
@@ -10,7 +10,9 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
...
@@ -10,7 +10,9 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
(
scanBasePackages
=
{
@SpringBootApplication
(
scanBasePackages
=
{
"com.zjty.tynotes.misc"
,
"com.zjty.tynotes.misc"
,
"com.zjty.tynotes.pas"
"com.zjty.tynotes.pas"
,
"com.zjty.tynotes.log"
,
"com.zjty.tynotes.job"
})
})
@EnableSwagger2
@EnableSwagger2
public
class
WeeklyApplication
{
public
class
WeeklyApplication
{
...
...
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/controller/UserManageController.java
浏览文件 @
0a7c06a8
package
com
.
zjty
.
tynotes
.
weekly
.
subject
.
controller
;
package
com
.
zjty
.
tynotes
.
weekly
.
subject
.
controller
;
import
com.zjty.tynotes.log.entity.Log
;
import
com.zjty.tynotes.log.server.LogService
;
import
com.zjty.tynotes.misc.config.AutoDocument
;
import
com.zjty.tynotes.misc.config.AutoDocument
;
import
com.zjty.tynotes.pas.base.advise.Content
;
import
com.zjty.tynotes.pas.base.advise.Content
;
import
com.zjty.tynotes.pas.entity.User
;
import
com.zjty.tynotes.pas.entity.User
;
import
com.zjty.tynotes.pas.entity.vo.PageRequest
;
import
com.zjty.tynotes.pas.entity.vo.PageRequest
;
import
com.zjty.tynotes.pas.entity.vo.PageResponse
;
import
com.zjty.tynotes.pas.entity.vo.PageResponse
;
import
com.zjty.tynotes.weekly.subject.entity.vo.Problem
;
import
com.zjty.tynotes.weekly.subject.entity.vo.Problem
;
import
com.zjty.tynotes.weekly.subject.entity.vo.SimpleUserVo
;
import
com.zjty.tynotes.weekly.subject.entity.vo.UserVo
;
import
com.zjty.tynotes.weekly.subject.entity.vo.UserVo
;
import
com.zjty.tynotes.weekly.subject.service.UserManageService
;
import
com.zjty.tynotes.weekly.subject.service.UserManageService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -13,15 +16,20 @@ import io.swagger.annotations.ApiOperation;
...
@@ -13,15 +16,20 @@ import io.swagger.annotations.ApiOperation;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.List
;
import
static
org
.
springframework
.
http
.
ResponseEntity
.
ok
;
import
static
org
.
springframework
.
http
.
ResponseEntity
.
ok
;
...
@@ -34,6 +42,10 @@ import static org.springframework.http.ResponseEntity.ok;
...
@@ -34,6 +42,10 @@ import static org.springframework.http.ResponseEntity.ok;
@RequestMapping
(
"/manage/user"
)
@RequestMapping
(
"/manage/user"
)
@AutoDocument
@AutoDocument
public
class
UserManageController
{
public
class
UserManageController
{
@Autowired
private
LogService
logService
;
@Autowired
@Autowired
private
UserManageService
userManageService
;
private
UserManageService
userManageService
;
...
@@ -81,6 +93,7 @@ public class UserManageController {
...
@@ -81,6 +93,7 @@ public class UserManageController {
try
{
try
{
User
userById
=
userManageService
.
findUserById
(
user
.
getId
());
User
userById
=
userManageService
.
findUserById
(
user
.
getId
());
User
user1
=
userManageService
.
updateSelf
(
user
,
userById
);
User
user1
=
userManageService
.
updateSelf
(
user
,
userById
);
logService
.
saveLog
(
new
Log
(
null
,
"更改自身信息"
,
new
Date
(),
user
.
getId
(),
user
.
getUsername
()));
return
ok
(
user1
);
return
ok
(
user1
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"更改当前用户自身信息失败"
);
logger
.
error
(
"更改当前用户自身信息失败"
);
...
@@ -90,17 +103,23 @@ public class UserManageController {
...
@@ -90,17 +103,23 @@ public class UserManageController {
@Content
(
value
=
"更新当前用户密码"
)
@Content
(
value
=
"更新当前用户密码"
)
@ApiOperation
(
value
=
"更新当前用户密码"
)
@ApiOperation
(
value
=
"更新当前用户密码"
)
@PutMapping
(
"/password"
)
@PutMapping
(
"/password/{oldPass}"
)
public
ResponseEntity
updatePassword
(
@RequestBody
@NotNull
User
user
){
public
ResponseEntity
updatePassword
(
@PathVariable
String
oldPass
,
@RequestBody
@NotNull
User
user
){
Authentication
authentication
=
SecurityContextHolder
.
getContext
().
getAuthentication
();
BCryptPasswordEncoder
bCryptPasswordEncoder
=
new
BCryptPasswordEncoder
();
User
principal
=
(
User
)
authentication
.
getPrincipal
();
System
.
out
.
println
(
oldPass
);
User
userByUsername
=
userManageService
.
findfindUserByUsername
(
principal
.
getUsername
());
User
userByUsername
=
userManageService
.
findfindUserByUsername
(
user
.
getUsername
());
userByUsername
.
setPassword
(
user
.
getPassword
());
System
.
out
.
println
(
userByUsername
.
getPassword
());
boolean
b
=
userManageService
.
updatePas
(
userByUsername
);
if
(
b
){
if
(
bCryptPasswordEncoder
.
matches
(
oldPass
,
userByUsername
.
getPassword
())){
return
ok
(
"更改密码成功"
);
System
.
out
.
println
(
true
);
userByUsername
.
setPassword
(
user
.
getPassword
());
boolean
b
=
userManageService
.
updatePas
(
userByUsername
);
if
(
b
){
logService
.
saveLog
(
new
Log
(
null
,
"更改密码"
,
new
Date
(),
user
.
getId
(),
user
.
getUsername
()));
return
ok
(
"更改密码成功"
);
}
}
}
return
ok
(
"更改密码失败"
);
return
new
ResponseEntity
(
"更改密码失败"
,
HttpStatus
.
INTERNAL_SERVER_ERROR
);
}
}
@ApiOperation
(
value
=
"上传建议以及使用中的问题"
)
@ApiOperation
(
value
=
"上传建议以及使用中的问题"
)
...
@@ -121,5 +140,17 @@ public class UserManageController {
...
@@ -121,5 +140,17 @@ public class UserManageController {
return
ok
(
userManageService
.
putProblem
(
problem
));
return
ok
(
userManageService
.
putProblem
(
problem
));
}
}
@ApiOperation
(
value
=
"查询通讯录基本信息"
)
@GetMapping
(
"/findAddressBook"
)
public
ResponseEntity
findAddressBook
(){
try
{
List
<
SimpleUserVo
>
simpleUserVos
=
userManageService
.
findAddressBook
();
return
ok
(
simpleUserVos
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"查询通讯录信息失败"
);
}
return
ok
(
"查询通讯录信息失败"
);
}
}
}
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/entity/vo/SimpleUserVo.java
0 → 100644
浏览文件 @
0a7c06a8
package
com
.
zjty
.
tynotes
.
weekly
.
subject
.
entity
.
vo
;
import
com.zjty.tynotes.pas.entity.User
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @Author gwj
* @create 2020/4/24 10:21
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
SimpleUserVo
{
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
)
private
String
id
;
@ApiModelProperty
(
value
=
"姓名"
,
example
=
"gwj"
)
private
String
username
;
@ApiModelProperty
(
value
=
"电话1"
,
example
=
"13211111111"
)
private
String
phone1
;
@ApiModelProperty
(
value
=
"岗位"
,
example
=
"后端程序员"
)
private
String
jobs
;
@ApiModelProperty
(
value
=
"邮箱"
,
example
=
"123456789@qq.com"
)
private
String
email
;
public
SimpleUserVo
(
User
user
)
{
this
.
id
=
user
.
getId
();
this
.
username
=
user
.
getUsername
();
this
.
phone1
=
user
.
getPhone1
();
this
.
jobs
=
user
.
getJobs
();
this
.
email
=
user
.
getEmail
();
}
}
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/entity/vo/UserVo.java
浏览文件 @
0a7c06a8
...
@@ -27,7 +27,7 @@ import java.util.List;
...
@@ -27,7 +27,7 @@ import java.util.List;
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor
public
class
UserVo
{
public
class
UserVo
{
@Id
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"id"
,
example
=
"1"
)
private
String
id
;
private
String
id
;
...
...
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/service/UserManageService.java
浏览文件 @
0a7c06a8
...
@@ -5,6 +5,7 @@ import com.zjty.tynotes.pas.entity.User;
...
@@ -5,6 +5,7 @@ import com.zjty.tynotes.pas.entity.User;
import
com.zjty.tynotes.pas.entity.vo.PageRequest
;
import
com.zjty.tynotes.pas.entity.vo.PageRequest
;
import
com.zjty.tynotes.pas.entity.vo.PageResponse
;
import
com.zjty.tynotes.pas.entity.vo.PageResponse
;
import
com.zjty.tynotes.weekly.subject.entity.vo.Problem
;
import
com.zjty.tynotes.weekly.subject.entity.vo.Problem
;
import
com.zjty.tynotes.weekly.subject.entity.vo.SimpleUserVo
;
import
com.zjty.tynotes.weekly.subject.entity.vo.UserVo
;
import
com.zjty.tynotes.weekly.subject.entity.vo.UserVo
;
import
java.text.ParseException
;
import
java.text.ParseException
;
...
@@ -78,6 +79,12 @@ public interface UserManageService {
...
@@ -78,6 +79,12 @@ public interface UserManageService {
*/
*/
Problem
putProblem
(
Problem
problem
);
Problem
putProblem
(
Problem
problem
);
/**
* 查询通讯录信息
* @return
*/
List
<
SimpleUserVo
>
findAddressBook
();
// /**
// /**
// * 根据任务状态查询人员任务列表
// * 根据任务状态查询人员任务列表
// * @param id
// * @param id
...
...
notes-weekly/src/main/java/com/zjty/tynotes/weekly/subject/service/impl/UserManageServiceImpl.java
浏览文件 @
0a7c06a8
...
@@ -11,6 +11,7 @@ import com.zjty.tynotes.pas.entity.vo.PageRequest;
...
@@ -11,6 +11,7 @@ import com.zjty.tynotes.pas.entity.vo.PageRequest;
import
com.zjty.tynotes.pas.entity.vo.PageResponse
;
import
com.zjty.tynotes.pas.entity.vo.PageResponse
;
import
com.zjty.tynotes.weekly.subject.dao.ProblemDao
;
import
com.zjty.tynotes.weekly.subject.dao.ProblemDao
;
import
com.zjty.tynotes.weekly.subject.entity.vo.Problem
;
import
com.zjty.tynotes.weekly.subject.entity.vo.Problem
;
import
com.zjty.tynotes.weekly.subject.entity.vo.SimpleUserVo
;
import
com.zjty.tynotes.weekly.subject.entity.vo.UserVo
;
import
com.zjty.tynotes.weekly.subject.entity.vo.UserVo
;
import
com.zjty.tynotes.weekly.subject.service.UserManageService
;
import
com.zjty.tynotes.weekly.subject.service.UserManageService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -345,6 +346,24 @@ public class UserManageServiceImpl implements UserManageService {
...
@@ -345,6 +346,24 @@ public class UserManageServiceImpl implements UserManageService {
return
problemDao
.
save
(
problem
);
return
problemDao
.
save
(
problem
);
}
}
/**
* 查询通讯录信息
* @return
*/
@Override
public
List
<
SimpleUserVo
>
findAddressBook
()
{
List
<
User
>
users
=
pasUserDao
.
findAll
();
List
<
SimpleUserVo
>
userList
=
new
ArrayList
<>();
if
(
users
!=
null
){
users
.
forEach
(
user
->
{
if
(
user
.
getUsername
()!=
"root"
&&
user
.
getUsername
()!=
"HR"
){
userList
.
add
(
new
SimpleUserVo
(
user
));
}
});
}
return
userList
;
}
/**
/**
* 暂时没有用到
* 暂时没有用到
* @param des
* @param des
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论