|
@ -194,8 +194,7 @@ public class WechatController extends WeixinBaseController {
|
|
|
return error(-2, "该身份证已被注册");
|
|
|
}
|
|
|
}
|
|
|
List<Patient> patients = patientService.findByMobile(mobile);
|
|
|
return write(200, "验证成功","data",patients);
|
|
|
return write(200, "验证成功");
|
|
|
} catch (Exception e) {
|
|
|
return error(-1, "验证失败");
|
|
|
}
|
|
@ -347,7 +346,6 @@ public class WechatController extends WeixinBaseController {
|
|
|
@RequestParam(required = false) String mobile,
|
|
|
@RequestParam(required = false) String captcha,
|
|
|
@RequestParam(required = false) String password,
|
|
|
@RequestParam(required = false) String patient,
|
|
|
String openid) {
|
|
|
System.out.println("login openid : " + openid);
|
|
|
String errorMessage;
|
|
@ -358,19 +356,15 @@ public class WechatController extends WeixinBaseController {
|
|
|
loginLog.setUserType("1");
|
|
|
try {
|
|
|
//账号登录 mobile可能是电话号也可能是身份证
|
|
|
if (StringUtils.isNoneEmpty(mobile) && StringUtils.isNoneEmpty(password) && !org.springframework.util.StringUtils.isEmpty(mobile)) {
|
|
|
List<Patient> patients = patientService.findByMobile(mobile);
|
|
|
Patient p =null;
|
|
|
if (patients == null||patients.size()==0) {
|
|
|
p = patientService.findByIdcard(mobile);
|
|
|
}else if(patients.size()==1){
|
|
|
p = patients.get(0);//只存在一个用户
|
|
|
}else if(patients.size()>1&&StringUtils.isBlank(patient)){
|
|
|
//多个用户返回用户让患者选择
|
|
|
return write(1, "存在多个用户", "data", patients);
|
|
|
}else if(patients.size()>1&&StringUtils.isNotBlank(patient)){
|
|
|
//传入登入者,一般只有多用户才有此操作
|
|
|
p = patientService.findByCode(patient);
|
|
|
if (StringUtils.isNoneEmpty(mobile) && StringUtils.isNoneEmpty(password)) {
|
|
|
Patient p = patientService.findByIdcard(mobile);
|
|
|
if(p==null){
|
|
|
List<Patient> patients = patientService.findByMobile(mobile);
|
|
|
if(patients.size()>1){
|
|
|
return error(-1,"此手机号码存在多个用户,请用身份证进行登录!");
|
|
|
}else if(patients.size()==1){
|
|
|
p = patients.get(0);
|
|
|
}
|
|
|
}
|
|
|
loginLog.setLoginType("2");
|
|
|
if (p == null) {
|
|
@ -441,6 +435,10 @@ public class WechatController extends WeixinBaseController {
|
|
|
}
|
|
|
//短信登录
|
|
|
if (StringUtils.isNoneEmpty(mobile) && StringUtils.isNoneEmpty(captcha)) {
|
|
|
List<Patient> patients = patientService.findByMobile(mobile);
|
|
|
if(patients.size()>1){
|
|
|
return error(-1,"此手机存在多个用户,请用身份证和密码登录!");
|
|
|
}
|
|
|
// 对验证码进行校验
|
|
|
int res = smsService.check(mobile, 4, captcha);
|
|
|
switch (res) {
|
|
@ -463,7 +461,7 @@ public class WechatController extends WeixinBaseController {
|
|
|
return error(-1, errorMessage);
|
|
|
}
|
|
|
}
|
|
|
List<Patient> patients = patientService.findByMobile(mobile);
|
|
|
|
|
|
loginLog.setLoginType("1");
|
|
|
if (patients == null||patients.size()==0) {
|
|
|
if (mobile.length() == 11) {
|
|
@ -474,16 +472,11 @@ public class WechatController extends WeixinBaseController {
|
|
|
loginLog.setErrorMessage(errorMessage);
|
|
|
loginLogService.saveLog(loginLog);
|
|
|
return error(-1, errorMessage);
|
|
|
}else if(patients.size()>1&&StringUtils.isBlank(patient)) {
|
|
|
return write(1, "存在多个用户", "data", patients);
|
|
|
}else{
|
|
|
Patient p = null;
|
|
|
if(patients.size()==1){
|
|
|
p = patients.get(0);
|
|
|
}else if(StringUtils.isNotBlank(patient)){
|
|
|
p = patientService.findByCode(patient);
|
|
|
}
|
|
|
if (p.getStatus() == 0) {
|
|
|
}if (p.getStatus() == 0) {
|
|
|
if (mobile.length() == 11) {
|
|
|
errorMessage = "该手机号已被禁止使用!";
|
|
|
} else {
|