|
@ -499,22 +499,37 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
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) {
|
|
|
|
|
|
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<>("captcha", 200, null);
|
|
|
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 = 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, 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("验证码发送失败!");
|
|
|
}
|
|
@ -542,35 +557,50 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
|
|
|
throw new IllegalAccessException("SMS request frequency is too fast");
|
|
|
}
|
|
|
//发送短信获取验证码
|
|
|
String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("operatetel","18788888888");
|
|
|
object.put("interfaceid","jcpt");
|
|
|
object.put("interfacepwd","jcpt");
|
|
|
object.put("operator","xxgwxgzh");
|
|
|
object.put("operateid","xxgwxgzh");
|
|
|
JSONArray array = new JSONArray();
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("content","您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
|
|
|
jsonObject.put("sendtel",username);
|
|
|
jsonObject.put("sendtime",DateUtil.dateToStrLong(new Date()));
|
|
|
array.add(jsonObject);
|
|
|
object.put("messageinfo",array);
|
|
|
int result = xzzxService.SendSms(object.toJSONString());
|
|
|
|
|
|
if (0 == result) {
|
|
|
|
|
|
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<>("captcha", 200, null);
|
|
|
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();
|
|
|
JSONObject object = new JSONObject();
|
|
|
object.put("operatetel","18788888888");
|
|
|
object.put("interfaceid","jcpt");
|
|
|
object.put("interfacepwd","jcpt");
|
|
|
object.put("operator","xxgwxgzh");
|
|
|
object.put("operateid","xxgwxgzh");
|
|
|
JSONArray array = new JSONArray();
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("content","您好,你的手机登录短信验证码是:"+captcha+",5分钟内有效。");
|
|
|
jsonObject.put("sendtel",username);
|
|
|
jsonObject.put("sendtime",DateUtil.dateToStrLong(new Date()));
|
|
|
array.add(jsonObject);
|
|
|
object.put("messageinfo",array);
|
|
|
int result = xzzxService.SendSms(object.toJSONString());
|
|
|
|
|
|
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("验证码发送失败!");
|
|
|
}
|
|
@ -606,90 +636,106 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
|
|
|
throw new IllegalAccessException("SMS request frequency is too fast");
|
|
|
}
|
|
|
if ("1".equalsIgnoreCase(isDoctor)){
|
|
|
String res = ykyyService.getResetCode("4",username);
|
|
|
String resltCode ="";
|
|
|
String captcha = "";
|
|
|
if (!StringUtils.isEmpty(res)){
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
|
|
|
captcha = jsonObject.getString("value");
|
|
|
resltCode = jsonObject.getString("code");
|
|
|
msg = "发送成功";
|
|
|
}
|
|
|
}
|
|
|
if ("10000".equalsIgnoreCase(resltCode)) {
|
|
|
|
|
|
Captcha _captcha = new Captcha();
|
|
|
_captcha.setCode(captcha);
|
|
|
_captcha.setExpiresIn(300);
|
|
|
wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
|
|
|
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
|
|
|
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("验证码发送失败!");
|
|
|
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<>(msg, 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();
|
|
|
ResultMsg result= null;
|
|
|
if(StringUtils.isEmpty(type)){
|
|
|
String res = ykyyService.getShortMessage("1",username);
|
|
|
if ("1".equalsIgnoreCase(isDoctor)){
|
|
|
String res = ykyyService.getResetCode("4",username);
|
|
|
String resltCode ="";
|
|
|
String captcha1 = "";
|
|
|
String captcha = "";
|
|
|
if (!StringUtils.isEmpty(res)){
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
|
|
|
captcha1 = jsonObject.getString("value");
|
|
|
captcha = jsonObject.getString("value");
|
|
|
resltCode = jsonObject.getString("code");
|
|
|
}else if("199".equalsIgnoreCase(jsonObject.getString("code"))){
|
|
|
msg = jsonObject.getString("msg");
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 199);
|
|
|
return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
|
|
|
}else {
|
|
|
msg="发送失败";
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, -1);
|
|
|
return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
|
|
|
msg = "发送成功";
|
|
|
}
|
|
|
}
|
|
|
if ("10000".equalsIgnoreCase(resltCode)) {
|
|
|
|
|
|
Captcha _captcha = new Captcha();
|
|
|
_captcha.setCode(captcha1);
|
|
|
_captcha.setCode(captcha);
|
|
|
_captcha.setExpiresIn(300);
|
|
|
wlyyRedisVerifyCodeService.store(client_id, username, captcha1, 300);
|
|
|
wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
|
|
|
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200);
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.set("Cache-Control", "no-store");
|
|
|
headers.set("Pragma", "no-cache");
|
|
|
return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
|
|
|
}
|
|
|
}else if("1".equals(type)){
|
|
|
result = ykyySMSService.ykyySendSMS(username,"您好,您的手机登录短信验证码是:"+captcha+",5分钟内有效。");
|
|
|
}else if("2".equals(type)) {
|
|
|
result = ykyySMSService.ykyySendSMS(username, "您好,您正在进行找回密码操作,您的短信验证码是:" + captcha + ",请勿将验证码告诉他人,5分钟内有效。");
|
|
|
}
|
|
|
if (result.isSuccess()) {
|
|
|
Captcha _captcha = new Captcha();
|
|
|
_captcha.setCode(captcha);
|
|
|
_captcha.setExpiresIn(300);
|
|
|
wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
|
|
|
throw new IllegalStateException("验证码发送失败!");
|
|
|
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 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();
|
|
|
ResultMsg result= null;
|
|
|
if(StringUtils.isEmpty(type)){
|
|
|
String res = ykyyService.getShortMessage("1",username);
|
|
|
String resltCode ="";
|
|
|
String captcha1 = "";
|
|
|
if (!StringUtils.isEmpty(res)){
|
|
|
JSONObject jsonObject = JSONObject.parseObject(res);
|
|
|
if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
|
|
|
captcha1 = jsonObject.getString("value");
|
|
|
resltCode = jsonObject.getString("code");
|
|
|
}else if("199".equalsIgnoreCase(jsonObject.getString("code"))){
|
|
|
msg = jsonObject.getString("msg");
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 199);
|
|
|
return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
|
|
|
}else {
|
|
|
msg="发送失败";
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, -1);
|
|
|
return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
|
|
|
}
|
|
|
}
|
|
|
if ("10000".equalsIgnoreCase(resltCode)) {
|
|
|
|
|
|
Captcha _captcha = new Captcha();
|
|
|
_captcha.setCode(captcha1);
|
|
|
_captcha.setExpiresIn(300);
|
|
|
wlyyRedisVerifyCodeService.store(client_id, username, captcha1, 300);
|
|
|
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200);
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.set("Cache-Control", "no-store");
|
|
|
headers.set("Pragma", "no-cache");
|
|
|
return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
|
|
|
}
|
|
|
}else if("1".equals(type)){
|
|
|
result = ykyySMSService.ykyySendSMS(username,"您好,您的手机登录短信验证码是:"+captcha+",5分钟内有效。");
|
|
|
}else if("2".equals(type)) {
|
|
|
result = ykyySMSService.ykyySendSMS(username, "您好,您正在进行找回密码操作,您的短信验证码是:" + captcha + ",请勿将验证码告诉他人,5分钟内有效。");
|
|
|
}
|
|
|
if (result.isSuccess()) {
|
|
|
Captcha _captcha = new Captcha();
|
|
|
_captcha.setCode(captcha);
|
|
|
_captcha.setExpiresIn(300);
|
|
|
wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
|
|
|
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200);
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.set("Cache-Control", "no-store");
|
|
|
headers.set("Pragma", "no-cache");
|
|
|
return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
|
|
|
}
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
|
|
|
return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
|
|
|
}
|
|
|
Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>(msg, 200);
|
|
|
return new ResponseEntity<>(oauth2Envelop, HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -1642,13 +1688,20 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
|
|
|
@RequestMapping(value = "/oauth/findPatientPw", method = RequestMethod.POST)
|
|
|
public Envelop findPatientPw(String mobile,String client_id,String login_type,String captcha,String pw)throws Exception {
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
|
|
|
if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
|
|
|
if (captcha.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
|
|
|
|
|
|
if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
|
|
|
//验证码正确
|
|
|
} else {
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
}else {
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
}
|
|
|
}else {
|
|
|
if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
|
|
|
//验证码正确
|
|
|
} else {
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
String rs = registerService.updatePatientPw(pw,mobile);
|
|
|
if("ok".equals(rs)){
|
|
|
return ObjEnvelop.getSuccess("修改成功!");
|
|
@ -1671,10 +1724,15 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
return ObjEnvelop.getError("修改失败!");
|
|
|
}
|
|
|
}else if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
|
|
|
//验证码正确
|
|
|
} else {
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedSMS");
|
|
|
if (wlyyHospitalSysDictDO!=null&&!StringUtils.isEmpty(wlyyHospitalSysDictDO.getDictValue())){
|
|
|
|
|
|
}else {
|
|
|
if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
|
|
|
//验证码正确
|
|
|
} else {
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
}
|
|
|
}
|
|
|
String rs = registerService.updateDoctorPw(mobile,pw,wechatId);
|
|
|
if("ok".equals(rs)){
|