| 
					
				 | 
			
			
				@@ -1,11 +1,9 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.bootdo.system.config; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.bootdo.common.constant.Constants; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.bootdo.common.token.Token; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.bootdo.common.token.TokenUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.bootdo.common.utils.IPUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.bootdo.common.utils.ShiroUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.logging.log4j.LogManager; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.logging.log4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Component; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -35,30 +33,30 @@ public class AuthorizationInterceptor implements HandlerInterceptor { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            String tokenStr = request.getHeader(Constants.LOGIN_TOKEN_KEY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(ObjectUtils.isEmpty(tokenStr)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                tokenStr = request.getParameter(Constants.LOGIN_TOKEN_KEY); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String username = ShiroUtils.getUser().getUsername(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(ObjectUtils.isEmpty(username)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(ObjectUtils.isEmpty(tokenStr)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                tokenStr = tokenUtil.createCurrTokenString(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if(ObjectUtils.isEmpty(tokenStr)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    logger.error("preHandle =====================tokenStr is null======================="); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String cacheToken =  tokenUtil.getLoginUser(username); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(ObjectUtils.isEmpty(cacheToken)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.error("preHandle =====================cacheToken is null=======================A"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if(!ObjectUtils.isEmpty(tokenStr)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Token token = tokenUtil.getToken(tokenStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (token == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    logger.error("preHandle =====================token is null======================="); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    String ip = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        ip = IPUtils.getIpAddr(request); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    tokenUtil.saveLoginUser(token.getPayload().getUsername(), tokenStr, ip,System.currentTimeMillis(),"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String tokenStr = cacheToken.split("_")[0]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Token token = tokenUtil.getToken(tokenStr); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (ObjectUtils.isEmpty(token)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                logger.error("preHandle =====================token is null=======================B"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return true; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String ip = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ip = IPUtils.getIpAddr(request); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            tokenUtil.saveLoginUser(username, tokenStr, ip, System.currentTimeMillis(),"1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             e.printStackTrace(); 
			 |