|
@ -30,6 +30,7 @@ import com.yihu.jw.security.utils.DateUtil;
|
|
import com.yihu.jw.security.utils.IdCardUtil;
|
|
import com.yihu.jw.security.utils.IdCardUtil;
|
|
import com.yihu.jw.security.utils.SerializeUtil;
|
|
import com.yihu.jw.security.utils.SerializeUtil;
|
|
import com.yihu.jw.sms.service.YkyySMSService;
|
|
import com.yihu.jw.sms.service.YkyySMSService;
|
|
|
|
import com.yihu.jw.sms.service.ZBSmsService;
|
|
import com.yihu.jw.sms.service.ZhongShanSMSService;
|
|
import com.yihu.jw.sms.service.ZhongShanSMSService;
|
|
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
|
|
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
|
|
import com.yihu.utils.network.HttpResponse;
|
|
import com.yihu.utils.network.HttpResponse;
|
|
@ -130,6 +131,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
@Autowired
|
|
@Autowired
|
|
private ZhongShanSMSService zhongShanSMSService;
|
|
private ZhongShanSMSService zhongShanSMSService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
private ZBSmsService zbSmsService;
|
|
|
|
@Autowired
|
|
private OauthCaConfigSerivce oauthCaConfigSerivce;
|
|
private OauthCaConfigSerivce oauthCaConfigSerivce;
|
|
@Autowired
|
|
@Autowired
|
|
private OauthWjwConfigService oauthWjwConfigService;
|
|
private OauthWjwConfigService oauthWjwConfigService;
|
|
@ -606,6 +609,66 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
throw new IllegalStateException("验证码发送失败!");
|
|
throw new IllegalStateException("验证码发送失败!");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 福州健康之路短信接口
|
|
|
|
* @param parameters
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
@RequestMapping(value = "/oauth/sendZBCaptcha", method = RequestMethod.GET)
|
|
|
|
public ResponseEntity<Oauth2Envelop<Captcha>> sendZBCaptcha(@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 (username.length()>12){
|
|
|
|
throw new InvalidRequestException("请输入正确的手机号!");
|
|
|
|
}
|
|
|
|
//验证请求间隔超时,防止频繁获取验证码
|
|
|
|
if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
|
|
|
|
throw new IllegalAccessException("SMS request frequency is too fast");
|
|
|
|
}
|
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
|
|
|
|
if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
|
|
|
|
String captcha = wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
Captcha _captcha = new Captcha();
|
|
|
|
_captcha.setCode(captcha);
|
|
|
|
_captcha.setExpiresIn(300);
|
|
|
|
wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
|
|
|
|
|
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("success", 200);
|
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
|
headers.set("Cache-Control", "no-store");
|
|
|
|
headers.set("Pragma", "no-cache");
|
|
|
|
return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
|
|
|
|
}else {
|
|
|
|
//发送短信获取验证码
|
|
|
|
String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
|
|
|
|
int result = zbSmsService.sendMessage(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, null);
|
|
|
|
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("验证码发送失败!");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/oauth/sendCaptcha", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/oauth/sendCaptcha", method = RequestMethod.GET)
|
|
public ResponseEntity<Oauth2Envelop<Captcha>> sendCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
|
|
public ResponseEntity<Oauth2Envelop<Captcha>> sendCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
|
|
String wxId = parameters.get("wxId");
|
|
String wxId = parameters.get("wxId");
|
|
@ -615,6 +678,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
return sendZSCaptcha(parameters);
|
|
return sendZSCaptcha(parameters);
|
|
}else if ("xm_xzzx_wx".equals(wxId)){
|
|
}else if ("xm_xzzx_wx".equals(wxId)){
|
|
return sendXZCaptcha(parameters);
|
|
return sendXZCaptcha(parameters);
|
|
|
|
}else if ("sd_tnzyy_wx".equals(wxId)){
|
|
|
|
return sendZBCaptcha(parameters);
|
|
}
|
|
}
|
|
throw new IllegalStateException("验证码发送失败");
|
|
throw new IllegalStateException("验证码发送失败");
|
|
}
|
|
}
|