From 9c69378cde005f8f82363ffe7d2a102ac94eb36d Mon Sep 17 00:00:00 2001 From: "pref_mail@163.com" Date: Wed, 8 May 2024 21:02:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E5=94=AE=E5=90=8E?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aspect/AsyncAnnotationAspect.java | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/aspect/AsyncAnnotationAspect.java b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/aspect/AsyncAnnotationAspect.java index ab25d4441..4057ca293 100644 --- a/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/aspect/AsyncAnnotationAspect.java +++ b/blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/aspect/AsyncAnnotationAspect.java @@ -54,28 +54,28 @@ public class AsyncAnnotationAspect { * @return 返回被拦截方法的执行结果。 * @throws Throwable 如果执行过程中发生异常,则抛出。 */ - @Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)") - public Object rabbitMethods(ProceedingJoinPoint joinPoint) throws Throwable { - // 在方法执行前,获取当前租户ID并设置到数据源上下文中 - String tenantId = AuthUtil.getTenantId(); - DynamicDataSourceContextHolder.push(tenantId); - // 执行原方法 - Object result = joinPoint.proceed(); - // 在方法执行后,从数据源上下文中移除租户ID - DynamicDataSourceContextHolder.poll(); - return result; - } - @Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)") - public Object rabbitHandlerMethods(ProceedingJoinPoint joinPoint) throws Throwable { - // 在方法执行前,获取当前租户ID并设置到数据源上下文中 - String tenantId = AuthUtil.getTenantId(); - DynamicDataSourceContextHolder.push(tenantId); - // 执行原方法 - Object result = joinPoint.proceed(); - // 在方法执行后,从数据源上下文中移除租户ID - DynamicDataSourceContextHolder.poll(); - return result; - } +// @Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitListener)") +// public Object rabbitMethods(ProceedingJoinPoint joinPoint) throws Throwable { +// // 在方法执行前,获取当前租户ID并设置到数据源上下文中 +// String tenantId = AuthUtil.getTenantId(); +// DynamicDataSourceContextHolder.push(tenantId); +// // 执行原方法 +// Object result = joinPoint.proceed(); +// // 在方法执行后,从数据源上下文中移除租户ID +// DynamicDataSourceContextHolder.poll(); +// return result; +// } +// @Around("@annotation(org.springframework.amqp.rabbit.annotation.RabbitHandler)") +// public Object rabbitHandlerMethods(ProceedingJoinPoint joinPoint) throws Throwable { +// // 在方法执行前,获取当前租户ID并设置到数据源上下文中 +// String tenantId = AuthUtil.getTenantId(); +// DynamicDataSourceContextHolder.push(tenantId); +// // 执行原方法 +// Object result = joinPoint.proceed(); +// // 在方法执行后,从数据源上下文中移除租户ID +// DynamicDataSourceContextHolder.poll(); +// return result; +// } }