From 4a35dea2b0976e7fdb0e2b1a0d7d9b8ac2af0fe4 Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期五, 01 十一月 2024 09:18:49 +0800
Subject: [PATCH] get product
---
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogAspect.java | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogAspect.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogAspect.java
index 1086ddc..e195700 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogAspect.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/aop/LogAspect.java
@@ -25,6 +25,9 @@
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.util.UriComponentsBuilder;
+import java.lang.reflect.Array;
+import java.util.Arrays;
+
@Slf4j
@Aspect
@Component
@@ -34,6 +37,8 @@
public String SsoCurUserUrl ;
private LogService logSv;
+ @Value("${pms.global.dev}")
+ public String isDevStage ;//鏄惁涓哄紑鍙戦樁娈�
@Autowired
public void setLogSv(LogService logSv){
this.logSv = logSv;
@@ -46,11 +51,13 @@
@AfterReturning(pointcut = "@annotation(com.dy.pmsGlobal.aop.Log)", returning = "result")
public void logAfterReturning(JoinPoint joinPoint, BaseResponse result) {
+ if(isDevStage != null && !isDevStage.trim().equals("") && isDevStage.trim().equalsIgnoreCase("true")){
+ return;
+ }
try{
// 鑾峰彇鐢ㄦ埛淇℃伅
BaUser user = (BaUser)getCurUser(result);
if(user!=null && user.id !=null && !StringUtils.isNullOrEmpty(user.name)){
- Long operator = user.id;
// 鑾峰彇鏂规硶鐨勪腑鏂囨弿杩�
MethodSignature sign = (MethodSignature) joinPoint.getSignature();
Log logDesc = sign.getMethod().getAnnotation(Log.class);
@@ -58,7 +65,10 @@
// 鑾峰彇IP鍦板潃
String ip = getRemoteHost();
// 璁板綍鏃ュ織
- logSv.save(operator, operationName,ip,result.getCode(),result.getMsg());
+ //msg 鏂规硶鍚� + 鍙傛暟鍊� + 杩斿洖鍊�
+ String args = JSONObject.toJSONString(joinPoint.getArgs());
+ //String args1 = Arrays.toString(joinPoint.getArgs());
+ logSv.save(user.id,user.name, operationName,ip,result.getCode(),args+" "+ result.getMsg());
}
}catch (Exception e){
log.error("璁板綍鏃ュ織寮傚父:"+e.getMessage());
--
Gitblit v1.8.0