This commit is contained in:
cc
2024-11-29 14:11:49 +08:00
parent cd8dd2ee4a
commit 3dfc6f0b3d
2 changed files with 3 additions and 2 deletions

View File

@@ -2,6 +2,7 @@ package cn.van.business.config;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler; import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler; import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer; import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
@@ -20,7 +21,7 @@ import java.util.concurrent.ThreadPoolExecutor;
@EnableAsync @EnableAsync
public class AsyncConfig implements AsyncConfigurer { public class AsyncConfig implements AsyncConfigurer {
@Override @Bean(name = "threadPoolTaskExecutor")
public Executor getAsyncExecutor() { public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(10); // 核心线程数 executor.setCorePoolSize(10); // 核心线程数

View File

@@ -32,7 +32,7 @@ public class OrderUtil {
/** /**
* 手动调用 将订单发送到微信 * 手动调用 将订单发送到微信
*/ */
@Async @Async("threadPoolTaskExecutor")
public void orderToWx(OrderRow orderRow, Boolean isAutoFlush) { public void orderToWx(OrderRow orderRow, Boolean isAutoFlush) {
// 获取订单当前状态 // 获取订单当前状态
Integer newValidCode = orderRow.getValidCode(); Integer newValidCode = orderRow.getValidCode();