| | |
| | | import org.springframework.security.crypto.password.PasswordEncoder; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.List; |
| | |
| | | private GuideUser findLoginableGuideByPhone(String phone) { |
| | | GuideUser user = guideUserService.findByPhone(phone); |
| | | validateGuideLoginStatus(user, "手机号未注册"); |
| | | validateGuideLoginPhone(user, phone); |
| | | guideAutoDisableService.disableGuideIfEligible(user.getId()); |
| | | GuideUser currentUser = guideUserService.findByPhone(phone); |
| | | validateGuideLoginStatus(currentUser, "手机号未注册"); |
| | | validateGuideLoginPhone(currentUser, phone); |
| | | return currentUser; |
| | | } |
| | | |
| | | private void validateGuideLoginPhone(GuideUser user, String phone) { |
| | | if (StringUtils.hasText(user.getMobile()) && !phone.equals(user.getMobile())) { |
| | | throw new BusinessException(401, "手机号未注册"); |
| | | } |
| | | } |
| | | |
| | | private void validateGuideLoginStatus(GuideUser user, String notFoundMessage) { |
| | | if (user == null) { |
| | | throw new BusinessException(401, notFoundMessage); |