Commit 2a6f16d7 by jx-art

切换拦截器--- 如果是执行人就从head里面获取值

parent 80b7da3e
......@@ -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){
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -18,7 +18,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
public class WebMvcConfig implements WebMvcConfigurer{
@Autowired
private UserInterceptor userInterceptor;
private AdminUserLoginInterceptor userLoginInterceptor;
@Autowired
private LoginInterceptor loginInterceptor;
......@@ -30,7 +30,7 @@ public class WebMvcConfig implements WebMvcConfigurer{
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(userInterceptor).addPathPatterns("/**").excludePathPatterns("/i/health").excludePathPatterns("/change/flow/getOperator");
registry.addInterceptor(userLoginInterceptor).addPathPatterns("/**").excludePathPatterns("/i/health").excludePathPatterns("/change/flow/getOperator","/test/**");
// registry.addInterceptor(loginInterceptor).addPathPatterns("/**").excludePathPatterns("/change/flow/getOperator");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment