1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package com.diagbot.aop;
- import com.diagbot.log.entity.SysLog;
- import com.diagbot.enums.SysTypeEnum;
- import com.diagbot.rabbit.MySender;
- import com.diagbot.util.AopUtil;
- import org.aspectj.lang.JoinPoint;
- import org.aspectj.lang.annotation.Aspect;
- import org.aspectj.lang.annotation.Before;
- import org.aspectj.lang.annotation.Pointcut;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
- import org.springframework.stereotype.Component;
- /**
- * @Description: 日志拦截切面
- * @author: gaodm
- * @time: 2018/8/2 13:36
- */
- @Aspect
- @Component
- @ConditionalOnProperty(prefix = "syslog", value = { "enable" }, havingValue = "true")
- public class SysLoggerAspect {
- @Autowired
- private MySender mySender;
- @Pointcut("@annotation(com.diagbot.annotation.SysLogger)")
- public void loggerPointCut() {
- }
- @Before("loggerPointCut()")
- public void saveSysLog(JoinPoint joinPoint) {
- //入参设置
- SysLog sysLog = AopUtil.sysLoggerAspect(joinPoint, SysTypeEnum.DATA_SERVICE.getKey());
- //保存系统日志
- mySender.outputLogSend(sysLog);
- }
- }
|