Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yanxuan-qc-change-system
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
胡园园
yanxuan-qc-change-system
Commits
2a6f16d7
Commit
2a6f16d7
authored
Dec 02, 2022
by
jx-art
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
切换拦截器--- 如果是执行人就从head里面获取值
parent
80b7da3e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
4 deletions
+14
-4
AdminChangeConfigServiceImpl.java
...biz/service/impl/change/AdminChangeConfigServiceImpl.java
+7
-0
AdminUserHolder.java
...ease/mail/yanxuan/change/common/bean/AdminUserHolder.java
+2
-2
AdminUserLoginInterceptor.java
.../yanxuan/change/web/config/AdminUserLoginInterceptor.java
+3
-0
WebMvcConfig.java
.../netease/mail/yanxuan/change/web/config/WebMvcConfig.java
+2
-2
No files found.
yanxuan-qc-change-system-biz/src/main/java/com/netease/mail/yanxuan/change/biz/service/impl/change/AdminChangeConfigServiceImpl.java
View file @
2a6f16d7
...
...
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.netease.mail.yanxuan.change.biz.meta.exception.ExceptionFactory
;
import
com.netease.mail.yanxuan.change.biz.service.change.ChangeConfigService
;
import
com.netease.mail.yanxuan.change.biz.service.change.ChangeExecConfigService
;
import
com.netease.mail.yanxuan.change.common.bean.AdminUserHolder
;
import
com.netease.mail.yanxuan.change.common.bean.AjaxResult
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
...
...
@@ -166,6 +167,9 @@ public class AdminChangeConfigServiceImpl implements AdminChangeConfigService {
return
AjaxResult
.
success
(
typeService
.
queryConfigType
());
}
@Autowired
AdminUserHolder
userHolder
;
/**
* 添加变更模板并参数拼接
* @param changeTypes
...
...
@@ -198,6 +202,9 @@ public class AdminChangeConfigServiceImpl implements AdminChangeConfigService {
changeConfig
.
setChangeDepartment
(
changeConfigReq
.
getChangeDepartment
());
if
(
changeConfigReq
.
getChangeCommanderType
()
==
null
){
throw
ExceptionFactory
.
createBiz
(
ResponseCode
.
PARAMETER_DEFICIENCY
);
//如果是执行人就从head里面把邮箱装载
}
else
if
(
changeConfigReq
.
getChangeCommanderType
()
==
1
){
changeConfigReq
.
setChangeCommander
(
AdminUserHolder
.
getUserName
());
}
changeConfig
.
setChangeCommanderType
(
changeConfigReq
.
getChangeCommanderType
());
if
(
changeConfigReq
.
getChangeCommander
()
==
null
){
...
...
yanxuan-qc-change-system-common/src/main/java/com/netease/mail/yanxuan/change/common/bean/AdminUserHolder.java
View file @
2a6f16d7
...
...
@@ -29,9 +29,9 @@ public class AdminUserHolder {
*
* @return 用户名,null-未登录
*/
/*
public static String getUserName() {
public
static
String
getUserName
()
{
return
userThreadLocal
.
get
();
}
*/
}
public
static
void
setUserName
(
String
userName
)
{
userThreadLocal
.
set
(
userName
);
...
...
yanxuan-qc-change-system-web/src/main/java/com/netease/mail/yanxuan/change/web/config/AdminUserLoginInterceptor.java
View file @
2a6f16d7
...
...
@@ -20,6 +20,9 @@ public class AdminUserLoginInterceptor implements HandlerInterceptor {
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
String
uid
=
request
.
getHeader
(
"uid"
);
log
.
info
(
"adminUserLoginInterceptor uid ={}"
,
uid
);
if
(
uid
==
null
){
uid
=
"grp.gyhtest1001@corp.netease.com"
;
}
AdminUserHolder
.
setUserName
(
uid
);
return
true
;
}
...
...
yanxuan-qc-change-system-web/src/main/java/com/netease/mail/yanxuan/change/web/config/WebMvcConfig.java
View file @
2a6f16d7
...
...
@@ -18,7 +18,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
public
class
WebMvcConfig
implements
WebMvcConfigurer
{
@Autowired
private
UserInterceptor
user
Interceptor
;
private
AdminUserLoginInterceptor
userLogin
Interceptor
;
@Autowired
private
LoginInterceptor
loginInterceptor
;
...
...
@@ -30,7 +30,7 @@ public class WebMvcConfig implements WebMvcConfigurer{
*/
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
user
Interceptor
).
addPathPatterns
(
"/**"
).
excludePathPatterns
(
"/i/health"
).
excludePathPatterns
(
"/change/flow/getOperator
"
);
registry
.
addInterceptor
(
user
LoginInterceptor
).
addPathPatterns
(
"/**"
).
excludePathPatterns
(
"/i/health"
).
excludePathPatterns
(
"/change/flow/getOperator"
,
"/test/**
"
);
// registry.addInterceptor(loginInterceptor).addPathPatterns("/**").excludePathPatterns("/change/flow/getOperator");
}
...
...
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