|  |  | @ -12,6 +12,7 @@ import com.epmet.dto.form.ResiWxPhoneFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.UserTokenResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.CaptchaService; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.service.LoginService; | 
			
		
	
		
			
				
					|  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
			
				
					|  |  |  | import org.apache.commons.lang3.StringUtils; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  | import org.springframework.web.bind.annotation.*; | 
			
		
	
	
		
			
				
					|  |  | @ -28,6 +29,7 @@ import java.io.IOException; | 
			
		
	
		
			
				
					|  |  |  |  * @Author yinzuomei | 
			
		
	
		
			
				
					|  |  |  |  * @Date 2020/3/14 13:58 | 
			
		
	
		
			
				
					|  |  |  |  */ | 
			
		
	
		
			
				
					|  |  |  | @Slf4j | 
			
		
	
		
			
				
					|  |  |  | @RestController | 
			
		
	
		
			
				
					|  |  |  | @RequestMapping("login") | 
			
		
	
		
			
				
					|  |  |  | public class LoginController { | 
			
		
	
	
		
			
				
					|  |  | @ -47,15 +49,20 @@ public class LoginController { | 
			
		
	
		
			
				
					|  |  |  | 	 **/ | 
			
		
	
		
			
				
					|  |  |  | 	@GetMapping("captcha") | 
			
		
	
		
			
				
					|  |  |  | 	public void captcha(HttpServletResponse response, String uuid) throws IOException { | 
			
		
	
		
			
				
					|  |  |  | 		//uuid不能为空
 | 
			
		
	
		
			
				
					|  |  |  | 		AssertUtils.isBlank(uuid, ErrorCode.IDENTIFIER_NOT_NULL); | 
			
		
	
		
			
				
					|  |  |  | 		//生成图片验证码
 | 
			
		
	
		
			
				
					|  |  |  | 		BufferedImage image = captchaService.create(uuid); | 
			
		
	
		
			
				
					|  |  |  | 		response.setHeader("Cache-Control", "no-store, no-cache"); | 
			
		
	
		
			
				
					|  |  |  | 		response.setContentType("image/jpeg"); | 
			
		
	
		
			
				
					|  |  |  | 		ServletOutputStream out = response.getOutputStream(); | 
			
		
	
		
			
				
					|  |  |  | 		ImageIO.write(image, "jpg", out); | 
			
		
	
		
			
				
					|  |  |  | 		out.close(); | 
			
		
	
		
			
				
					|  |  |  | 		try { | 
			
		
	
		
			
				
					|  |  |  | 			//uuid不能为空
 | 
			
		
	
		
			
				
					|  |  |  | 			AssertUtils.isBlank(uuid, ErrorCode.IDENTIFIER_NOT_NULL); | 
			
		
	
		
			
				
					|  |  |  | 			//生成图片验证码
 | 
			
		
	
		
			
				
					|  |  |  | 			BufferedImage image = captchaService.create(uuid); | 
			
		
	
		
			
				
					|  |  |  | 			response.reset(); | 
			
		
	
		
			
				
					|  |  |  | 			response.setHeader("Cache-Control", "no-store, no-cache"); | 
			
		
	
		
			
				
					|  |  |  | 			response.setContentType("image/jpeg"); | 
			
		
	
		
			
				
					|  |  |  | 			ServletOutputStream out = response.getOutputStream(); | 
			
		
	
		
			
				
					|  |  |  | 			ImageIO.write(image, "jpg", out); | 
			
		
	
		
			
				
					|  |  |  | 			out.close(); | 
			
		
	
		
			
				
					|  |  |  | 		} catch (IOException e) { | 
			
		
	
		
			
				
					|  |  |  | 			log.error("获取登陆验证码异常", e); | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	/** | 
			
		
	
	
		
			
				
					|  |  | 
 |