|
@ -404,6 +404,14 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
Oauth2Envelop<WlyyUserSimple> oauth2Envelop = new Oauth2Envelop<>("获取用户手机号失败", -1, null);
|
|
|
return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
|
|
|
}
|
|
|
} else if("1".equals(parameters.get("pwdAndCaptcha"))){
|
|
|
parameters.put("grant_type", "pwdAndCaptcha");
|
|
|
KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
|
|
|
String password = com.yihu.jw.security.utils.RSAUtils.decryptBase64(parameters.get("password"), keyPair);
|
|
|
parameters.put("password", password);
|
|
|
if (!testPwd(parameters.get("password"))) {
|
|
|
throw new PwdException("密码强度低,请用验证码登录,或者修改密码后在重新登录!");
|
|
|
}
|
|
|
}else if (StringUtils.isEmpty(parameters.get("captcha"))) {
|
|
|
parameters.put("grant_type", "password");
|
|
|
//解密密码
|
|
@ -433,7 +441,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
throw new UnsupportedGrantTypeException("Unsupported grant type: " + tokenRequest.getGrantType());
|
|
|
}
|
|
|
|
|
|
//账户密码登录的才验证密码强度
|
|
|
//账户密码登录的才验证密码强度
|
|
|
if ("hz_yyyzh_wx".equals(wechatId)||
|
|
|
"iottest".equals(springProfile)||//物联网
|
|
|
"iotprod".equals(springProfile)||//物联网
|
|
@ -442,7 +450,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
String grant_type = parameters.get("grant_type");
|
|
|
if ("password".equals(grant_type)) {
|
|
|
if (!testPwd(parameters.get("password"))) {
|
|
|
throw new PwdException("密码强度低,请用验证码登录,或者修改密码后在从新登录!");
|
|
|
throw new PwdException("密码强度低,请用验证码登录,或者修改密码后在重新登录!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -1093,9 +1101,9 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
}
|
|
|
}
|
|
|
if("xm_ykyy_wx".equals(wxId)){
|
|
|
return sendYKCaptcha(parameters);
|
|
|
return sendYKCaptcha(parameters);
|
|
|
}else if("xm_zsyy_wx".equals(wxId)){
|
|
|
return sendZSCaptcha(parameters);
|
|
|
return sendZSCaptcha(parameters);
|
|
|
}else if ("xm_xzzx_wx".equals(wxId)){
|
|
|
return sendXZCaptcha(parameters);
|
|
|
}else if ("sd_tnzyy_wx".equals(wxId)){
|
|
@ -1554,7 +1562,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
//固定秘钥解密
|
|
|
String key = "FEA5049E4CCD16A9";
|
|
|
String result = AesEncryptUtils.decrypt(data,key);
|
|
|
/* String result = AES.decrypt(key,data);*/
|
|
|
/* String result = AES.decrypt(key,data);*/
|
|
|
logger.info("wjwLogin :"+result);
|
|
|
|
|
|
|
|
@ -2481,7 +2489,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
}*/
|
|
|
@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
|
|
|
,String geetestChallenge,String geetestValidate,String geetestSeccode )throws Exception{
|
|
|
,String geetestChallenge,String geetestValidate,String geetestSeccode )throws Exception{
|
|
|
|
|
|
if (StringUtils.isEmpty(client_id)) {
|
|
|
throw new InvalidRequestException("client_id is null");
|
|
@ -2658,7 +2666,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
@RequestMapping(value = "/oauth/findDoctorPw", method = RequestMethod.POST)
|
|
|
public Envelop findDoctorPw(String mobile,String client_id,String captcha,String pw) throws Exception{
|
|
|
if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
|
|
|
String response = ykyyService.ResetPwd(mobile,pw,captcha);
|
|
|
String response = ykyyService.ResetPwd(mobile,pw,captcha);
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(response)){
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if (object.getString("code").equalsIgnoreCase("10000")){
|
|
@ -2787,10 +2795,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
List<BasePatientDO> patientSize = new ArrayList<>();
|
|
|
switch (type){
|
|
|
case "idcard":
|
|
|
patientSize = basePatientDao.findByIdcard(id);
|
|
|
patientSize = basePatientDao.findByIdcard(id);
|
|
|
break;
|
|
|
case "mobile":
|
|
|
patientSize = basePatientDao.findByMobile(id);
|
|
|
patientSize = basePatientDao.findByMobile(id);
|
|
|
break;
|
|
|
}
|
|
|
if (patientSize.size()<0){
|
|
@ -3282,108 +3290,108 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
return getFailedResponse(object.getString("msg"),-1,userSimple);
|
|
|
}
|
|
|
}
|
|
|
String response = ykyyService.yktLogin(parameters.get("username"),password);
|
|
|
if (!StringUtils.isEmpty(response)){
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if (!object.getString("code").equalsIgnoreCase("200")){
|
|
|
throw new Exception(object.getString("msg"));
|
|
|
}else {
|
|
|
JSONObject jsonObject = object.getJSONObject("data");
|
|
|
if (jsonObject!=null){
|
|
|
String userId= jsonObject.getString("ID");
|
|
|
String tel = jsonObject.getString("LOGINID");
|
|
|
List<BasePatientDO> basePatientDOS = basePatientDao.findByMobile(tel);
|
|
|
if (basePatientDOS==null||basePatientDOS.size()==0){
|
|
|
BasePatientDO basePatientDO = new BasePatientDO();
|
|
|
String familyList = ykyyService.getFamilyList(null,userId);
|
|
|
JSONObject familyJson = JSONObject.parseObject(familyList);
|
|
|
if (familyJson.getString("code").equalsIgnoreCase("200")){
|
|
|
JSONObject object1 = familyJson.getJSONObject("data");
|
|
|
JSONArray list = object1.getJSONArray("list");
|
|
|
List<String> iliness = new ArrayList<>();
|
|
|
if (list!=null&&list.size()!=0){
|
|
|
for (int i=0;i<list.size();i++){
|
|
|
JSONObject family = list.getJSONObject(i);
|
|
|
iliness.add(family.getString("ILLNESS"));
|
|
|
if (family.getString("ILLNESS").equalsIgnoreCase("本人")&&tel.equalsIgnoreCase(family.getString("TEL"))){
|
|
|
String response = ykyyService.yktLogin(parameters.get("username"),password);
|
|
|
if (!StringUtils.isEmpty(response)){
|
|
|
JSONObject object = JSONObject.parseObject(response);
|
|
|
if (!object.getString("code").equalsIgnoreCase("200")){
|
|
|
throw new Exception(object.getString("msg"));
|
|
|
}else {
|
|
|
JSONObject jsonObject = object.getJSONObject("data");
|
|
|
if (jsonObject!=null){
|
|
|
String userId= jsonObject.getString("ID");
|
|
|
String tel = jsonObject.getString("LOGINID");
|
|
|
List<BasePatientDO> basePatientDOS = basePatientDao.findByMobile(tel);
|
|
|
if (basePatientDOS==null||basePatientDOS.size()==0){
|
|
|
BasePatientDO basePatientDO = new BasePatientDO();
|
|
|
String familyList = ykyyService.getFamilyList(null,userId);
|
|
|
JSONObject familyJson = JSONObject.parseObject(familyList);
|
|
|
if (familyJson.getString("code").equalsIgnoreCase("200")){
|
|
|
JSONObject object1 = familyJson.getJSONObject("data");
|
|
|
JSONArray list = object1.getJSONArray("list");
|
|
|
List<String> iliness = new ArrayList<>();
|
|
|
if (list!=null&&list.size()!=0){
|
|
|
for (int i=0;i<list.size();i++){
|
|
|
JSONObject family = list.getJSONObject(i);
|
|
|
iliness.add(family.getString("ILLNESS"));
|
|
|
if (family.getString("ILLNESS").equalsIgnoreCase("本人")&&tel.equalsIgnoreCase(family.getString("TEL"))){
|
|
|
basePatientDO.setDel("1");
|
|
|
basePatientDO.setName(family.getString("NAME"));
|
|
|
basePatientDO.setCreateTime(new Date());
|
|
|
basePatientDO.setUpdateTime(new Date());
|
|
|
basePatientDO.setYktId(family.getString("ID"));
|
|
|
basePatientDO.setUserId(userId);
|
|
|
basePatientDO.setIdcard(family.getString("IDCARD"));
|
|
|
String idcard = family.getString("IDCARD");
|
|
|
Integer age = IdCardUtil.getAgeForIdcard(idcard);
|
|
|
String sex = IdCardUtil.getSexForIdcard_new(idcard);
|
|
|
Integer sexx = null;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(sex)){
|
|
|
sexx = Integer.parseInt(sex);
|
|
|
}
|
|
|
String birthDay = family.getString("BIRTHDAY");
|
|
|
Date birthday = null;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(birthDay)){
|
|
|
birthday = DateUtil.strToDate(birthDay+" 00:00:00");;
|
|
|
}
|
|
|
basePatientDO.setBirthday(birthday);
|
|
|
basePatientDO.setSex(sexx);
|
|
|
basePatientDO.setMobile(tel);
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
String pw = idcard.substring(idcard.length()-6,idcard.length());
|
|
|
basePatientDO.setIdcard(idcard);
|
|
|
basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
basePatientDO.setSalt(salt);
|
|
|
basePatientDO.setLocked(0);
|
|
|
basePatientDO.setEnabled(1);
|
|
|
basePatientDO.setVerifyCode(jsonObject.getString("TOKEN"));
|
|
|
basePatientDO.setPatientStatus("1");
|
|
|
basePatientDao.save(basePatientDO);
|
|
|
}else {
|
|
|
List<BasePatientDO> basePatientDOList = basePatientDao.findByMobile(tel);
|
|
|
if(basePatientDOList==null||basePatientDOList.size()==0){
|
|
|
basePatientDO.setDel("1");
|
|
|
basePatientDO.setName(family.getString("NAME"));
|
|
|
if (jsonObject.getString("USERNAME").length()>=2){
|
|
|
basePatientDO.setName(jsonObject.getString("USERNAME"));
|
|
|
}else {
|
|
|
basePatientDO.setName(tel);
|
|
|
}
|
|
|
basePatientDO.setCreateTime(new Date());
|
|
|
basePatientDO.setUpdateTime(new Date());
|
|
|
basePatientDO.setYktId(family.getString("ID"));
|
|
|
basePatientDO.setYktId(jsonObject.getString("ID"));
|
|
|
basePatientDO.setUserId(userId);
|
|
|
basePatientDO.setIdcard(family.getString("IDCARD"));
|
|
|
String idcard = family.getString("IDCARD");
|
|
|
Integer age = IdCardUtil.getAgeForIdcard(idcard);
|
|
|
String sex = IdCardUtil.getSexForIdcard_new(idcard);
|
|
|
Integer sexx = null;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(sex)){
|
|
|
sexx = Integer.parseInt(sex);
|
|
|
}
|
|
|
String birthDay = family.getString("BIRTHDAY");
|
|
|
Date birthday = null;
|
|
|
if (org.apache.commons.lang3.StringUtils.isNoneBlank(birthDay)){
|
|
|
birthday = DateUtil.strToDate(birthDay+" 00:00:00");;
|
|
|
}
|
|
|
basePatientDO.setBirthday(birthday);
|
|
|
basePatientDO.setSex(sexx);
|
|
|
basePatientDO.setMobile(tel);
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
String pw = idcard.substring(idcard.length()-6,idcard.length());
|
|
|
basePatientDO.setIdcard(idcard);
|
|
|
String pw = tel.substring(tel.length()-6,tel.length());
|
|
|
basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
basePatientDO.setSalt(salt);
|
|
|
basePatientDO.setLocked(0);
|
|
|
basePatientDO.setEnabled(1);
|
|
|
basePatientDO.setVerifyCode(jsonObject.getString("TOKEN"));
|
|
|
basePatientDO.setPatientStatus("1");
|
|
|
basePatientDao.save(basePatientDO);
|
|
|
}else {
|
|
|
List<BasePatientDO> basePatientDOList = basePatientDao.findByMobile(tel);
|
|
|
if(basePatientDOList==null||basePatientDOList.size()==0){
|
|
|
basePatientDO.setDel("1");
|
|
|
if (jsonObject.getString("USERNAME").length()>=2){
|
|
|
basePatientDO.setName(jsonObject.getString("USERNAME"));
|
|
|
}else {
|
|
|
basePatientDO.setName(tel);
|
|
|
}
|
|
|
basePatientDO.setCreateTime(new Date());
|
|
|
basePatientDO.setUpdateTime(new Date());
|
|
|
basePatientDO.setYktId(jsonObject.getString("ID"));
|
|
|
basePatientDO.setUserId(userId);
|
|
|
basePatientDO.setMobile(tel);
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
String pw = tel.substring(tel.length()-6,tel.length());
|
|
|
basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
basePatientDO.setSalt(salt);
|
|
|
basePatientDO.setLocked(0);
|
|
|
basePatientDO.setEnabled(1);
|
|
|
basePatientDO.setPatientStatus("1");
|
|
|
basePatientDao.save(basePatientDO);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}else {
|
|
|
}
|
|
|
}else {
|
|
|
|
|
|
if (jsonObject.getString("USERNAME").length()>=2){
|
|
|
basePatientDO.setName(jsonObject.getString("USERNAME"));
|
|
|
}else {
|
|
|
basePatientDO.setName(tel);
|
|
|
}
|
|
|
basePatientDO.setDel("1");
|
|
|
basePatientDO.setCreateTime(new Date());
|
|
|
basePatientDO.setUpdateTime(new Date());
|
|
|
basePatientDO.setUserId(userId);
|
|
|
basePatientDO.setMobile(tel);
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
String pw = tel.substring(tel.length()-6,tel.length());
|
|
|
basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
basePatientDO.setSalt(salt);
|
|
|
basePatientDO.setLocked(0);
|
|
|
basePatientDO.setEnabled(1);
|
|
|
basePatientDO.setPatientStatus("1");
|
|
|
basePatientDao.save(basePatientDO);
|
|
|
if (jsonObject.getString("USERNAME").length()>=2){
|
|
|
basePatientDO.setName(jsonObject.getString("USERNAME"));
|
|
|
}else {
|
|
|
basePatientDO.setName(tel);
|
|
|
}
|
|
|
basePatientDO.setDel("1");
|
|
|
basePatientDO.setCreateTime(new Date());
|
|
|
basePatientDO.setUpdateTime(new Date());
|
|
|
basePatientDO.setUserId(userId);
|
|
|
basePatientDO.setMobile(tel);
|
|
|
String salt = UUID.randomUUID().toString().substring(0,5);
|
|
|
String pw = tel.substring(tel.length()-6,tel.length());
|
|
|
basePatientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
|
|
|
basePatientDO.setSalt(salt);
|
|
|
basePatientDO.setLocked(0);
|
|
|
basePatientDO.setEnabled(1);
|
|
|
basePatientDO.setPatientStatus("1");
|
|
|
basePatientDao.save(basePatientDO);
|
|
|
}
|
|
|
/*String birdth = com.yihu.jw.util.idcard.IdCardUtil.getBirthdayForIdcardStr(basePatientDO.getIdcard());
|
|
|
Integer age = com.yihu.jw.util.idcard.IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
|
|
|
Integer sex = basePatientDO.getSex()!=null?basePatientDO.getSex():0;
|
|
@ -3394,21 +3402,21 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
}else {
|
|
|
ykyyService.addFamily(basePatientDO.getUserId(),basePatientDO.getIdcard(),basePatientDO.getName(),sex+"",birdth,age+"",basePatientDO.getMobile());
|
|
|
}*/
|
|
|
}
|
|
|
}else {
|
|
|
logger.info("======"+jsonObject.getString("USERNAME")+"======");
|
|
|
logger.info("tel"+jsonObject.getString("USERNAME"));
|
|
|
BasePatientDO basePatientDO1 = basePatientDOS.get(0);
|
|
|
if (basePatientDO1.getName()==null||basePatientDO1.getName()==""){
|
|
|
if (jsonObject.getString("USERNAME").length()>=2){
|
|
|
basePatientDO1.setName(jsonObject.getString("USERNAME"));
|
|
|
}else {
|
|
|
basePatientDO1.setName(tel);
|
|
|
}
|
|
|
}else {
|
|
|
logger.info("======"+jsonObject.getString("USERNAME")+"======");
|
|
|
logger.info("tel"+jsonObject.getString("USERNAME"));
|
|
|
BasePatientDO basePatientDO1 = basePatientDOS.get(0);
|
|
|
if (basePatientDO1.getName()==null||basePatientDO1.getName()==""){
|
|
|
if (jsonObject.getString("USERNAME").length()>=2){
|
|
|
basePatientDO1.setName(jsonObject.getString("USERNAME"));
|
|
|
}else {
|
|
|
basePatientDO1.setName(tel);
|
|
|
}
|
|
|
}
|
|
|
basePatientDO1.setVerifyCode(jsonObject.getString("TOKEN"));
|
|
|
basePatientDO1.setUserId(userId);
|
|
|
basePatientDao.save(basePatientDO1);
|
|
|
}
|
|
|
basePatientDO1.setVerifyCode(jsonObject.getString("TOKEN"));
|
|
|
basePatientDO1.setUserId(userId);
|
|
|
basePatientDao.save(basePatientDO1);
|
|
|
/*String familyList = ykyyService.getFamilyList(null,userId);
|
|
|
JSONObject familyJson = JSONObject.parseObject(familyList);
|
|
|
if (familyJson.getString("code").equalsIgnoreCase("200")){
|
|
@ -3437,12 +3445,12 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
}
|
|
|
|
|
|
}*/
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
parameters.remove("password");
|
|
|
} else if (!StringUtils.isEmpty(loginType)&&"3".equalsIgnoreCase(loginType)){
|
|
|
}
|
|
|
parameters.remove("password");
|
|
|
} else if (!StringUtils.isEmpty(loginType)&&"3".equalsIgnoreCase(loginType)){
|
|
|
if (wlyyRedisVerifyCodeService.verification(client_id, username, captcha)) {
|
|
|
//验证码正确
|
|
|
}
|
|
@ -3598,7 +3606,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
}
|
|
|
}else if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
|
|
|
//验证码正确
|
|
|
//验证码正确
|
|
|
} else {
|
|
|
return ObjEnvelop.getError("验证码错误!");
|
|
|
}
|