| 
					
				 | 
			
			
				@@ -1,32 +1,32 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.rtrh.projects.web.controller.passport.api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.shiro.SecurityUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.shiro.authc.AuthenticationException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.shiro.authc.DisabledAccountException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.shiro.authc.IncorrectCredentialsException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.shiro.authc.LockedAccountException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.shiro.authc.UnknownAccountException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.shiro.session.Session; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.shiro.subject.Subject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.web.bind.annotation.PostMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.web.bind.annotation.RequestBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.web.bind.annotation.RequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.web.bind.annotation.RestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import cn.hutool.http.HttpUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.rtrh.core.vo.Message; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.rtrh.projects.modules.account.po.CommUser; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.rtrh.projects.modules.account.service.CommLoginService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.rtrh.projects.modules.account.service.CommUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.rtrh.projects.modules.account.service.impl.CommUserChecker; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.rtrh.projects.vo.passport.DoLoginVO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.rtrh.projects.web.controller.BaseController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.rtrh.projects.web.util.JwtUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.rtrh.projects.web.util.RemoteUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.team.security.MCSessionDAO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.team.security.UserToken; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.shiro.SecurityUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.shiro.authc.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.shiro.session.Session; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.shiro.subject.Subject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.bind.ServletRequestUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.servlet.support.RequestContextUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.servlet.http.HttpSession; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Collection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @RequestMapping("api") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -36,6 +36,8 @@ public class LoginApiController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private MCSessionDAO sessionDAO; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private CommLoginService commLoginService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	private CommUserService commUserService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	public static final Map<Object, Session> user_session = new HashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -66,9 +68,6 @@ public class LoginApiController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * 登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	 * @param loginName 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	 * @param pwd 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	 * @param code 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * @param request 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * @param response 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	 * @return 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -88,6 +87,39 @@ public class LoginApiController extends BaseController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		return message; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 * 跳转登录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 * @param token 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@PostMapping("jumpLogin") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public Message jumpLogin(@RequestParam String token) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Message message = new Message(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//对token进行解密得到用户名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			String username = JwtUtil.validateToken(token); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//查询发改委数据库中是否存在该用户 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			CommUser commUser = commUserService.findCommUserByFgwLoginName(username); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(null == commUser){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				message.addError("用户不存在"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				return message; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(CommUserChecker.isDisabledUser(commUser)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				message.addError("用户被锁定"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				return message; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			UserToken shiroUserToken = new UserToken(commUser.getLoginname(), commUser.getPassword(), RemoteUtil.getIpAddress(request)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			shiroUserToken.setRememberMe(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			shiroUserToken.setLoginAction("jump"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			loginMethod(request, response, shiroUserToken, message); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			logger.error("", e); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			message.addError("跳转异常"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return message; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	private void loginMethod(HttpServletRequest request, HttpServletResponse response, UserToken token, Message message){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		Subject currentUser = SecurityUtils.getSubject(); 
			 |