|
|
@ -441,38 +441,6 @@ public class UserController { |
|
|
|
}) |
|
|
|
@RequestMapping(value = "token",method = RequestMethod.GET,produces = {"application/json;charset=UTF-8"}) |
|
|
|
public JsonResponse<UserVo.TokenToUserId> getUserByToken(@RequestParam(required = true) String token) throws Exception { |
|
|
|
// long start = System.currentTimeMillis();
|
|
|
|
// UserVo.TokenToUserId tokenToUserId = new UserVo.TokenToUserId();
|
|
|
|
|
|
|
|
// // 验证token是否存在
|
|
|
|
// String tokenStr = token;
|
|
|
|
// if (tokenStr == null || !tokenStr.startsWith(WebConstant.HEADER_KEY_TOKEN_PREFIX)) {
|
|
|
|
// return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN);
|
|
|
|
// }
|
|
|
|
// String userToken = tokenStr.substring(WebConstant.HEADER_KEY_TOKEN_PREFIX.length());
|
|
|
|
//
|
|
|
|
// //验证token是否有效
|
|
|
|
// Claims claims = null;
|
|
|
|
// try {
|
|
|
|
// claims = JwtUtil.parseJWT(userToken, WebConstant.JWT_ACCESS_TOKEN_SECERT);
|
|
|
|
// }catch(Exception e){
|
|
|
|
// return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN);
|
|
|
|
// }
|
|
|
|
// //验证用户存根
|
|
|
|
// if(userService.tokenNotExistInCache(Long.valueOf(claims.getSubject()))){
|
|
|
|
// return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN);
|
|
|
|
// }
|
|
|
|
// //验证用户是否禁用
|
|
|
|
// SysUser user = userService.getUserById(Long.valueOf(claims.getSubject()));
|
|
|
|
// if(user.getRecStatus() == WebConstant.REC_STATUS.Disabled.value){
|
|
|
|
// return JsonResponse.newInstance().ok(CodeEnum.NOT_LOGIN);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// tokenToUserId.setId(Long.valueOf(claims.getSubject()));
|
|
|
|
// long end = System.currentTimeMillis();
|
|
|
|
// log.info("根据token查找userId用时:{}",end - start);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
log.info("MustLogin根据token查找UserId:{}",token); |
|
|
|
long start = System.currentTimeMillis(); |
|
|
|