use of com.paascloud.provider.model.domain.UacUser in project paascloud-master by paascloud.
the class UacUserDetailsServiceImpl method loadUserByUsername.
/**
* Load user by username user details.
*
* @param username the username
*
* @return the user details
*/
@Override
public UserDetails loadUserByUsername(String username) {
Collection<GrantedAuthority> grantedAuthorities;
UacUser user = uacUserService.findByLoginName(username);
if (user == null) {
throw new BadCredentialsException("用户名不存在或者密码错误");
}
user = uacUserService.findUserInfoByUserId(user.getId());
grantedAuthorities = uacUserService.loadUserAuthorities(user.getId());
return new SecurityUser(user.getId(), user.getLoginName(), user.getLoginPwd(), user.getUserName(), user.getGroupId(), user.getGroupName(), user.getStatus(), grantedAuthorities);
}
use of com.paascloud.provider.model.domain.UacUser in project paascloud-master by paascloud.
the class UacLoginServiceImpl method loginAfter.
@Override
public LoginRespDto loginAfter(Long applicationId) {
LoginRespDto loginRespDto = new LoginRespDto();
String loginName = SecurityUtils.getCurrentLoginName();
if (StringUtils.isEmpty(loginName)) {
log.error("操作超时, 请重新登录 loginName={}", loginName);
Preconditions.checkArgument(StringUtils.isNotEmpty(loginName), "操作超时, 请重新登录");
}
UacUser uacUser = uacUserService.findByLoginName(loginName);
if (PublicUtil.isEmpty(uacUser)) {
log.info("找不到用户信息 loginName={}", loginName);
throw new UacBizException(ErrorCodeEnum.UAC10011002, loginName);
}
LoginAuthDto loginAuthDto = this.getLoginAuthDto(uacUser);
List<MenuVo> menuVoList = uacMenuService.getMenuVoList(uacUser.getId(), applicationId);
if (PublicUtil.isNotEmpty(menuVoList) && UacConstant.MENU_ROOT.equals(menuVoList.get(0).getMenuCode())) {
menuVoList = menuVoList.get(0).getSubMenu();
}
loginRespDto.setLoginAuthDto(loginAuthDto);
loginRespDto.setMenuList(menuVoList);
return loginRespDto;
}
use of com.paascloud.provider.model.domain.UacUser in project paascloud-master by paascloud.
the class MallUserController method updateInformation.
/**
* 更新用户信息.
*
* @param userInfoDto the user info dto
*
* @return the wrapper
*/
@PostMapping(value = "/updateInformation")
@ApiOperation(httpMethod = "POST", value = "更新用户信息")
public Wrapper<UserInfoDto> updateInformation(@RequestBody UserInfoDto userInfoDto) {
logger.info("updateInformation - 更新用户基本信息 userInfoDto={}", userInfoDto);
UacUser uacUser = new ModelMapper().map(userInfoDto, UacUser.class);
uacUserService.updateUser(uacUser);
return WrapMapper.ok();
}
use of com.paascloud.provider.model.domain.UacUser in project paascloud-master by paascloud.
the class MallUserController method getInformation.
/**
* 获取用户信息.
*
* @return the information
*/
@PostMapping(value = "/getInformation")
@ApiOperation(httpMethod = "POST", value = "获取用户信息")
public Wrapper<UserInfoDto> getInformation() {
LoginAuthDto loginAuthDto = getLoginAuthDto();
Long userId = loginAuthDto.getUserId();
logger.info("queryUserInfo - 查询用户基本信息 userId={}", userId);
UacUser uacUser = uacUserService.queryByUserId(userId);
if (uacUser == null) {
return WrapMapper.error("找不到当前用户");
}
UserInfoDto userInfoDto = new UserInfoDto();
BeanUtils.copyProperties(uacUser, userInfoDto);
return WrapMapper.ok(userInfoDto);
}
use of com.paascloud.provider.model.domain.UacUser in project paascloud-master by paascloud.
the class UacUserServiceTest method queryUserListWithPageTest.
/**
* Query user list with page test.
*/
@Test
public void queryUserListWithPageTest() {
PageInfo pageInfo = uacUserService.queryUserListWithPage(new UacUser());
logger.info("queryUserListWithPage = {}", pageInfo);
}
Aggregations