|
@ -34,7 +34,6 @@ import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiParam;
|
|
import io.swagger.annotations.ApiParam;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
import org.apache.el.lang.ELArithmetic;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -510,6 +509,62 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
throw new IllegalStateException("验证码发送失败!");
|
|
throw new IllegalStateException("验证码发送失败!");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 心脏医院短信接口
|
|
|
|
* @param parameters
|
|
|
|
* @return
|
|
|
|
* @throws Exception
|
|
|
|
*/
|
|
|
|
@RequestMapping(value = "/oauth/sendXZCaptcha", method = RequestMethod.GET)
|
|
|
|
public ResponseEntity<Oauth2Envelop<Captcha>> sendXZCaptcha(@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");
|
|
|
|
}
|
|
|
|
//发送短信获取验证码
|
|
|
|
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("验证码发送失败!");
|
|
|
|
}
|
|
|
|
|
|
@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");
|
|
@ -517,12 +572,14 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
return sendYKCaptcha(parameters);
|
|
return sendYKCaptcha(parameters);
|
|
}else if("xm_zsyy_wx".equals(wxId)){
|
|
}else if("xm_zsyy_wx".equals(wxId)){
|
|
return sendZSCaptcha(parameters);
|
|
return sendZSCaptcha(parameters);
|
|
|
|
}else if ("xm_xzzx_wx".equals(wxId)){
|
|
|
|
return sendXZCaptcha(parameters);
|
|
}
|
|
}
|
|
throw new IllegalStateException("验证码发送失败");
|
|
throw new IllegalStateException("验证码发送失败");
|
|
}
|
|
}
|
|
|
|
|
|
//眼科医院短信验证码
|
|
//眼科医院短信验证码
|
|
@RequestMapping(value = "/oauth/sendYKCaptcha", method = RequestMethod.GET)
|
|
|
|
|
|
@RequestMapping(value = "/oauth/sendYKCaptcha", method = RequestMethod.GET)
|
|
public ResponseEntity<Oauth2Envelop<Captcha>> sendYKCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
|
|
public ResponseEntity<Oauth2Envelop<Captcha>> sendYKCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
|
|
String client_id = parameters.get("client_id");
|
|
String client_id = parameters.get("client_id");
|
|
String username = parameters.get("username");
|
|
String username = parameters.get("username");
|