|
|
@@ -15,24 +15,17 @@ import com.ningdatech.pmapi.sys.model.entity.Role; |
|
|
|
import com.ningdatech.pmapi.sys.model.entity.UserRole; |
|
|
|
import com.ningdatech.pmapi.sys.service.IRoleService; |
|
|
|
import com.ningdatech.pmapi.sys.service.IUserRoleService; |
|
|
|
import com.ningdatech.pmapi.user.constant.LoginTypeEnum; |
|
|
|
import com.ningdatech.pmapi.user.constant.UserAvailableEnum; |
|
|
|
import com.ningdatech.pmapi.user.entity.UserInfo; |
|
|
|
import com.ningdatech.pmapi.user.model.po.*; |
|
|
|
import com.ningdatech.pmapi.user.model.vo.ResUserDetailVO; |
|
|
|
import com.ningdatech.pmapi.user.model.vo.ResUserInfoListVO; |
|
|
|
import com.ningdatech.pmapi.user.model.vo.UserRoleVO; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.constants.UserDeatilsServiceConstant; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.credential.CredentialAuthToken; |
|
|
|
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO; |
|
|
|
import com.ningdatech.pmapi.user.service.IUserInfoService; |
|
|
|
import com.ningdatech.pmapi.user.util.LoginUserUtil; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.security.core.AuthenticationException; |
|
|
|
import org.springframework.security.core.context.SecurityContextHolder; |
|
|
|
import org.springframework.security.core.userdetails.UserDetailsService; |
|
|
|
import org.springframework.security.web.authentication.WebAuthenticationDetails; |
|
|
|
import org.springframework.security.web.context.HttpSessionSecurityContextRepository; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
@@ -232,8 +225,32 @@ public class UserInfoManage { |
|
|
|
|
|
|
|
public ResUserDetailVO currentUserInfo() { |
|
|
|
Long userId = LoginUserUtil.getUserId(); |
|
|
|
UserFullInfoDTO userFullInfo = userInfoHelper.getUserFullInfo(userId); |
|
|
|
return null; |
|
|
|
UserInfo userInfo = iUserInfoService.getById(userId); |
|
|
|
if (Objects.isNull(userInfo)) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
ResUserDetailVO resUserDetailVO = new ResUserDetailVO(); |
|
|
|
resUserDetailVO.setRealName(userInfo.getRealName()); |
|
|
|
resUserDetailVO.setUserId(userInfo.getId()); |
|
|
|
resUserDetailVO.setPhoneNo(userInfo.getMobile()); |
|
|
|
resUserDetailVO.setStatus(userInfo.getAvailable()); |
|
|
|
|
|
|
|
// 装配用户角色信息列表 |
|
|
|
List<UserRole> userRoleList = iUserRoleService.list(Wrappers.lambdaQuery(UserRole.class) |
|
|
|
.eq(UserRole::getUserId, userId)); |
|
|
|
List<UserRoleVO> userRoleInfoList = new ArrayList<>(); |
|
|
|
if (CollUtil.isNotEmpty(userRoleList)) { |
|
|
|
List<Long> roleIdList = userRoleList.stream().map(UserRole::getRoleId).collect(Collectors.toList()); |
|
|
|
List<Role> roleList = iRoleService.list(Wrappers.lambdaQuery(Role.class).in(Role::getId, roleIdList)); |
|
|
|
userRoleInfoList = roleList.stream().map(r -> { |
|
|
|
UserRoleVO userRoleVO = new UserRoleVO(); |
|
|
|
userRoleVO.setId(r.getId()); |
|
|
|
userRoleVO.setName(r.getName()); |
|
|
|
return userRoleVO; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
resUserDetailVO.setUserRoleInfoList(userRoleInfoList); |
|
|
|
return resUserDetailVO; |
|
|
|
} |
|
|
|
|
|
|
|
public void generationLogin(ReqGenerationLoginPO reqGenerationLoginPO) { |
|
|
|