| 
					
				 | 
			
			
				@ -22,6 +22,7 @@ import com.yihu.jw.security.service.OauthWlyyConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.security.service.OauthYlzConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.security.utils.DateUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.security.utils.SerializeUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.jw.sms.service.ZhongShanSMSService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import com.yihu.utils.security.RSAUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.Api; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				import io.swagger.annotations.ApiOperation; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -118,6 +119,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private OauthYlzConfigService oauthYlzConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private OauthWlyyConfigService oauthWlyyConfigService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    private ZhongShanSMSService zhongShanSMSService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @PostConstruct 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@ -430,6 +433,40 @@ public class WlyyLoginEndpoint extends AbstractEndpoint { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    @RequestMapping(value = "/oauth/sendZSCaptcha", method = RequestMethod.GET) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    public ResponseEntity<Oauth2Envelop<Captcha>> sendZSCaptcha(@RequestParam Map<String, String> parameters) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String client_id = parameters.get("client_id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String username = parameters.get("username"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isEmpty(client_id)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new InvalidRequestException("client_id"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (StringUtils.isEmpty(username)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new InvalidRequestException("username"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //验证请求间隔超时,防止频繁获取验证码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            throw new IllegalAccessException("SMS request frequency is too fast"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        //发送短信获取验证码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        String captcha = wlyyRedisVerifyCodeService.getCodeNumber(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        int result =  zhongShanSMSService.ZhongShangSendSMS(username,"您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        if (0 == result) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Captcha _captcha = new Captcha(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            _captcha.setCode(captcha); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            _captcha.setExpiresIn(300); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, _captcha); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            HttpHeaders headers = new HttpHeaders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            headers.set("Cache-Control", "no-store"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            headers.set("Pragma", "no-cache"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				            return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				        throw new IllegalStateException("验证码发送失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 验证验证码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     * 
			 |