Commit 06425c6971ea8a606433c615aac322b7cb5b6c3c
1 parent
09bf6aab
11
Showing
1 changed file
with
8 additions
and
3 deletions
trash-garbage/src/main/java/com/trash/garbage/service/impl/GarUserServiceImpl.java
| @@ -113,7 +113,7 @@ public class GarUserServiceImpl extends ServiceImpl<GarUserMapper, GarUser> | @@ -113,7 +113,7 @@ public class GarUserServiceImpl extends ServiceImpl<GarUserMapper, GarUser> | ||
| 113 | @Override | 113 | @Override |
| 114 | public LoginVo login(LoginDto loginDto) { | 114 | public LoginVo login(LoginDto loginDto) { |
| 115 | LoginVo vo = new LoginVo(); | 115 | LoginVo vo = new LoginVo(); |
| 116 | - | 116 | + |
| 117 | if(loginDto.getSignin() == 1){ | 117 | if(loginDto.getSignin() == 1){ |
| 118 | QueryWrapper<GarUser> qw = new QueryWrapper<>(); | 118 | QueryWrapper<GarUser> qw = new QueryWrapper<>(); |
| 119 | GarUser nUser = null; | 119 | GarUser nUser = null; |
| @@ -123,7 +123,7 @@ public class GarUserServiceImpl extends ServiceImpl<GarUserMapper, GarUser> | @@ -123,7 +123,7 @@ public class GarUserServiceImpl extends ServiceImpl<GarUserMapper, GarUser> | ||
| 123 | throw new UsernameNotFoundException("当前用户已存在!"); | 123 | throw new UsernameNotFoundException("当前用户已存在!"); |
| 124 | } | 124 | } |
| 125 | } | 125 | } |
| 126 | - | 126 | + |
| 127 | vo.setLoginPhone(loginDto.getTel()); | 127 | vo.setLoginPhone(loginDto.getTel()); |
| 128 | if (Objects.isNull(loginDto)) { | 128 | if (Objects.isNull(loginDto)) { |
| 129 | throw new UsernameNotFoundException("当前用户不存在!"); | 129 | throw new UsernameNotFoundException("当前用户不存在!"); |
| @@ -147,12 +147,14 @@ public class GarUserServiceImpl extends ServiceImpl<GarUserMapper, GarUser> | @@ -147,12 +147,14 @@ public class GarUserServiceImpl extends ServiceImpl<GarUserMapper, GarUser> | ||
| 147 | qw.lambda().eq(GarUser::getGarUserTel, loginDto.getTel()); | 147 | qw.lambda().eq(GarUser::getGarUserTel, loginDto.getTel()); |
| 148 | if(loginDto.getCode() == null && loginDto.getPassword() != null){ | 148 | if(loginDto.getCode() == null && loginDto.getPassword() != null){ |
| 149 | qw.lambda().eq(GarUser::getGarUserTel, loginDto.getTel()); | 149 | qw.lambda().eq(GarUser::getGarUserTel, loginDto.getTel()); |
| 150 | - qw.lambda().eq(GarUser::getPassword, new BCryptPasswordEncoder().encode(loginDto.getPassword())); | ||
| 151 | if(loginDto.getSignin() != 1){ | 150 | if(loginDto.getSignin() != 1){ |
| 152 | nUser = this.getOne(qw); | 151 | nUser = this.getOne(qw); |
| 153 | if (Objects.isNull(nUser)) { | 152 | if (Objects.isNull(nUser)) { |
| 154 | throw new UsernameNotFoundException("当前用户不存在!"); | 153 | throw new UsernameNotFoundException("当前用户不存在!"); |
| 155 | } | 154 | } |
| 155 | + if(!new BCryptPasswordEncoder().matches(loginDto.getPassword(),nUser.getPassword())){ | ||
| 156 | + throw new UsernameNotFoundException("密码错误!"); | ||
| 157 | + } | ||
| 156 | } | 158 | } |
| 157 | }else{ | 159 | }else{ |
| 158 | // 验证码验证 | 160 | // 验证码验证 |
| @@ -176,6 +178,9 @@ public class GarUserServiceImpl extends ServiceImpl<GarUserMapper, GarUser> | @@ -176,6 +178,9 @@ public class GarUserServiceImpl extends ServiceImpl<GarUserMapper, GarUser> | ||
| 176 | 178 | ||
| 177 | nUser.setGarUserType(GlobalStatus.GarUserStatusEnum.NORMAL_USER.getDescription()); | 179 | nUser.setGarUserType(GlobalStatus.GarUserStatusEnum.NORMAL_USER.getDescription()); |
| 178 | } | 180 | } |
| 181 | + | ||
| 182 | + | ||
| 183 | + | ||
| 179 | //是否是投放点用户 | 184 | //是否是投放点用户 |
| 180 | List<DropPointInfo> list = dropPointInfoService.selectDropPointInfoListByPhone(loginDto.getTel()); | 185 | List<DropPointInfo> list = dropPointInfoService.selectDropPointInfoListByPhone(loginDto.getTel()); |
| 181 | vo.setTestUser(CollectionUtil.isNotEmpty(list)); | 186 | vo.setTestUser(CollectionUtil.isNotEmpty(list)); |