use of com.moon.admin.domain.SysLogs in project moon by gentoo111.
the class SysLogServiceImpl method save.
@Async
@Override
public void save(Long userId, String module, Boolean flag, String remark) {
SysLogs sysLogs = new SysLogs();
sysLogs.setFlag(flag);
sysLogs.setModule(module);
sysLogs.setRemark(remark);
User user = new User();
user.setId(userId);
sysLogs.setUser(user);
sysLogsDao.save(sysLogs);
}
use of com.moon.admin.domain.SysLogs in project moon by gentoo111.
the class LogAdvice method logSave.
@Around(value = "@annotation(com.moon.admin.common.utils.LogAnnotation)")
public Object logSave(ProceedingJoinPoint joinPoint) throws Throwable {
SysLogs sysLogs = new SysLogs();
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
String module = null;
LogAnnotation logAnnotation = methodSignature.getMethod().getDeclaredAnnotation(LogAnnotation.class);
module = logAnnotation.module();
if (StringUtils.isEmpty(module)) {
ApiOperation apiOperation = methodSignature.getMethod().getDeclaredAnnotation(ApiOperation.class);
if (apiOperation != null) {
module = apiOperation.value();
}
}
if (StringUtils.isEmpty(module)) {
throw new RuntimeException("没有指定日志module");
}
sysLogs.setModule(module);
try {
Object object = joinPoint.proceed();
sysLogs.setFlag(true);
sysLogService.save(sysLogs);
return object;
} catch (Exception e) {
sysLogs.setFlag(false);
sysLogs.setRemark(e.getMessage());
sysLogService.save(sysLogs);
throw e;
}
}
Aggregations