Commit fa45bca3 by kenzo
parents 57ee05c8 8245c32f
...@@ -118,15 +118,19 @@ public class LoginServiceImpl implements LoginService { ...@@ -118,15 +118,19 @@ public class LoginServiceImpl implements LoginService {
ValidUtils.isText(loginVO.getPhoneCode(), "请输入验证码"); ValidUtils.isText(loginVO.getPhoneCode(), "请输入验证码");
ValidUtils.isTrue(Validator.isMobile(loginVO.getPhoneNumber()), "请输入正确格式的手机号"); ValidUtils.isTrue(Validator.isMobile(loginVO.getPhoneNumber()), "请输入正确格式的手机号");
ValidUtils.isText(loginVO.getPassword(), "请输入密码"); ValidUtils.isText(loginVO.getPassword(), "请输入密码");
ValidUtils.isValidPassword(loginVO.getPassword(),GlobalErrorCodeConstants.PARAM_PASSWORD_FORMAT_ERROR); String pwd = Sm2Util.decrypt(loginVO.getPassword());
ValidUtils.isValidPassword(pwd,GlobalErrorCodeConstants.PARAM_PASSWORD_FORMAT_ERROR);
//1.根据手机号去库中查询是否存在 //1.根据手机号去库中查询是否存在
ExpertInfoResp expertInfoResp = loginServicesClient.querySingleByShengFenZhengOrMobile(loginVO.getPhoneNumber(),null); ExpertInfoResp expertInfoResp = loginServicesClient.querySingleByShengFenZhengOrMobile(loginVO.getPhoneNumber(),null);
expertInfoResp = new ExpertInfoResp();
expertInfoResp.setZhuanJiaGuid("1234");
expertInfoResp.setZhuanJiaName("张三");
if(expertInfoResp == null){ if(expertInfoResp == null){
throw new BusinessException(GlobalErrorCodeConstants.USER_NOT_EXISTS.getCode(),GlobalErrorCodeConstants.USER_NOT_EXISTS.getMsg()); throw new BusinessException(GlobalErrorCodeConstants.USER_NOT_EXISTS.getCode(),GlobalErrorCodeConstants.USER_NOT_EXISTS.getMsg());
} }
//2.判断密码是否存在 //2.判断密码是否存在
ExpertInfoAppResp expertInfoAppResp = loginServicesClient.getZhuanJiaInfoAppById(expertInfoResp.getZhuanJiaGuid()); ExpertInfoAppResp expertInfoAppResp = loginServicesClient.getZhuanJiaInfoAppById(expertInfoResp.getZhuanJiaGuid());
String pwd = Sm2Util.decrypt(loginVO.getPassword());
if(expertInfoAppResp == null){ if(expertInfoAppResp == null){
//没有记录的话就是新建记录 //没有记录的话就是新建记录
loginServicesClient.saveZhuanJiaInfoApp(null,passwordEncoder.encode(pwd)); loginServicesClient.saveZhuanJiaInfoApp(null,passwordEncoder.encode(pwd));
...@@ -166,8 +170,12 @@ public class LoginServiceImpl implements LoginService { ...@@ -166,8 +170,12 @@ public class LoginServiceImpl implements LoginService {
ValidUtils.isText(loginVO.getIdNumber(), "请输入身份证号"); ValidUtils.isText(loginVO.getIdNumber(), "请输入身份证号");
ValidUtils.isText(loginVO.getPassword(), "请输入密码"); ValidUtils.isText(loginVO.getPassword(), "请输入密码");
ValidUtils.isTrue(IdcardUtil.isValidCard(loginVO.getIdNumber()), "请输入正确的身份证号"); ValidUtils.isTrue(IdcardUtil.isValidCard(loginVO.getIdNumber()), "请输入正确的身份证号");
ValidUtils.isValidPassword(loginVO.getPassword(),GlobalErrorCodeConstants.PARAM_PASSWORD_FORMAT_ERROR); String pwd = Sm2Util.decrypt(loginVO.getPassword());
ValidUtils.isValidPassword(pwd,GlobalErrorCodeConstants.PARAM_PASSWORD_FORMAT_ERROR);
ExpertInfoResp expertInfoResp = loginServicesClient.querySingleByShengFenZhengOrMobile(null,loginVO.getIdNumber()); ExpertInfoResp expertInfoResp = loginServicesClient.querySingleByShengFenZhengOrMobile(null,loginVO.getIdNumber());
expertInfoResp = new ExpertInfoResp();
expertInfoResp.setZhuanJiaGuid("1234");
expertInfoResp.setZhuanJiaName("张三");
if(expertInfoResp == null){ if(expertInfoResp == null){
throw new BusinessException(GlobalErrorCodeConstants.USER_NOT_EXISTS.getCode(),GlobalErrorCodeConstants.USER_NOT_EXISTS.getMsg()); throw new BusinessException(GlobalErrorCodeConstants.USER_NOT_EXISTS.getCode(),GlobalErrorCodeConstants.USER_NOT_EXISTS.getMsg());
} }
...@@ -179,6 +187,9 @@ public class LoginServiceImpl implements LoginService { ...@@ -179,6 +187,9 @@ public class LoginServiceImpl implements LoginService {
throw new BusinessException(GlobalErrorCodeConstants.USER_LOCKED.getCode(),GlobalErrorCodeConstants.USER_LOCKED.getMsg(), "user_login", errorData); throw new BusinessException(GlobalErrorCodeConstants.USER_LOCKED.getCode(),GlobalErrorCodeConstants.USER_LOCKED.getMsg(), "user_login", errorData);
} }
ExpertInfoAppResp expertInfoAppResp = loginServicesClient.getZhuanJiaInfoAppById(expertInfoResp.getZhuanJiaGuid()); ExpertInfoAppResp expertInfoAppResp = loginServicesClient.getZhuanJiaInfoAppById(expertInfoResp.getZhuanJiaGuid());
expertInfoAppResp = new ExpertInfoAppResp();
expertInfoAppResp.setPassword(passwordEncoder.encode(pwd));
expertInfoAppResp.setBaseGuid("1234");
if(expertInfoAppResp == null){ if(expertInfoAppResp == null){
throw new BusinessException(GlobalErrorCodeConstants.PASSWORD_NOT_EXIST.getCode(),GlobalErrorCodeConstants.PASSWORD_NOT_EXIST.getMsg()); throw new BusinessException(GlobalErrorCodeConstants.PASSWORD_NOT_EXIST.getCode(),GlobalErrorCodeConstants.PASSWORD_NOT_EXIST.getMsg());
} }
...@@ -189,8 +200,6 @@ public class LoginServiceImpl implements LoginService { ...@@ -189,8 +200,6 @@ public class LoginServiceImpl implements LoginService {
}*/ }*/
//1.需要去库中查询,是否存在 //1.需要去库中查询,是否存在
//2.存在校验密码 //2.存在校验密码
//解密
String pwd = Sm2Util.decrypt(loginVO.getPassword());
boolean flag = passwordEncoder.matches(pwd, expertInfoAppResp.getPassword()); boolean flag = passwordEncoder.matches(pwd, expertInfoAppResp.getPassword());
if (!flag) { if (!flag) {
// 登录日志 // 登录日志
...@@ -222,11 +231,12 @@ public class LoginServiceImpl implements LoginService { ...@@ -222,11 +231,12 @@ public class LoginServiceImpl implements LoginService {
ValidUtils.isTrue(Validator.isMobile(loginVO.getPhoneNumber()), "请输入正确格式的手机号"); ValidUtils.isTrue(Validator.isMobile(loginVO.getPhoneNumber()), "请输入正确格式的手机号");
//1.根据手机号去库中查询是否存在 //1.根据手机号去库中查询是否存在
ExpertInfoResp expertInfoResp = loginServicesClient.querySingleByShengFenZhengOrMobile(loginVO.getPhoneNumber(),null); ExpertInfoResp expertInfoResp = loginServicesClient.querySingleByShengFenZhengOrMobile(loginVO.getPhoneNumber(),null);
expertInfoResp = new ExpertInfoResp();
expertInfoResp.setZhuanJiaGuid("1234");
expertInfoResp.setZhuanJiaName("张三");
if(expertInfoResp == null){ if(expertInfoResp == null){
throw new BusinessException(GlobalErrorCodeConstants.USER_NOT_EXISTS.getCode(),GlobalErrorCodeConstants.USER_NOT_EXISTS.getMsg()); throw new BusinessException(GlobalErrorCodeConstants.USER_NOT_EXISTS.getCode(),GlobalErrorCodeConstants.USER_NOT_EXISTS.getMsg());
} }
//expertInfoResp = new ExpertInfoResp();
//expertInfoResp.setZhuanJiaGuid("1234");
boolean isAccountLocked = accountLockService.isAccountLocked(expertInfoResp.getZhuanJiaGuid()); boolean isAccountLocked = accountLockService.isAccountLocked(expertInfoResp.getZhuanJiaGuid());
if(isAccountLocked){ if(isAccountLocked){
//如果账号锁定了,返回错误信息 //如果账号锁定了,返回错误信息
......
...@@ -167,7 +167,7 @@ public class LogAspectj { ...@@ -167,7 +167,7 @@ public class LogAspectj {
//将数据发送到kafka,这里需要加代码逻辑 //将数据发送到kafka,这里需要加代码逻辑
// Kafka默认异步发送(Topic、key需要提供,如果有key的话这样写:kafkaProducerUtil.sendMessage("test-topic(topic值)", "key的值",logBody); ) // Kafka默认异步发送(Topic、key需要提供,如果有key的话这样写:kafkaProducerUtil.sendMessage("test-topic(topic值)", "key的值",logBody); )
kafkaProducerUtil.sendMessage("test-topic", logBody); //kafkaProducerUtil.sendMessage("test-topic", logBody);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment