Search in sources :

Example 1 with UacAction

use of com.paascloud.provider.model.domain.UacAction in project paascloud-master by paascloud.

the class UacActionServiceImpl method queryActionListWithPage.

@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public PageInfo queryActionListWithPage(ActionMainQueryDto actionMainQueryDto) {
    List<Long> menuIdList = actionMainQueryDto.getMenuIdList();
    Long menuId = null;
    if (PublicUtil.isNotEmpty(menuIdList)) {
        menuId = menuIdList.get(menuIdList.size() - 1);
    }
    UacAction uacAction = new UacAction();
    uacAction.setMenuId(menuId);
    BeanUtils.copyProperties(actionMainQueryDto, uacAction);
    uacAction.setOrderBy("update_time desc");
    PageHelper.startPage(actionMainQueryDto.getPageNum(), actionMainQueryDto.getPageSize());
    List<ActionVo> actionList = uacActionMapper.queryActionListWithPage(uacAction);
    return new PageInfo<>(actionList);
}
Also used : PageInfo(com.github.pagehelper.PageInfo) UacAction(com.paascloud.provider.model.domain.UacAction) ActionVo(com.paascloud.provider.model.vo.ActionVo) Transactional(org.springframework.transaction.annotation.Transactional)

Example 2 with UacAction

use of com.paascloud.provider.model.domain.UacAction in project paascloud-master by paascloud.

the class UacActionServiceImpl method deleteActionById.

@Override
public int deleteActionById(Long actionId) {
    // 查询该角色下是否有用户绑定, 有的话提醒不能删除
    if (null == actionId) {
        throw new IllegalArgumentException("权限ID不能为空");
    }
    UacAction uacAction = uacActionMapper.selectByPrimaryKey(actionId);
    if (uacAction == null) {
        logger.error("找不到权限信息 actionId={}", actionId);
        throw new UacBizException(ErrorCodeEnum.UAC10014001, actionId);
    }
    // 删除角色权限表数据  不查询了 直接删除了
    uacRoleActionMapper.deleteByActionId(actionId);
    return uacActionMapper.deleteByPrimaryKey(actionId);
}
Also used : UacAction(com.paascloud.provider.model.domain.UacAction) UacBizException(com.paascloud.provider.model.exceptions.UacBizException)

Example 3 with UacAction

use of com.paascloud.provider.model.domain.UacAction in project paascloud-master by paascloud.

the class UacLogServiceImpl method saveOperationLog.

@Override
public Integer saveOperationLog(OperationLogDto operationLogDto) {
    // 根据uri 查询url对应的权限
    UacAction uacAction = uacActionService.matchesByUrl(operationLogDto.getRequestUrl());
    if (uacAction != null) {
        operationLogDto.setActionCode(uacAction.getActionCode());
        operationLogDto.setActionName(uacAction.getActionName());
        operationLogDto.setActionId(uacAction.getId());
    }
    ModelMapper modelMapper = new ModelMapper();
    UacLog uacLog = modelMapper.map(operationLogDto, UacLog.class);
    uacLog.setId(generateId());
    // 获取操作位置
    String locationById = opcRpcService.getLocationById(operationLogDto.getIp());
    uacLog.setLocation(locationById);
    return uacLogMapper.insertSelective(uacLog);
}
Also used : UacAction(com.paascloud.provider.model.domain.UacAction) UacLog(com.paascloud.provider.model.domain.UacLog) ModelMapper(org.modelmapper.ModelMapper)

Example 4 with UacAction

use of com.paascloud.provider.model.domain.UacAction in project paascloud-master by paascloud.

the class UacLogServiceImpl method saveLog.

@Override
public int saveLog(UacLog uacLog, LoginAuthDto loginAuthDto) {
    // 根据uri 查询url对应的权限
    UacAction uacAction = uacActionService.matchesByUrl(uacLog.getRequestUrl());
    if (uacAction != null) {
        uacLog.setActionId(uacAction.getId());
        uacLog.setActionCode(uacAction.getActionCode());
        uacLog.setActionName(uacAction.getActionName());
    }
    uacLog.setUpdateInfo(loginAuthDto);
    uacLog.setId(this.generateId());
    return uacLogMapper.insertSelective(uacLog);
}
Also used : UacAction(com.paascloud.provider.model.domain.UacAction)

Example 5 with UacAction

use of com.paascloud.provider.model.domain.UacAction in project paascloud-master by paascloud.

the class UacActionMainController method modifyActionStatus.

/**
 * 根据权限Id修改角色状态.
 *
 * @param modifyStatusDto the modify status dto
 *
 * @return the wrapper
 */
@PostMapping(value = "/modifyStatus")
@ApiOperation(httpMethod = "POST", value = "根据权限Id修改角色状态")
@LogAnnotation
public Wrapper modifyActionStatus(@ApiParam(name = "modifyActionStatus", value = "修改权限状态") @RequestBody ModifyStatusDto modifyStatusDto) {
    logger.info("根据角色Id修改权限状态 modifyStatusDto={}", modifyStatusDto);
    Long actionId = modifyStatusDto.getId();
    Preconditions.checkArgument(actionId != null, "权限ID不能为空");
    UacAction uacRole = new UacAction();
    uacRole.setId(actionId);
    uacRole.setStatus(modifyStatusDto.getStatus());
    uacRole.setUpdateInfo(getLoginAuthDto());
    int result = uacActionService.update(uacRole);
    return super.handleResult(result);
}
Also used : UacAction(com.paascloud.provider.model.domain.UacAction) LogAnnotation(com.paascloud.core.annotation.LogAnnotation) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

UacAction (com.paascloud.provider.model.domain.UacAction)5 PageInfo (com.github.pagehelper.PageInfo)1 LogAnnotation (com.paascloud.core.annotation.LogAnnotation)1 UacLog (com.paascloud.provider.model.domain.UacLog)1 UacBizException (com.paascloud.provider.model.exceptions.UacBizException)1 ActionVo (com.paascloud.provider.model.vo.ActionVo)1 ApiOperation (io.swagger.annotations.ApiOperation)1 ModelMapper (org.modelmapper.ModelMapper)1 Transactional (org.springframework.transaction.annotation.Transactional)1