mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-08 10:26:48 +08:00
提交用户的检查修改
This commit is contained in:
@@ -101,8 +101,8 @@ public class AuthenticationFilter extends OncePerRequestFilter {
|
||||
// }
|
||||
if(cuser==null) {
|
||||
// 判断token中获取的值是否当前系统的,不是则告诉前端来获取
|
||||
if(tokenData.containsKey("userId")) {
|
||||
error(response,302,"系统无当前用户,需同步");
|
||||
if(tokenData.containsKey("uId")) {
|
||||
error(response,302,"token 错误");
|
||||
return;
|
||||
}
|
||||
error(response,401,"请重新登录");
|
||||
@@ -127,9 +127,9 @@ public class AuthenticationFilter extends OncePerRequestFilter {
|
||||
|
||||
private CurrentUser convertByMap(Map<String, String> data) {
|
||||
if(!data.containsKey("aid")) {
|
||||
//在这里写根据原系统UserId去查询用户信息。然后生成CurrentUser 返回就可以了
|
||||
if(data.containsKey("userId")) {
|
||||
User user = userService.getBySysId(data.get("userId"));
|
||||
//修改为新的接口,通过uId获取
|
||||
if(data.containsKey("uId")) {
|
||||
User user = userService.get(data.get("uId"));
|
||||
if(user != null){
|
||||
CurrentUser cuser=new CurrentUser();
|
||||
cuser.setAccountId(user.getId());
|
||||
@@ -141,8 +141,22 @@ public class AuthenticationFilter extends OncePerRequestFilter {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// if(data.containsKey("userId")) {
|
||||
// User user = userService.getBySysId(data.get("userId"));
|
||||
// if(user != null){
|
||||
// CurrentUser cuser=new CurrentUser();
|
||||
// cuser.setAccountId(user.getId());
|
||||
// cuser.setName(user.getName());
|
||||
// cuser.setCode(user.getUserNo());
|
||||
// cuser.setDepartId(user.getDepartId());
|
||||
// return cuser;
|
||||
// }else {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
//此处用于本地登录的情况,直接从token中获取,不需要再查询一次了
|
||||
CurrentUser cuser=new CurrentUser();
|
||||
cuser.setAccountId(data.get("aid"));
|
||||
cuser.setName(data.get("name"));
|
||||
|
||||
Reference in New Issue
Block a user