|
|
|
@ -8,6 +8,8 @@ import com.dongjian.dashboard.back.model.DashboardOperationLog; |
|
|
|
import com.dongjian.dashboard.back.service.common.CommonOpt; |
|
|
|
import com.dongjian.dashboard.back.util.IPUtils; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import jakarta.servlet.ServletRequest; |
|
|
|
import jakarta.servlet.ServletResponse; |
|
|
|
import jakarta.servlet.http.HttpServletRequest; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
@ -71,7 +73,12 @@ public class OperationLogAspect { |
|
|
|
logEntry.setMethodName(method.getName()); |
|
|
|
logEntry.setClassName(signature.getDeclaringTypeName()); |
|
|
|
logEntry.setIpAddress(IPUtils.getClientIp(request)); |
|
|
|
String paramsJson = objectMapper.writeValueAsString(joinPoint.getArgs()); |
|
|
|
// String paramsJson = objectMapper.writeValueAsString(joinPoint.getArgs());
|
|
|
|
Object[] filteredArgs = Arrays.stream(joinPoint.getArgs()) |
|
|
|
.filter(arg -> !(arg instanceof ServletRequest) && !(arg instanceof ServletResponse)) |
|
|
|
.toArray(); |
|
|
|
String paramsJson = objectMapper.writeValueAsString(filteredArgs); |
|
|
|
|
|
|
|
logEntry.setRequestParams(paramsJson); |
|
|
|
logEntry.setExecutionTimeMs(duration); |
|
|
|
logEntry.setCreatedAt(System.currentTimeMillis()); |
|
|
|
|