Search in sources :

Example 1 with MenuVo

use of com.paascloud.provider.model.vo.MenuVo in project paascloud-master by paascloud.

the class UacGroupServiceImpl method buildGroupTree.

private List<MenuVo> buildGroupTree(List<GroupZtreeVo> childUacGroupList, Long currentGroupId) {
    List<MenuVo> listVo = Lists.newArrayList();
    MenuVo menuVo;
    for (GroupZtreeVo group : childUacGroupList) {
        menuVo = new MenuVo();
        menuVo.setId(group.getId());
        if (currentGroupId.equals(group.getId())) {
            menuVo.setPid(0L);
        } else {
            menuVo.setPid(group.getpId());
        }
        menuVo.setMenuCode(group.getGroupCode());
        menuVo.setMenuName(group.getGroupName());
        listVo.add(menuVo);
    }
    return TreeUtil.getChildMenuVos(listVo, 0L);
}
Also used : MenuVo(com.paascloud.provider.model.vo.MenuVo) GroupZtreeVo(com.paascloud.provider.model.vo.GroupZtreeVo)

Example 2 with MenuVo

use of com.paascloud.provider.model.vo.MenuVo in project paascloud-master by paascloud.

the class UacMenuServiceImpl method getMenuVo.

private List<MenuVo> getMenuVo(List<UacMenu> list) {
    List<MenuVo> menuVoList = Lists.newArrayList();
    for (UacMenu uacMenu : list) {
        MenuVo menuVo = new MenuVo();
        BeanUtils.copyProperties(uacMenu, menuVo);
        menuVo.setUrl(uacMenu.getUrl());
        menuVo.setMenuName(uacMenu.getMenuName());
        menuVoList.add(menuVo);
    }
    return menuVoList;
}
Also used : MenuVo(com.paascloud.provider.model.vo.MenuVo) ViewMenuVo(com.paascloud.provider.model.vo.ViewMenuVo) UacMenu(com.paascloud.provider.model.domain.UacMenu)

Example 3 with MenuVo

use of com.paascloud.provider.model.vo.MenuVo in project paascloud-master by paascloud.

the class UacRoleServiceImpl method getAuthList.

private List<MenuVo> getAuthList(List<UacMenu> uacMenus, List<UacAction> uacActions) {
    List<MenuVo> menuVoList = Lists.newArrayList();
    MenuVo menuVo;
    for (UacMenu uacMenu : uacMenus) {
        menuVo = new MenuVo();
        BeanUtils.copyProperties(uacMenu, menuVo);
        menuVo.setRemark("menu");
        menuVoList.add(menuVo);
    }
    if (PublicUtil.isNotEmpty(uacActions)) {
        for (UacAction uacAction : uacActions) {
            menuVo = new MenuVo();
            menuVo.setId(uacAction.getId());
            menuVo.setMenuName(uacAction.getActionName());
            menuVo.setMenuCode(uacAction.getActionCode());
            menuVo.setPid(uacAction.getMenuId());
            menuVo.setUrl(uacAction.getUrl());
            menuVo.setRemark("action");
            menuVoList.add(menuVo);
        }
    }
    return menuVoList;
}
Also used : MenuVo(com.paascloud.provider.model.vo.MenuVo)

Example 4 with MenuVo

use of com.paascloud.provider.model.vo.MenuVo in project paascloud-master by paascloud.

the class UacRoleServiceImpl method getMenuTreeByRoleId.

@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public BindAuthVo getMenuTreeByRoleId(Long roleId) {
    BindAuthVo bindAuthVo = new BindAuthVo();
    Preconditions.checkArgument(roleId != null, ErrorCodeEnum.UAC10012001.msg());
    UacRole roleById = this.getRoleById(roleId);
    if (roleById == null) {
        logger.error("找不到角色信息 roleId={}", roleId);
        throw new UacBizException(ErrorCodeEnum.UAC10012005, roleId);
    }
    // 查询所有的菜单信息
    List<UacMenu> uacMenus = uacMenuService.selectAll();
    // 合并菜单和按钮权限 递归生成树结构
    List<MenuVo> menuVoList = this.getAuthList(uacMenus, null);
    List<MenuVo> tree = TreeUtil.getChildMenuVos(menuVoList, 0L);
    // 获取所有绑定的菜单和按钮权限Id集合
    List<Long> checkedAuthList = uacActionService.getCheckedMenuList(roleId);
    bindAuthVo.setAuthTree(tree);
    bindAuthVo.setCheckedAuthList(checkedAuthList);
    return bindAuthVo;
}
Also used : MenuVo(com.paascloud.provider.model.vo.MenuVo) UacBizException(com.paascloud.provider.model.exceptions.UacBizException) BindAuthVo(com.paascloud.provider.model.vo.BindAuthVo) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with MenuVo

use of com.paascloud.provider.model.vo.MenuVo in project paascloud-master by paascloud.

the class UacUserCommonController method queryUserInfo.

/**
 * 根据userId查询用户详细信息(连表查询).
 *
 * @return the wrapper
 */
@PostMapping(value = "/queryUserInfo/{loginName}")
@ApiOperation(httpMethod = "POST", value = "根据userId查询用户详细信息")
public Wrapper<UserVo> queryUserInfo(@PathVariable String loginName) {
    logger.info("根据userId查询用户详细信息");
    UserVo userVo = new UserVo();
    UacUser uacUser = uacUserService.findByLoginName(loginName);
    uacUser = uacUserService.findUserInfoByUserId(uacUser.getId());
    List<UacRole> roleList = uacRoleService.findAllRoleInfoByUserId(uacUser.getId());
    List<MenuVo> authTree = uacRoleService.getOwnAuthTree(uacUser.getId());
    BeanUtils.copyProperties(uacUser, userVo);
    if (PublicUtil.isNotEmpty(roleList)) {
        userVo.setRoles(new HashSet<>(roleList));
    }
    userVo.setAuthTree(authTree);
    return WrapMapper.ok(userVo);
}
Also used : MenuVo(com.paascloud.provider.model.vo.MenuVo) UacUser(com.paascloud.provider.model.domain.UacUser) UserVo(com.paascloud.provider.model.vo.UserVo) UacRole(com.paascloud.provider.model.domain.UacRole) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

MenuVo (com.paascloud.provider.model.vo.MenuVo)13 Transactional (org.springframework.transaction.annotation.Transactional)5 UacBizException (com.paascloud.provider.model.exceptions.UacBizException)4 UacMenu (com.paascloud.provider.model.domain.UacMenu)3 ViewMenuVo (com.paascloud.provider.model.vo.ViewMenuVo)3 UacUser (com.paascloud.provider.model.domain.UacUser)2 BindAuthVo (com.paascloud.provider.model.vo.BindAuthVo)2 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)1 UacRole (com.paascloud.provider.model.domain.UacRole)1 UserMenuChildrenDto (com.paascloud.provider.model.dto.menu.UserMenuChildrenDto)1 UserMenuDto (com.paascloud.provider.model.dto.menu.UserMenuDto)1 LoginRespDto (com.paascloud.provider.model.dto.user.LoginRespDto)1 GroupZtreeVo (com.paascloud.provider.model.vo.GroupZtreeVo)1 UserVo (com.paascloud.provider.model.vo.UserVo)1 ApiOperation (io.swagger.annotations.ApiOperation)1