use of com.besscroft.aurora.mall.common.entity.AuthUser in project aurora-mall by besscroft.
the class UserServiceTest method getUserById.
@Test
void getUserById() throws Exception {
Long adminId = 1L;
AuthUser user = userService.getUserById(adminId);
assertNotNull(user, "获取用户详细信息失败!");
LOGGER.info("用户详细信息:{}", objectMapper.writeValueAsString(user));
}
use of com.besscroft.aurora.mall.common.entity.AuthUser in project aurora-mall by besscroft.
the class UserServiceTest method getCurrentAdmin.
@Test
void getCurrentAdmin() throws Exception {
AuthUser currentAdmin = userService.getCurrentAdmin();
assertNotNull(currentAdmin, "获取当前登录用户失败!");
}
use of com.besscroft.aurora.mall.common.entity.AuthUser in project aurora-mall by besscroft.
the class UserServiceTest method addUser.
@Test
void addUser() throws Exception {
AuthUser user = AuthUser.builder().build();
user.setUsername("test666");
user.setPassword("666666");
boolean b = userService.addUser(user);
assertTrue(b, "添加用户失败!");
}
use of com.besscroft.aurora.mall.common.entity.AuthUser in project aurora-mall by besscroft.
the class UserServiceImpl method logout.
@Override
public boolean logout(Long adminId) {
AuthUser user = this.baseMapper.selectById(adminId);
redisTemplate.delete(AuthConstants.ADMIN_CLIENT_ID + ":token:user:" + user.getUsername());
redisTemplate.boundHashOps("admin").delete("user:tree:" + adminId);
return true;
}
use of com.besscroft.aurora.mall.common.entity.AuthUser in project aurora-mall by besscroft.
the class UserServiceImpl method loadUserByUsername.
@Override
public UserDto loadUserByUsername(String username) {
AuthUser authUser = this.baseMapper.selectAuthUserByUsername(username);
if (authUser != null) {
List<AuthRole> authRoles = authRoleMapper.selectAuthRoleListByAdminId(authUser.getId());
UserDto userDto = new UserDto();
BeanUtils.copyProperties(authUser, userDto);
if (CollUtil.isNotEmpty(authRoles)) {
List<String> roleStrList = authRoles.stream().map(item -> item.getId() + "_" + item.getName()).collect(Collectors.toList());
userDto.setRoles(roleStrList);
}
return userDto;
}
return null;
}
Aggregations