对于支付宝回调参数打印,做简化处理

This commit is contained in:
2025-09-05 02:17:10 +08:00
parent c8d8019e36
commit 925f6e0294

View File

@ -37,6 +37,21 @@ public class WebLogAspect {
*/
@Before("webLog()")
public void doBefore(JoinPoint joinPoint) {
// 检查是否是支付宝回调控制器
String className = joinPoint.getTarget().getClass().getSimpleName();
if ("AliPayNotifyController".equals(className)) {
// 对于支付宝回调,简化日志处理
log.info("========================= Start =========================");
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if (attributes != null) {
HttpServletRequest request = attributes.getRequest();
log.info("URL:{}", request.getRequestURL().toString());
}
String requestId = UUID.randomUUID().toString();
// 使用 requestId 的一部分作为日志标识
MDC.put("requestId", requestId.substring(Math.max(0, requestId.length() - 12)));
return;
}
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletRequest request = null;
String requestId = null;