Browse Source

Merge remote-tracking branch 'origin/dev' into dev

dist.1.3.0
zhaoqiaobo 9 months ago
parent
commit
a597524d7e
  1. 2
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/AftersalesApplication.java
  2. 44
      blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/aspect/AsyncAnnotationAspect.java
  3. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java
  4. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/interceptor/LocalServerLoginAccountsInterceptor.java
  5. 7
      blade-service/logpm-factory/src/main/resources/application.yml
  6. 5
      blade-service/logpm-old-project/src/main/resources/application.yml
  7. 1
      blade-service/logpm-supervise/src/main/java/com/logpm/supervise/SuperviseApplication.java
  8. 44
      blade-service/logpm-supervise/src/main/java/com/logpm/supervise/aspect/AsyncAnnotationAspect.java

2
blade-service/logpm-aftersales/src/main/java/com/logpm/aftersales/AftersalesApplication.java

@ -27,7 +27,6 @@ import org.springblade.core.transaction.annotation.SeataCloudApplication;
* @author Chill
*/
@BladeCloudApplication
@SeataCloudApplication
//@EnableWebSocket
public class AftersalesApplication {
@ -35,6 +34,7 @@ public class AftersalesApplication {
BladeApplication.run(ModuleNameConstant.APPLICATION_AFTERSALES_NAME, AftersalesApplication.class, args);
}
/**
* 如果直接使用springboot的内置容器而不是使用独立的servlet容器就要注入ServerEndpointExporter外部容器则不需要
*/

44
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;
// }
}

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/config/RabbitMqConfiguration.java

@ -27,7 +27,7 @@ import static io.protostuff.MapSchema.MessageFactories.HashMap;
public class RabbitMqConfiguration {
@Bean
public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory,CustomMessageConverter converter) {
public RabbitTemplate createRabbitTemplate(ConnectionFactory connectionFactory, CustomMessageConverter converter) {
RabbitTemplate template = new RabbitTemplate();
template.setConnectionFactory(connectionFactory);
template.setMandatory(true);

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/interceptor/LocalServerLoginAccountsInterceptor.java

@ -43,7 +43,7 @@ public class LocalServerLoginAccountsInterceptor extends HandlerInterceptorAdapt
try {
JSONObject data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+"admin");
JSONObject data =bladeRedis.get(CacheNames.LOCAL_SERVER_USER+"shujutongbu");
CustomHttpServletRequestWrapper wrappedRequest = new CustomHttpServletRequestWrapper(request);
if(Objects.isNull(data)){
String url = "http://"+ LauncherConstant.loginAddr(AppConstant.DEV_CODE)+"/blade-auth/oauth/token";

7
blade-service/logpm-factory/src/main/resources/application.yml

@ -22,11 +22,8 @@ oss:
#blade配置
blade:
#本地文件上传
file:
remote-mode: true
upload-domain: http://localhost:8999
remote-path: /usr/share/nginx/html
data-scope:
enabled: false
logging:
config: classpath:logback.xml

5
blade-service/logpm-old-project/src/main/resources/application.yml

@ -10,7 +10,10 @@ swagger:
- org.springblade
- com.logpm
#blade配置
blade:
data-scope:
enabled: false
logging:
config: classpath:logback.xml

1
blade-service/logpm-supervise/src/main/java/com/logpm/supervise/SuperviseApplication.java

@ -13,7 +13,6 @@ import org.springblade.core.transaction.annotation.SeataCloudApplication;
* @author lmy
*/
@BladeCloudApplication
@SeataCloudApplication
public class SuperviseApplication {
public static void main(String[] args) {

44
blade-service/logpm-supervise/src/main/java/com/logpm/supervise/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.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.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;
// }
}

Loading…
Cancel
Save