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);
}
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 ...............");
}
}
Aggregations