|
@@ -121,6 +121,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
@Autowired
|
|
|
private IUserStudyLogService iUserStudyLogService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IUserLoginErrorService iUserLoginErrorService;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public UserVo queryById(Long userId) {
|
|
@@ -847,11 +850,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
LambdaQueryWrapper<User> queryWrapper =new LambdaQueryWrapper<User>();
|
|
|
User user = getOne(new LambdaQueryWrapper<User>().eq(User::getUserId, bo.getUserId()));
|
|
|
if(Validator.isEmpty(user)){
|
|
|
- throw new BaseException("用户不存在");
|
|
|
+ throw new BaseException("用户信息错误");
|
|
|
}
|
|
|
if (!SecurityUtils.matchesPassword(bo.getOldPwd(),user.getPassword() ))
|
|
|
{
|
|
|
- throw new BaseException("密码错误");
|
|
|
+ throw new BaseException("用户信息错误");
|
|
|
}
|
|
|
if (Validator.isEmpty(bo.getNewPwd()))
|
|
|
{
|
|
@@ -928,7 +931,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
|
|
|
@Override
|
|
|
public Map<String, Object> telphone_login(UserAppTelphoneLoginBo bo) {
|
|
|
- Object cacheObject = redisCache.getCacheObjectNoTenant(bo.getSign());
|
|
|
+ String tenantId = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
+ Object cacheObject = redisCache.getCacheObjectNoTenant(tenantId+":"+bo.getSign());
|
|
|
if (ObjectUtil.isNull(cacheObject)){
|
|
|
throw new CustomException("该账号不存在!");
|
|
|
}
|
|
@@ -949,6 +953,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<User> getUserByTelNotTenant(String telphone) {
|
|
|
+ return baseMapper.getUserByTelNotTenant(telphone);
|
|
|
+ }
|
|
|
+
|
|
|
private Long findSubjectId(String subject){
|
|
|
if(subject!=null){
|
|
|
String key = "SUB_"+subject;
|
|
@@ -988,6 +997,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
if(!code.equals(bo.getCode())){
|
|
|
throw new CustomException("验证码错误");
|
|
|
}
|
|
|
+ redisCache.deleteObject(key);
|
|
|
User user = getOne(new LambdaQueryWrapper<User>()
|
|
|
.eq(User::getTelphone,bo.getTel()).last("limit 1"));
|
|
|
if(Validator.isEmpty(user)){
|
|
@@ -1003,14 +1013,17 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
if(bo.getTel()==null){
|
|
|
throw new CustomException("手机号不能为空");
|
|
|
}
|
|
|
+ iUserLoginErrorService.checkLimit(bo.getTel());
|
|
|
String key = Constants.LOGIN_SMS + bo.getTel();
|
|
|
String code = redisCache.getCacheObject(key);
|
|
|
if(code==null){
|
|
|
throw new CustomException("验证码错误");
|
|
|
}
|
|
|
if(!code.equals(bo.getCode())){
|
|
|
+ iUserLoginErrorService.saveErrorLog(bo.getTel());
|
|
|
throw new CustomException("验证码错误");
|
|
|
}
|
|
|
+ redisCache.deleteObject(key);
|
|
|
User user = getOne(new LambdaQueryWrapper<User>()
|
|
|
.eq(User::getTelphone,bo.getTel()).last("limit 1"));
|
|
|
if(Validator.isEmpty(user)){
|
|
@@ -1043,6 +1056,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
if(!code.equals(bo.getCode())){
|
|
|
throw new CustomException("验证码错误");
|
|
|
}
|
|
|
+ redisCache.deleteObject(key);
|
|
|
User user = getOne(new LambdaQueryWrapper<User>()
|
|
|
.eq(User::getTelphone,bo.getTel()).last("limit 1"));
|
|
|
if(Validator.isNotEmpty(user)){
|
|
@@ -1068,6 +1082,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
if(Validator.isEmpty(bo.getAccount())){
|
|
|
throw new CustomException("账号不能为空");
|
|
|
}
|
|
|
+ iUserLoginErrorService.checkLimit(bo.getAccount());
|
|
|
LambdaQueryWrapper<User> queryWrapper =new LambdaQueryWrapper<User>();
|
|
|
queryWrapper.and(wq -> wq
|
|
|
.eq(User::getTelphone,bo.getAccount())
|
|
@@ -1075,7 +1090,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
.eq(User::getIdCard,bo.getAccount()));
|
|
|
User user = getOne(queryWrapper);
|
|
|
if(Validator.isEmpty(user)){
|
|
|
- throw new CustomException("该账号不存在");
|
|
|
+ iUserLoginErrorService.saveErrorLog(bo.getAccount());
|
|
|
+ throw new CustomException("登录信息错误");
|
|
|
}
|
|
|
else if (UserStatus.DISABLE.getCode().equals(user.getStatus()))
|
|
|
{
|
|
@@ -1097,7 +1113,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IU
|
|
|
}
|
|
|
if (!SecurityUtils.matchesPassword(password,user.getPassword()))
|
|
|
{
|
|
|
- throw new BaseException("密码错误");
|
|
|
+ iUserLoginErrorService.saveErrorLog(bo.getAccount());
|
|
|
+ throw new BaseException("登录信息错误");
|
|
|
}
|
|
|
//如果活动分销码变动
|
|
|
if (StringUtils.isNotBlank(bo.getShareActivityCode())){
|