|
|
|
@ -15,6 +15,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
|
|
|
import org.jeecg.common.constant.enums.ModuleType;
|
|
|
|
|
import org.jeecg.common.constant.enums.OperateTypeEnum;
|
|
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
|
|
import org.jeecg.modules.base.service.BaseCommonService;
|
|
|
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
|
|
|
import org.jeecg.common.util.IpUtils;
|
|
|
|
@ -52,17 +53,18 @@ public class AutoLogAspect {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Around("logPointCut()")
|
|
|
|
|
public Object around(ProceedingJoinPoint point) throws Throwable {
|
|
|
|
|
public void around(ProceedingJoinPoint point) throws Throwable {
|
|
|
|
|
long beginTime = System.currentTimeMillis();
|
|
|
|
|
//执行方法
|
|
|
|
|
Object result = point.proceed();
|
|
|
|
|
//执行时长(毫秒)
|
|
|
|
|
long time = System.currentTimeMillis() - beginTime;
|
|
|
|
|
|
|
|
|
|
//保存日志
|
|
|
|
|
saveSysLog(point, time, result);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
try{
|
|
|
|
|
Object result = point.proceed();
|
|
|
|
|
long time = System.currentTimeMillis() - beginTime;
|
|
|
|
|
saveSysLog(point, time, result);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
long time = System.currentTimeMillis() - beginTime;
|
|
|
|
|
saveSysLog(point, time, e.getMessage());
|
|
|
|
|
throw new JeecgBootException(e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveSysLog(ProceedingJoinPoint joinPoint, long time, Object obj) {
|
|
|
|
@ -95,6 +97,8 @@ public class AutoLogAspect {
|
|
|
|
|
|
|
|
|
|
//获取request
|
|
|
|
|
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
|
|
|
|
dto.setRequestUrl(request.getRequestURL().toString());
|
|
|
|
|
dto.setRequestType(request.getMethod());
|
|
|
|
|
//请求的参数
|
|
|
|
|
dto.setRequestParam(getReqestParams(request,joinPoint));
|
|
|
|
|
//设置IP地址
|
|
|
|
|