|
|
@@ -6,6 +6,7 @@ import com.ningdatech.pmapi.user.manage.UserAuthLoginManage; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.constants.UserDeatilsServiceConstant; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.validate.CommonLoginException; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.security.core.userdetails.UserDetailsService; |
|
|
|
import org.springframework.security.core.userdetails.UsernameNotFoundException; |
|
|
@@ -35,14 +36,23 @@ public class CredentialLoginUserDetailService implements UserDetailsService { |
|
|
|
switch (loginTypeEnum) { |
|
|
|
case PHONE_VERIFICATION_CODE_LOGIN: { |
|
|
|
userFullInfoDTO = userAuthLoginManage.queryUserInfoInPhoneNoAuth(username); |
|
|
|
if (Objects.isNull(userFullInfoDTO)) { |
|
|
|
throw new CommonLoginException("改手机号未绑定用户"); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
case USERNAME_PASSWORD_LOGIN: { |
|
|
|
userFullInfoDTO = userAuthLoginManage.queryUserInfoInPasswordAuth(username); |
|
|
|
if (Objects.isNull(userFullInfoDTO)) { |
|
|
|
throw new UsernameNotFoundException(String.format("%s user not exist", username)); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
case DING_QR_LOGIN: { |
|
|
|
userFullInfoDTO = userAuthLoginManage.queryUserInfoInAccountIdAuth(username); |
|
|
|
if (Objects.isNull(userFullInfoDTO)) { |
|
|
|
throw new CommonLoginException("浙政钉账号无法登陆"); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
default: { |
|
|
@@ -50,9 +60,6 @@ public class CredentialLoginUserDetailService implements UserDetailsService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (Objects.isNull(userFullInfoDTO)) { |
|
|
|
throw new UsernameNotFoundException(String.format("%s user not exist", username)); |
|
|
|
} |
|
|
|
UserInfoDetails userInfoDetails = new UserInfoDetails(); |
|
|
|
userInfoDetails.setUserId(userFullInfoDTO.getUserId()); |
|
|
|
userInfoDetails.setUsername(userFullInfoDTO.getUsername()); |
|
|
|