Search in sources :

Example 11 with LogAnnotation

use of com.paascloud.core.annotation.LogAnnotation in project paascloud-master by paascloud.

the class UacUserMainController method modifyUserStatusById.

/**
 * 根据Id修改用户状态.
 *
 * @param modifyUserStatusDto the modify user status dto
 *
 * @return the wrapper
 */
@PostMapping(value = "/modifyUserStatusById")
@LogAnnotation
@ApiOperation(httpMethod = "POST", value = "根据Id修改用户状态")
public Wrapper<Integer> modifyUserStatusById(@ApiParam(name = "modifyUserStatusDto", value = "用户禁用/启用Dto") @RequestBody ModifyUserStatusDto modifyUserStatusDto) {
    logger.info(" 根据Id修改用户状态 modifyUserStatusDto={}", modifyUserStatusDto);
    LoginAuthDto loginAuthDto = getLoginAuthDto();
    UacUser uacUser = new UacUser();
    uacUser.setId(modifyUserStatusDto.getUserId());
    uacUser.setStatus(modifyUserStatusDto.getStatus());
    int result = uacUserService.modifyUserStatusById(uacUser, loginAuthDto);
    return handleResult(result);
}
Also used : UacUser(com.paascloud.provider.model.domain.UacUser) LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) LogAnnotation(com.paascloud.core.annotation.LogAnnotation) ApiOperation(io.swagger.annotations.ApiOperation)

Example 12 with LogAnnotation

use of com.paascloud.core.annotation.LogAnnotation in project paascloud-master by paascloud.

the class UacUserMainController method bindUserRoles.

/**
 * 用户绑定角色.
 *
 * @param bindUserRolesDto the bind user roles dto
 *
 * @return the wrapper
 */
@PostMapping(value = "/bindRole")
@LogAnnotation
@ApiOperation(httpMethod = "POST", value = "用户绑定角色")
public Wrapper<Integer> bindUserRoles(@ApiParam(name = "bindUserRolesDto", value = "用户绑定角色Dto") @RequestBody BindUserRolesDto bindUserRolesDto) {
    logger.info("用户绑定角色 bindUserRolesDto={}", bindUserRolesDto);
    LoginAuthDto loginAuthDto = getLoginAuthDto();
    uacUserService.bindUserRoles(bindUserRolesDto, loginAuthDto);
    return WrapMapper.ok();
}
Also used : LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) LogAnnotation(com.paascloud.core.annotation.LogAnnotation) ApiOperation(io.swagger.annotations.ApiOperation)

Example 13 with LogAnnotation

use of com.paascloud.core.annotation.LogAnnotation in project paascloud-master by paascloud.

the class UacMenuMainController method deleteUacMenuById.

/**
 * 根据id删除菜单
 *
 * @param id the id
 *
 * @return the wrapper
 */
@PostMapping(value = "/deleteById/{id}")
@ApiOperation(httpMethod = "POST", value = "删除菜单")
@LogAnnotation
public Wrapper<Integer> deleteUacMenuById(@ApiParam(name = "id", value = "菜单id") @PathVariable Long id) {
    logger.info(" 根据id删除菜单 id={}", id);
    LoginAuthDto loginAuthDto = getLoginAuthDto();
    Preconditions.checkArgument(id != null, "菜单ID不能为空");
    // 判断此菜单是否有子节点
    boolean hasChild = uacMenuService.checkMenuHasChildMenu(id);
    if (hasChild) {
        return WrapMapper.wrap(Wrapper.ERROR_CODE, "此菜单含有子菜单, 请先删除子菜单");
    }
    int result = uacMenuService.deleteUacMenuById(id, loginAuthDto);
    return super.handleResult(result);
}
Also used : LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) LogAnnotation(com.paascloud.core.annotation.LogAnnotation) ApiOperation(io.swagger.annotations.ApiOperation)

Example 14 with LogAnnotation

use of com.paascloud.core.annotation.LogAnnotation in project paascloud-master by paascloud.

the class UacMenuMainController method updateUacMenuStatusById.

/**
 * 根据id修改菜单的禁用状态
 *
 * @param uacMenuStatusDto the uac menu status dto
 *
 * @return the wrapper
 */
@PostMapping(value = "/modifyStatus")
@ApiOperation(httpMethod = "POST", value = "修改菜单状态")
@LogAnnotation
public Wrapper updateUacMenuStatusById(@ApiParam(name = "uacMenuStatusDto", value = "修改菜单状态Dto") @RequestBody UacMenuStatusDto uacMenuStatusDto) {
    logger.info("根据id修改菜单的禁用状态 uacMenuStatusDto={}", uacMenuStatusDto);
    LoginAuthDto loginAuthDto = getLoginAuthDto();
    uacMenuService.updateUacMenuStatusById(uacMenuStatusDto, loginAuthDto);
    return WrapMapper.ok();
}
Also used : LoginAuthDto(com.paascloud.base.dto.LoginAuthDto) LogAnnotation(com.paascloud.core.annotation.LogAnnotation) ApiOperation(io.swagger.annotations.ApiOperation)

Example 15 with LogAnnotation

use of com.paascloud.core.annotation.LogAnnotation in project paascloud-master by paascloud.

the class LogAspect method giveController.

/**
 * 是否存在注解, 如果存在就记录日志
 */
private static LogAnnotation giveController(JoinPoint joinPoint) {
    Method[] methods = joinPoint.getTarget().getClass().getDeclaredMethods();
    String methodName = joinPoint.getSignature().getName();
    if (null != methods && 0 < methods.length) {
        for (Method met : methods) {
            LogAnnotation relog = met.getAnnotation(LogAnnotation.class);
            if (null != relog && methodName.equals(met.getName())) {
                return relog;
            }
        }
    }
    return null;
}
Also used : LogAnnotation(com.paascloud.core.annotation.LogAnnotation) Method(java.lang.reflect.Method)

Aggregations

LogAnnotation (com.paascloud.core.annotation.LogAnnotation)24 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)22 ApiOperation (io.swagger.annotations.ApiOperation)22 ValidateAnnotation (com.paascloud.core.annotation.ValidateAnnotation)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 OperationLogDto (com.paascloud.core.annotation.OperationLogDto)1 MdcProductCategory (com.paascloud.provider.model.domain.MdcProductCategory)1 TpcMqConsumer (com.paascloud.provider.model.domain.TpcMqConsumer)1 TpcMqProducer (com.paascloud.provider.model.domain.TpcMqProducer)1 TpcMqTag (com.paascloud.provider.model.domain.TpcMqTag)1 TpcMqTopic (com.paascloud.provider.model.domain.TpcMqTopic)1 UacAction (com.paascloud.provider.model.domain.UacAction)1 UacGroup (com.paascloud.provider.model.domain.UacGroup)1 UacMenu (com.paascloud.provider.model.domain.UacMenu)1 UacRole (com.paascloud.provider.model.domain.UacRole)1 UacRoleUser (com.paascloud.provider.model.domain.UacRoleUser)1 UacUser (com.paascloud.provider.model.domain.UacUser)1 UacBizException (com.paascloud.provider.model.exceptions.UacBizException)1 UserAgent (eu.bitwalker.useragentutils.UserAgent)1 Method (java.lang.reflect.Method)1