操作日志新增返回参数

This commit is contained in:
RuoYi
2019-09-20 19:07:22 +08:00
parent 64f0e9d282
commit 16270ae869
5 changed files with 40 additions and 12 deletions

View File

@ -45,10 +45,10 @@ public class LogAspect
*
* @param joinPoint 切点
*/
@AfterReturning(pointcut = "logPointCut()")
public void doAfterReturning(JoinPoint joinPoint)
@AfterReturning(pointcut = "logPointCut()", returning = "jsonResult")
public void doAfterReturning(JoinPoint joinPoint, Object jsonResult)
{
handleLog(joinPoint, null);
handleLog(joinPoint, null, jsonResult);
}
/**
@ -60,10 +60,10 @@ public class LogAspect
@AfterThrowing(value = "logPointCut()", throwing = "e")
public void doAfterThrowing(JoinPoint joinPoint, Exception e)
{
handleLog(joinPoint, e);
handleLog(joinPoint, e, null);
}
protected void handleLog(final JoinPoint joinPoint, final Exception e)
protected void handleLog(final JoinPoint joinPoint, final Exception e, Object jsonResult)
{
try
{
@ -83,6 +83,8 @@ public class LogAspect
// 请求的地址
String ip = ShiroUtils.getIp();
operLog.setOperIp(ip);
// 返回参数
operLog.setJsonResult(JSON.marshal(jsonResult));
operLog.setOperUrl(ServletUtils.getRequest().getRequestURI());
if (currentUser != null)