use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacRoleActionServiceImpl method listByRoleId.
@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public List<UacRoleAction> listByRoleId(Long roleId) {
if (roleId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10012001);
}
UacRoleAction roleMenu = new UacRoleAction();
roleMenu.setRoleId(roleId);
return uacRoleActionMapper.select(roleMenu);
}
use of com.paascloud.provider.model.exceptions.UacBizException 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;
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacRoleMainController method modifyUacRoleStatusById.
/**
* 修改角色状态.
*
* @param modifyStatusDto the modify status dto
*
* @return the wrapper
*/
@LogAnnotation
@PostMapping(value = "/modifyRoleStatusById")
@ApiOperation(httpMethod = "POST", value = "根据角色Id修改角色状态")
public Wrapper modifyUacRoleStatusById(@ApiParam(name = "modifyRoleStatusDto", value = "修改角色状态数据") @RequestBody ModifyStatusDto modifyStatusDto) {
logger.info("根据角色Id修改角色状态 modifyStatusDto={}", modifyStatusDto);
Long roleId = modifyStatusDto.getId();
if (roleId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10012001);
}
LoginAuthDto loginAuthDto = getLoginAuthDto();
Long userId = loginAuthDto.getUserId();
UacRoleUser ru = uacRoleUserService.getByUserIdAndRoleId(userId, roleId);
if (ru != null && UacRoleStatusEnum.DISABLE.getType().equals(modifyStatusDto.getStatus())) {
throw new UacBizException(ErrorCodeEnum.UAC10012002);
}
UacRole uacRole = new UacRole();
uacRole.setId(roleId);
uacRole.setStatus(modifyStatusDto.getStatus());
uacRole.setUpdateInfo(loginAuthDto);
int result = uacRoleService.update(uacRole);
return super.handleResult(result);
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacUserMainController method getBindRole.
/**
* 获取用户绑定角色页面数据.
*
* @param userId the user id
*
* @return the bind role
*/
@PostMapping(value = "/getBindRole/{userId}")
@ApiOperation(httpMethod = "POST", value = "获取用户绑定角色页面数据")
public Wrapper<UserBindRoleVo> getBindRole(@ApiParam(name = "userId", value = "角色id") @PathVariable Long userId) {
logger.info("获取用户绑定角色页面数据. userId={}", userId);
LoginAuthDto loginAuthDto = super.getLoginAuthDto();
Long currentUserId = loginAuthDto.getUserId();
if (Objects.equals(userId, currentUserId)) {
throw new UacBizException(ErrorCodeEnum.UAC10011023);
}
UserBindRoleVo bindUserDto = uacUserService.getUserBindRoleDto(userId);
return WrapMapper.ok(bindUserDto);
}
use of com.paascloud.provider.model.exceptions.UacBizException in project paascloud-master by paascloud.
the class UacRoleUserServiceImpl method saveRoleUser.
@Override
public int saveRoleUser(Long userId, Long roleId) {
if (userId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10011001);
}
if (roleId == null) {
throw new UacBizException(ErrorCodeEnum.UAC10012001);
}
UacRoleUser roleUser = new UacRoleUser();
roleUser.setUserId(userId);
roleUser.setRoleId(roleId);
return uacRoleUserMapper.insertSelective(roleUser);
}
Aggregations