|
@ -27,10 +27,7 @@ import com.yihu.jw.security.oauth2.provider.WlyyTokenGranter;
|
|
import com.yihu.jw.security.oauth2.provider.error.WlyyOAuth2ExceptionTranslator;
|
|
import com.yihu.jw.security.oauth2.provider.error.WlyyOAuth2ExceptionTranslator;
|
|
import com.yihu.jw.security.service.*;
|
|
import com.yihu.jw.security.service.*;
|
|
import com.yihu.jw.security.utils.*;
|
|
import com.yihu.jw.security.utils.*;
|
|
import com.yihu.jw.sms.service.TXYSmsService;
|
|
|
|
import com.yihu.jw.sms.service.YkyyINSMSService;
|
|
|
|
import com.yihu.jw.sms.service.ZBSmsService;
|
|
|
|
import com.yihu.jw.sms.service.ZhongShanSMSService;
|
|
|
|
|
|
import com.yihu.jw.sms.service.*;
|
|
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
|
|
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
|
|
import com.yihu.jw.util.common.StringUtil;
|
|
import com.yihu.jw.util.common.StringUtil;
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
import com.yihu.jw.util.http.HttpClientUtil;
|
|
@ -165,6 +162,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
private WlyyHospitalSysDictDao wlyyhospitalSysdictDao;
|
|
private WlyyHospitalSysDictDao wlyyhospitalSysdictDao;
|
|
@Autowired
|
|
@Autowired
|
|
private HttpClientUtil httpClientUtil;
|
|
private HttpClientUtil httpClientUtil;
|
|
|
|
@Autowired
|
|
|
|
private IotSMSService iotSMSService;
|
|
|
|
|
|
|
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
@ -859,6 +858,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
return sendZBCaptcha(parameters);
|
|
return sendZBCaptcha(parameters);
|
|
}else if("hz_yyyzh_wx".equals(wxId)){
|
|
}else if("hz_yyyzh_wx".equals(wxId)){
|
|
return sendTXYCaptcha(parameters);
|
|
return sendTXYCaptcha(parameters);
|
|
|
|
}else if("hz_yyyzh_wx".equals(wxId)){
|
|
|
|
return sendTXYCaptcha(parameters);
|
|
|
|
}else if("xm_znyg_wx".equals(wxId)){
|
|
|
|
return sendWlyyCaptcha(parameters);
|
|
}
|
|
}
|
|
throw new IllegalStateException("验证码发送失败");
|
|
throw new IllegalStateException("验证码发送失败");
|
|
}
|
|
}
|
|
@ -2228,6 +2231,38 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/oauth/findUserPw", method = RequestMethod.POST)
|
|
|
|
public Envelop findUserPw(String mobile,String client_id,String captcha,String pw) throws Exception{
|
|
|
|
if("xm_znyg_wx".equalsIgnoreCase(wechatId)){
|
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
|
|
|
|
if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
|
|
|
|
if (captcha.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
|
|
|
|
|
|
|
|
}else {
|
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
|
|
|
|
//验证码正确
|
|
|
|
} else {
|
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String rs = registerService.updateUserPw(mobile,pw,wechatId);
|
|
|
|
if("ok".equals(rs)){
|
|
|
|
return ObjEnvelop.getSuccess("修改成功!");
|
|
|
|
}
|
|
|
|
|
|
|
|
return ObjEnvelop.getError("手机号未注册!");
|
|
|
|
}else {
|
|
|
|
return ObjEnvelop.getError("暂未开放");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/oauth/updateDoctorMoble", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/oauth/updateDoctorMoble", method = RequestMethod.POST)
|
|
public Envelop updateDoctorMoble(String id,String mobile,String client_id,String captcha){
|
|
public Envelop updateDoctorMoble(String id,String mobile,String client_id,String captcha){
|
|
if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
|
|
if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
|
|
@ -2779,4 +2814,62 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
return getResponse(wlyyUserSimple);
|
|
return getResponse(wlyyUserSimple);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 厦门i健康短信接口
|
|
|
|
* @param parameters
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
@RequestMapping(value = "/oauth/sendWlyyCaptcha", method = RequestMethod.GET)
|
|
|
|
public ResponseEntity<Oauth2Envelop<Captcha>> sendWlyyCaptcha(@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();
|
|
|
|
String result = iotSMSService.IotSendSMS(username, "您好,你的手机注册短信验证码是:" + captcha + ",5分钟内有效。");
|
|
|
|
|
|
|
|
if (result.equals("success")) {
|
|
|
|
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("验证码发送失败!");
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|