use of com.besscroft.aurora.mall.common.entity.AuthUser in project aurora-mall by besscroft.
the class UserServiceImpl method getUserInfo.
@Override
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> getUserInfo() {
AuthUser currentAdmin = getCurrentAdmin();
Map<String, Object> data = menuService.getTreeListById(currentAdmin.getId());
data.put("username", currentAdmin.getNickName());
data.put("icon", currentAdmin.getIcon());
List<AuthRole> roleList = getRoleList(currentAdmin.getId());
if (CollUtil.isNotEmpty(roleList)) {
List<String> roles = roleList.stream().map(AuthRole::getName).collect(Collectors.toList());
data.put("roles", roles);
}
// 设置登录时间
setLoginTime(LocalDateTime.now(), currentAdmin.getId());
return data;
}
use of com.besscroft.aurora.mall.common.entity.AuthUser in project aurora-mall by besscroft.
the class UserServiceImpl method register.
@Override
@Transactional(rollbackFor = Exception.class)
public boolean register(AdminParam adminParam) {
AuthUser authUser = AuthUser.builder().build();
BeanUtils.copyProperties(adminParam, authUser);
// 设置用户注册的时间
authUser.setCreateTime(LocalDateTime.now());
// 设置用户状态
authUser.setStatus(1);
// 对密码进行加密
authUser.setPassword(new BCryptPasswordEncoder().encode(adminParam.getPassword()));
// 更新到数据库
return this.baseMapper.insert(authUser) > 0;
}
use of com.besscroft.aurora.mall.common.entity.AuthUser in project aurora-mall by besscroft.
the class MenuController method changeSwitch.
@WebLog(description = "菜单是否显示状态更新")
@ApiOperation("菜单是否显示状态更新")
@ApiImplicitParams({ @ApiImplicitParam(name = "hidden", value = "显示状态", required = true, dataType = "Boolean"), @ApiImplicitParam(name = "id", value = "菜单id", required = true, dataType = "Long") })
@PutMapping("/changeSwitch")
public AjaxResult changeSwitch(@RequestParam("hidden") boolean hidden, @RequestParam("id") Long id) {
AuthUser currentAdmin = userService.getCurrentAdmin();
boolean b = menuService.changeSwitch(hidden, id, currentAdmin.getId());
if (b) {
return AjaxResult.success("修改成功");
}
return AjaxResult.success("修改失败");
}
use of com.besscroft.aurora.mall.common.entity.AuthUser in project aurora-mall by besscroft.
the class MenuController method getRouter.
@WebLog(description = "获取当前用户管理系统菜单")
@ApiOperation(value = "获取当前用户管理系统菜单")
@GetMapping(value = "/getMenu")
public AjaxResult getRouter() {
AuthUser currentAdmin = userService.getCurrentAdmin();
List<AuthMenu> list = menuService.getMenuListById(currentAdmin.getId());
log.info("菜单:{}", list);
return AjaxResult.success(list);
}
use of com.besscroft.aurora.mall.common.entity.AuthUser in project aurora-mall by besscroft.
the class UserServiceTest method updateUser.
@Test
void updateUser() throws Exception {
AuthUser user = AuthUser.builder().build();
user.setId(3L);
user.setNickName("测试");
boolean b = userService.updateUser(user);
assertTrue(b, "更新用户信息失败!");
}
Aggregations