|
@@ -2,17 +2,14 @@ package com.hz.pm.api.user.security.auth.mh; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
import com.hz.pm.api.common.helper.UserInfoHelper; |
|
|
import com.hz.pm.api.user.constant.UserAvailableEnum; |
|
|
|
|
|
import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; |
|
|
import com.hz.pm.api.user.security.auth.model.UserFullInfoDTO; |
|
|
import com.hz.pm.api.user.security.auth.model.UserInfoDetails; |
|
|
import com.hz.pm.api.user.security.auth.model.UserInfoDetails; |
|
|
import com.hz.pm.api.user.security.auth.validate.CommonLoginException; |
|
|
|
|
|
|
|
|
import com.ningdatech.basic.exception.BizException; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import org.springframework.security.core.userdetails.UserDetailsService; |
|
|
import org.springframework.security.core.userdetails.UserDetailsService; |
|
|
import org.springframework.security.core.userdetails.UsernameNotFoundException; |
|
|
import org.springframework.security.core.userdetails.UsernameNotFoundException; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
|
|
|
import static com.hz.pm.api.user.constant.UserAvailableEnum.DISABLE; |
|
|
import static com.hz.pm.api.user.constant.UserAvailableEnum.DISABLE; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@@ -33,7 +30,7 @@ public class MhLoginUserDetailService implements UserDetailsService { |
|
|
public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { |
|
|
public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException { |
|
|
UserFullInfoDTO userInfo = userInfoHelper.getUserFullInfoByMhUserIdOrOpenId(username); |
|
|
UserFullInfoDTO userInfo = userInfoHelper.getUserFullInfoByMhUserIdOrOpenId(username); |
|
|
if (userInfo == null || DISABLE.equals(userInfo.getAvailable())) { |
|
|
if (userInfo == null || DISABLE.equals(userInfo.getAvailable())) { |
|
|
throw new UsernameNotFoundException("用户不存在或已被禁用"); |
|
|
|
|
|
|
|
|
throw BizException.wrap("用户不存在或已被禁用"); |
|
|
} |
|
|
} |
|
|
UserInfoDetails userDetails = new UserInfoDetails(); |
|
|
UserInfoDetails userDetails = new UserInfoDetails(); |
|
|
userDetails.setUserId(userInfo.getUserId()); |
|
|
userDetails.setUserId(userInfo.getUserId()); |
|
|