Search in sources :

Example 16 with MenuResource

use of com.ibeiliao.deployment.admin.utils.resource.MenuResource in project Corgi by kevinYin.

the class ListEnvironmentController method delete.

/**
 * save
 */
@ResponseBody
@RequestMapping("save.do")
@MenuResource("保存环境")
public RestResult<Object> delete(int envId, String envName, int onlineFlag) {
    if (StringUtils.isBlank(envName)) {
        return new RestResult<>(ApiCode.PARAMETER_ERROR, "环境名称不能为空");
    }
    ProjectEnv projectEnv = new ProjectEnv();
    projectEnv.setEnvId(envId);
    projectEnv.setEnvName(envName.trim());
    projectEnv.setOnlineFlag(onlineFlag);
    projectEnvService.saveEnv(projectEnv);
    return new RestResult<>(null);
}
Also used : ProjectEnv(com.ibeiliao.deployment.admin.vo.global.ProjectEnv) RestResult(com.ibeiliao.deployment.admin.common.RestResult) MenuResource(com.ibeiliao.deployment.admin.utils.resource.MenuResource) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with MenuResource

use of com.ibeiliao.deployment.admin.utils.resource.MenuResource in project Corgi by kevinYin.

the class AdminLoggerAspect method processLog.

/**
 * 执行记录日志的操作
 *
 * @param jp
 * @param adminLog
 * @param result
 * @throws Exception
 */
private void processLog(JoinPoint jp, AdminLog adminLog, Object result) throws Exception {
    MethodSignature ms = (MethodSignature) jp.getSignature();
    Method method = ms.getMethod();
    // 日志类型,为空时取 MenuResource 的值
    String type = adminLog.type();
    if (StringUtils.isEmpty(type) && method.isAnnotationPresent(MenuResource.class)) {
        MenuResource menuResource = method.getAnnotation(MenuResource.class);
        type = menuResource.value();
    }
    if (doLog(adminLog, result)) {
        // 执行结果的信息
        String resultMessage = getResultMessage(adminLog, result);
        // 参数
        String arguments = getArguments(jp, method, adminLog);
        // ip
        // get admin id from AdminContext
        logger.info("参数列表 | admin: {}, type: {}, arguments: {}, result: {}", AdminContext.getAccountId(), type, arguments, resultMessage);
        // save log
        AdminLogger adminLogger = SpringContextUtil.getBean(AdminLogger.class);
        AdminOperationLog log = new AdminOperationLog();
        log.setOperationType(type);
        log.setResult(resultMessage);
        log.setArguments(arguments);
        log.setUid(AdminContext.getAccountId());
        adminLogger.saveAdminLog(log);
    } else {
        logger.info("DONT LOG ...............");
    }
}
Also used : MethodSignature(org.aspectj.lang.reflect.MethodSignature) MenuResource(com.ibeiliao.deployment.admin.utils.resource.MenuResource) Method(java.lang.reflect.Method) AdminOperationLog(com.ibeiliao.deployment.admin.vo.account.AdminOperationLog)

Aggregations

MenuResource (com.ibeiliao.deployment.admin.utils.resource.MenuResource)17 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)16 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)14 RestResult (com.ibeiliao.deployment.admin.common.RestResult)8 AdminAccount (com.ibeiliao.deployment.admin.vo.account.AdminAccount)5 Role (com.ibeiliao.deployment.admin.vo.account.Role)3 AdminLog (com.ibeiliao.deployment.admin.annotation.log.AdminLog)2 AccountRoleRelation (com.ibeiliao.deployment.admin.vo.account.AccountRoleRelation)2 DeployHistory (com.ibeiliao.deployment.admin.vo.deploy.DeployHistory)2 GlobalSetting (com.ibeiliao.deployment.admin.vo.global.GlobalSetting)2 ProjectEnv (com.ibeiliao.deployment.admin.vo.global.ProjectEnv)2 ProjectModule (com.ibeiliao.deployment.admin.vo.project.ProjectModule)2 JavaTransferService (com.ibeiliao.deployment.transfer.service.JavaTransferService)2 TransferRequest (com.ibeiliao.deployment.transfer.vo.TransferRequest)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 AllowAnonymous (com.ibeiliao.deployment.admin.annotation.authority.AllowAnonymous)1 PageResult (com.ibeiliao.deployment.admin.common.PageResult)1 AdminLoginUser (com.ibeiliao.deployment.admin.context.AdminLoginUser)1