Search in sources :

Example 36 with UacBizException

use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.

the class UacRoleActionServiceImpl method deleteByRoleId.

@Override
public void deleteByRoleId(Long roleId) {
    if (roleId == null) {
        throw new UacBizException(ErrorCodeEnum.UAC10012001);
    }
    UacRoleAction roleMenu = new UacRoleAction();
    roleMenu.setRoleId(roleId);
    uacRoleActionMapper.delete(roleMenu);
}
Also used : UacBizException(com.paascloud.provider.model.exceptions.UacBizException) UacRoleAction(com.paascloud.provider.model.domain.UacRoleAction)

Example 37 with UacBizException

use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.

the class UacRoleServiceImpl method getActionTreeByRoleId.

@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public BindAuthVo getActionTreeByRoleId(Long roleId) {
    BindAuthVo bindAuthVo = new BindAuthVo();
    if (roleId == null) {
        throw new UacBizException(ErrorCodeEnum.UAC10012001);
    }
    UacRole roleById = this.getRoleById(roleId);
    if (roleById == null) {
        logger.error("找不到角色信息 roleId={}", roleId);
        throw new UacBizException(ErrorCodeEnum.UAC10012005, roleId);
    }
    List<UacMenu> uacMenus = uacMenuService.listMenuListByRoleId(roleId);
    if (PublicUtil.isEmpty(uacMenus)) {
        throw new UacBizException(ErrorCodeEnum.UAC10013009);
    }
    // 查询所有的权限信息
    List<UacAction> uacActions = uacActionService.listActionList(uacMenus);
    // 合并菜单和按钮权限 递归生成树结构
    List<MenuVo> menuVoList = this.getAuthList(uacMenus, uacActions);
    List<MenuVo> tree = TreeUtil.getChildMenuVos(menuVoList, 0L);
    // 获取所有绑定的菜单和按钮权限Id集合
    List<Long> checkedAuthList = uacActionService.getCheckedActionList(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)

Aggregations

UacBizException (com.paascloud.provider.model.exceptions.UacBizException)37 Transactional (org.springframework.transaction.annotation.Transactional)8 UacGroup (com.paascloud.provider.model.domain.UacGroup)6 UacMenu (com.paascloud.provider.model.domain.UacMenu)6 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)5 UacGroupUser (com.paascloud.provider.model.domain.UacGroupUser)5 MqMessageData (com.paascloud.provider.model.domain.MqMessageData)4 UacRoleMenu (com.paascloud.provider.model.domain.UacRoleMenu)4 UacRoleUser (com.paascloud.provider.model.domain.UacRoleUser)4 MenuVo (com.paascloud.provider.model.vo.MenuVo)4 UacRoleAction (com.paascloud.provider.model.domain.UacRoleAction)3 UacUser (com.paascloud.provider.model.domain.UacUser)3 BindAuthVo (com.paascloud.provider.model.vo.BindAuthVo)2 UserBindRoleVo (com.paascloud.provider.model.vo.UserBindRoleVo)2 ApiOperation (io.swagger.annotations.ApiOperation)2 Date (java.util.Date)2 LogAnnotation (com.paascloud.core.annotation.LogAnnotation)1 MqProducerStore (com.paascloud.provider.annotation.MqProducerStore)1 UacAction (com.paascloud.provider.model.domain.UacAction)1 UacRole (com.paascloud.provider.model.domain.UacRole)1