| | |
| | | |
| | | @AfterReturning(pointcut = "@annotation(com.dy.pmsGlobal.aop.Log)", returning = "result") |
| | | public void logAfterReturning(JoinPoint joinPoint, Object result) { |
| | | // 获取方法的中文描述 |
| | | MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); |
| | | Log operationDescription = methodSignature.getMethod().getAnnotation(Log.class); |
| | | String operationName = operationDescription.value(); |
| | | //结果 |
| | | BaseResponse response = (BaseResponse)result; |
| | | response.isSuccess(); |
| | | BaseResponse res = (BaseResponse)result; |
| | | res.isSuccess(); |
| | | // 获取用户信息 |
| | | BaUser user = (BaUser)getCurUser(response); |
| | | Long operator = user!=null?user.id: 1l; |
| | | BaUser user = (BaUser)getCurUser(res); |
| | | if(user!=null){ |
| | | Long operator = user.id; |
| | | // 获取方法的中文描述 |
| | | MethodSignature sign = (MethodSignature) joinPoint.getSignature(); |
| | | Log logDesc = sign.getMethod().getAnnotation(Log.class); |
| | | String operationName = logDesc.value(); |
| | | // 获取IP地址 |
| | | String ip = getRemoteHost(); |
| | | // 记录日志 |
| | | logSv.save(operator, operationName,ip); |
| | | } |
| | | |
| | | // 获取IP地址 |
| | | String ipAddress = getRemoteHost(); |
| | | // 记录日志 |
| | | logSv.save(operator, operationName,ipAddress); |
| | | } |
| | | |
| | | /** |