|
@ -32,6 +32,7 @@ import com.yihu.jw.sms.service.YkyyINSMSService;
|
|
import com.yihu.jw.sms.service.ZBSmsService;
|
|
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.jw.util.http.HttpClientUtil;
|
|
import com.yihu.utils.network.HttpResponse;
|
|
import com.yihu.utils.network.HttpResponse;
|
|
import com.yihu.utils.network.HttpUtils;
|
|
import com.yihu.utils.network.HttpUtils;
|
|
import com.yihu.utils.security.MD5;
|
|
import com.yihu.utils.security.MD5;
|
|
@ -40,6 +41,8 @@ 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.http.NameValuePair;
|
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
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;
|
|
@ -157,12 +160,84 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
private WechatDao wechatDao;
|
|
private WechatDao wechatDao;
|
|
@Autowired
|
|
@Autowired
|
|
private WlyyHospitalSysDictDao wlyyhospitalSysdictDao;
|
|
private WlyyHospitalSysDictDao wlyyhospitalSysdictDao;
|
|
|
|
@Autowired
|
|
|
|
private HttpClientUtil httpClientUtil;
|
|
|
|
|
|
|
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
private void init() {
|
|
private void init() {
|
|
super.setTokenGranter(tokenGranter);
|
|
super.setTokenGranter(tokenGranter);
|
|
}
|
|
}
|
|
|
|
@RequestMapping(value = "/oauth/getGeetConfig", method = RequestMethod.GET)
|
|
|
|
public JSONObject getGeetConfig(String isPaitent){
|
|
|
|
//患者端id
|
|
|
|
String gt="d99d7ba0ce0ad944d02c11e2e00b184f";
|
|
|
|
//医生端id
|
|
|
|
String gtDoctor="65234b3ce5a6fed467ef64bcc4330605";
|
|
|
|
String url = "http://bypass.geetest.com/v1/bypass_status.php";
|
|
|
|
String register="http://localhost:8088/register";
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
JSONObject returnResult = new JSONObject();
|
|
|
|
List<WlyyHospitalSysDictDO> list = wlyyhospitalSysdictDao.findByDictName("geetConfig");
|
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:list){
|
|
|
|
if ("type".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
|
result.put("type",wlyyHospitalSysDictDO.getDictValue());
|
|
|
|
}
|
|
|
|
if ("register".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
|
register = wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
if ("bypass".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
|
url = wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!"1".equalsIgnoreCase(isPaitent)){
|
|
|
|
gt=gtDoctor;
|
|
|
|
}
|
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
|
params.add(new BasicNameValuePair("gt",gt));
|
|
|
|
String res = httpClientUtil.post(url, params, "UTF-8");
|
|
|
|
JSONObject statusObject = JSONObject.parseObject(res);
|
|
|
|
if (statusObject!=null){
|
|
|
|
result.put("offline",statusObject.getString("status"));
|
|
|
|
}
|
|
|
|
System.out.println(res);
|
|
|
|
|
|
|
|
Long t= new Date().getTime();
|
|
|
|
String registerRes= httpClientUtil.get(register+"?t="+t+"&isPatient="+isPaitent,"UTF-8");
|
|
|
|
System.out.println(registerRes);
|
|
|
|
JSONObject registerObject= JSONObject.parseObject(registerRes);
|
|
|
|
if (registerObject!=null){
|
|
|
|
result.put("challenge",registerObject.getString("challenge"));
|
|
|
|
result.put("newCaptcha",registerObject.getString("new_captcha"));
|
|
|
|
}
|
|
|
|
result.put("gt",gt);
|
|
|
|
|
|
|
|
System.out.println(result.toJSONString());
|
|
|
|
returnResult.put("status",200);
|
|
|
|
returnResult.put("message","success");
|
|
|
|
returnResult.put("obj",result);
|
|
|
|
return returnResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
public JSONObject validateGeet( String geetestChallenge,String geetestValidate,String geetestSeccode,String isPatient){
|
|
|
|
|
|
|
|
String validateUrl = "http://localhost:8088/validate";
|
|
|
|
List<WlyyHospitalSysDictDO> list = wlyyhospitalSysdictDao.findByDictName("geetConfig");
|
|
|
|
for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:list){
|
|
|
|
if ("validateUrl".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
|
|
|
|
validateUrl=wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
List<NameValuePair> params = new ArrayList<>();
|
|
|
|
params.add(new BasicNameValuePair("geetest_challenge",geetestChallenge));
|
|
|
|
params.add(new BasicNameValuePair("geetest_validate",geetestValidate));
|
|
|
|
params.add(new BasicNameValuePair("geetest_seccode",geetestSeccode));
|
|
|
|
params.add(new BasicNameValuePair("isPatient",isPatient));
|
|
|
|
String res = httpClientUtil.post(validateUrl, params, "UTF-8");
|
|
|
|
JSONObject statusObject = JSONObject.parseObject(res);
|
|
|
|
System.out.println(statusObject.toJSONString());
|
|
|
|
return statusObject;
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
* 登陆
|
|
* 登陆
|
|
@ -187,6 +262,20 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
//图形验证码验证
|
|
//图形验证码验证
|
|
String key = parameters.get("key");
|
|
String key = parameters.get("key");
|
|
String text = parameters.get("text");
|
|
String text = parameters.get("text");
|
|
|
|
String isNeedGeet= "1";
|
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO= wlyyhospitalSysdictDao.findDictById("isNeedGeet");
|
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
|
|
isNeedGeet=wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)&&"1".equalsIgnoreCase(isNeedGeet)){
|
|
|
|
String geetestChallenge = parameters.get("geetestChallenge");
|
|
|
|
String geetestValidate = parameters.get("geetestValidate");
|
|
|
|
String geetestSeccode = parameters.get("geetestSeccode");
|
|
|
|
JSONObject resResult =validateGeet(geetestChallenge,geetestValidate,geetestSeccode,"1");
|
|
|
|
if (resResult==null||!resResult.getString("result").equalsIgnoreCase("success")){
|
|
|
|
throw new Exception("验证失败");
|
|
|
|
}
|
|
|
|
}
|
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
|
|
if(org.apache.commons.lang3.StringUtils.isNotBlank(key)&& org.apache.commons.lang3.StringUtils.isNotBlank(text)){
|
|
if(!verifyCaptcha(key,text)){
|
|
if(!verifyCaptcha(key,text)){
|
|
throw new ImgCaptchaException("img_captcha error");
|
|
throw new ImgCaptchaException("img_captcha error");
|
|
@ -781,6 +870,15 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
if (StringUtils.isEmpty(username)) {
|
|
if (StringUtils.isEmpty(username)) {
|
|
throw new InvalidRequestException("username");
|
|
throw new InvalidRequestException("username");
|
|
}
|
|
}
|
|
|
|
if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
|
String geetestChallenge = parameters.get("geetestChallenge");
|
|
|
|
String geetestValidate = parameters.get("geetestValidate");
|
|
|
|
String geetestSeccode = parameters.get("geetestSeccode");
|
|
|
|
JSONObject resResult =validateGeet(geetestChallenge,geetestValidate,geetestSeccode,"1".equalsIgnoreCase(isDoctor)?"2":"1");
|
|
|
|
if (resResult==null||!resResult.getString("result").equalsIgnoreCase("success")){
|
|
|
|
throw new Exception("验证失败");
|
|
|
|
}
|
|
|
|
}
|
|
//验证请求间隔超时,防止频繁获取验证码
|
|
//验证请求间隔超时,防止频繁获取验证码
|
|
if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
|
|
if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
|
|
throw new IllegalAccessException("SMS request frequency is too fast");
|
|
throw new IllegalAccessException("SMS request frequency is too fast");
|
|
@ -1759,7 +1857,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
return ObjEnvelop.getError("登录失败!");
|
|
return ObjEnvelop.getError("登录失败!");
|
|
}*/
|
|
}*/
|
|
@RequestMapping(value = "/oauth/registerPatientAndLogin", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/oauth/registerPatientAndLogin", method = RequestMethod.POST)
|
|
public ObjEnvelop registerPatientAndLogin(String name, String mobile, String idcard, String ssc, String pw,String client_id,String login_type,String captcha,String openid,String wxId)throws Exception{
|
|
|
|
|
|
public ObjEnvelop registerPatientAndLogin(String name, String mobile, String idcard, String ssc, String pw,String client_id,String login_type,String captcha,String openid,String wxId
|
|
|
|
,String geetestChallenge,String geetestValidate,String geetestSeccode )throws Exception{
|
|
|
|
|
|
if (StringUtils.isEmpty(client_id)) {
|
|
if (StringUtils.isEmpty(client_id)) {
|
|
throw new InvalidRequestException("client_id is null");
|
|
throw new InvalidRequestException("client_id is null");
|
|
@ -1770,6 +1869,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
} else {
|
|
} else {
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
}
|
|
}
|
|
|
|
/*JSONObject resResult =validateGeet(geetestChallenge,geetestValidate,geetestSeccode,"1");
|
|
|
|
if (resResult==null||!resResult.getString("result").equalsIgnoreCase("success")){
|
|
|
|
return ObjEnvelop.getError("验证失败!");
|
|
|
|
}*/
|
|
if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
try {
|
|
try {
|
|
List<BasePatientDO> basePatientDOS =basePatientDao.findByMobileAndDel(mobile,"1");
|
|
List<BasePatientDO> basePatientDOS =basePatientDao.findByMobileAndDel(mobile,"1");
|
|
@ -2073,6 +2176,21 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
String captcha = parameters.get("captcha");
|
|
String captcha = parameters.get("captcha");
|
|
String loginType = parameters.get("login_type");
|
|
String loginType = parameters.get("login_type");
|
|
String appletCode = parameters.get("appletCode");
|
|
String appletCode = parameters.get("appletCode");
|
|
|
|
String isNeedGeet= "0";//1需要 0不需要
|
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO= wlyyhospitalSysdictDao.findDictById("isNeedGeet");
|
|
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
|
|
isNeedGeet=wlyyHospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
if ("1".equalsIgnoreCase(isNeedGeet)){
|
|
|
|
String geetestChallenge = parameters.get("geetestChallenge");
|
|
|
|
String geetestValidate = parameters.get("geetestValidate");
|
|
|
|
String geetestSeccode = parameters.get("geetestSeccode");
|
|
|
|
JSONObject resResult =validateGeet(geetestChallenge,geetestValidate,geetestSeccode,"1");
|
|
|
|
if (resResult==null||!resResult.getString("result").equalsIgnoreCase("success")){
|
|
|
|
throw new Exception("验证失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//图形验证码验证
|
|
//图形验证码验证
|
|
String key = parameters.get("key");
|
|
String key = parameters.get("key");
|
|
String text = parameters.get("text");
|
|
String text = parameters.get("text");
|
|
@ -2379,6 +2497,20 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
/*//图形验证码验证
|
|
/*//图形验证码验证
|
|
String key = parameters.get("key");
|
|
String key = parameters.get("key");
|
|
String text = parameters.get("text");*/
|
|
String text = parameters.get("text");*/
|
|
|
|
String isNeedGeet= "0";//1需要 0不需要
|
|
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO1= wlyyhospitalSysdictDao.findDictById("isNeedGeet");
|
|
|
|
if (wlyyHospitalSysDictDO1!=null){
|
|
|
|
isNeedGeet=wlyyHospitalSysDictDO1.getDictValue();
|
|
|
|
}
|
|
|
|
if("1".equalsIgnoreCase(isNeedGeet)){
|
|
|
|
String geetestChallenge = parameters.get("geetestChallenge");
|
|
|
|
String geetestValidate = parameters.get("geetestValidate");
|
|
|
|
String geetestSeccode = parameters.get("geetestSeccode");
|
|
|
|
JSONObject resResult =validateGeet(geetestChallenge,geetestValidate,geetestSeccode,"2");
|
|
|
|
if (resResult==null||!resResult.getString("result").equalsIgnoreCase("success")){
|
|
|
|
throw new Exception("验证失败");
|
|
|
|
}
|
|
|
|
}
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedPictureCode");
|
|
WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyhospitalSysdictDao.findDictById("isNeedPictureCode");
|
|
String isNeedPictureCode = "1";
|
|
String isNeedPictureCode = "1";
|
|
if (wlyyHospitalSysDictDO!=null){
|
|
if (wlyyHospitalSysDictDO!=null){
|