use of com.dimple.framework.aspectj.lang.annotation.VLog in project DimpleBlog by martin-chips.
the class FrontController method blogDetail.
@GetMapping("/blog/{id}")
@VLog(title = "查看博客", pageId = "#id")
public AjaxResult blogDetail(@PathVariable Long id) {
Blog blog = frontService.selectBlogDetailById(id);
frontService.incrementBlogClick(id);
return AjaxResult.success(blog);
}
use of com.dimple.framework.aspectj.lang.annotation.VLog in project DimpleBlog by martin-chips.
the class VisitLogAspect method handleLog.
protected void handleLog(final JoinPoint joinPoint, final Exception e) {
try {
// 获得注解
VLog vLog = getAnnotationLog(joinPoint);
if (vLog == null) {
return;
}
VisitLog visitLog = new VisitLog();
visitLog.setPageId(getPageId(vLog, joinPoint));
visitLog.setIp(IpUtils.getIpAddr(ServletUtils.getRequest()));
visitLog.setUrl(ServletUtils.getRequest().getRequestURI());
if (e != null) {
visitLog.setStatus(false);
visitLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000));
} else {
visitLog.setStatus(true);
}
// 设置入口地址
visitLog.setEntryUrl(ServletUtils.getRequest().getHeader("referer"));
// 处理设置注解上的参数
getControllerMethodDescription(vLog, visitLog);
// 保存数据库
AsyncManager.me().execute(AsyncFactory.recordVisitLog(visitLog));
} catch (Exception exp) {
// 记录本地异常日志
log.error("异常信息:{}", exp.getMessage(), exp);
}
}
Aggregations