|
@ -24,9 +24,12 @@ Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意
|
|
|
*/
|
|
|
package cn.stylefeng.guns.sys.core.aop;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.stylefeng.guns.core.annotion.BusinessLog;
|
|
|
import cn.stylefeng.guns.core.consts.AopSortConstant;
|
|
|
import cn.stylefeng.guns.core.consts.CommonConstant;
|
|
|
import cn.stylefeng.guns.core.context.login.LoginContextHolder;
|
|
|
import cn.stylefeng.guns.core.pojo.login.SysLoginUser;
|
|
|
import cn.stylefeng.guns.sys.core.log.LogManager;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import org.aspectj.lang.JoinPoint;
|
|
@ -70,10 +73,14 @@ public class BusinessLogAop {
|
|
|
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
|
|
|
Method method = methodSignature.getMethod();
|
|
|
BusinessLog businessLog = method.getAnnotation(BusinessLog.class);
|
|
|
|
|
|
SysLoginUser sysLoginUser = LoginContextHolder.me().getSysLoginUserWithoutException();
|
|
|
String account = CommonConstant.UNKNOWN;
|
|
|
if(ObjectUtil.isNotNull(sysLoginUser)) {
|
|
|
account = sysLoginUser.getAccount();
|
|
|
}
|
|
|
//异步记录日志
|
|
|
LogManager.me().executeOperationLog(
|
|
|
businessLog, LoginContextHolder.me().getSysLoginUserAccount(), joinPoint, JSON.toJSONString(result));
|
|
|
businessLog, account, joinPoint, JSON.toJSONString(result));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@ -87,9 +94,13 @@ public class BusinessLogAop {
|
|
|
MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature();
|
|
|
Method method = methodSignature.getMethod();
|
|
|
BusinessLog businessLog = method.getAnnotation(BusinessLog.class);
|
|
|
|
|
|
SysLoginUser sysLoginUser = LoginContextHolder.me().getSysLoginUserWithoutException();
|
|
|
String account = CommonConstant.UNKNOWN;
|
|
|
if(ObjectUtil.isNotNull(sysLoginUser)) {
|
|
|
account = sysLoginUser.getAccount();
|
|
|
}
|
|
|
//异步记录日志
|
|
|
LogManager.me().executeExceptionLog(
|
|
|
businessLog, LoginContextHolder.me().getSysLoginUserAccount(), joinPoint, exception);
|
|
|
businessLog, account, joinPoint, exception);
|
|
|
}
|
|
|
}
|