|
@@ -1,6 +1,10 @@
|
|
|
package com.fdkankan.fusion.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fdkankan.fusion.common.util.JwtUtil;
|
|
|
+import com.fdkankan.fusion.httpClient.response.FdkkUserVo;
|
|
|
+import com.fdkankan.redis.constant.RedisKey;
|
|
|
+import com.fdkankan.redis.util.RedisUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
@@ -23,6 +27,8 @@ public class BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
protected HttpServletResponse response;
|
|
|
+ @Autowired
|
|
|
+ private RedisUtil redisUtil;
|
|
|
|
|
|
|
|
|
protected String getToken(){
|
|
@@ -32,7 +38,17 @@ public class BaseController {
|
|
|
return JwtUtil.getUsername(getToken());
|
|
|
}
|
|
|
protected String getNickName(){
|
|
|
- return JwtUtil.getNickName(getToken());
|
|
|
+ try {
|
|
|
+ String fdToken = String.format(RedisKey.TOKEN_V3,getToken());
|
|
|
+ if(redisUtil.hasKey(fdToken)){
|
|
|
+ String jsonObj = redisUtil.get(fdToken);
|
|
|
+ FdkkUserVo fdkkUserVo = JSONObject.parseObject(jsonObj, FdkkUserVo.class);
|
|
|
+ return fdkkUserVo.getNickName();
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
}
|