mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 20:28:44 +08:00 
			
		
		
		
	完善积木报表的集成
This commit is contained in:
		@@ -0,0 +1,28 @@
 | 
			
		||||
package cn.iocoder.yudao.module.pay.framework.job.config;
 | 
			
		||||
 | 
			
		||||
import org.springframework.context.annotation.Bean;
 | 
			
		||||
import org.springframework.context.annotation.Configuration;
 | 
			
		||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 | 
			
		||||
 | 
			
		||||
import java.util.concurrent.ThreadPoolExecutor;
 | 
			
		||||
 | 
			
		||||
@Configuration
 | 
			
		||||
public class PayJobConfiguration {
 | 
			
		||||
 | 
			
		||||
    public static final String NOTIFY_THREAD_POOL_TASK_EXECUTOR = "NOTIFY_THREAD_POOL_TASK_EXECUTOR";
 | 
			
		||||
 | 
			
		||||
    @Bean(NOTIFY_THREAD_POOL_TASK_EXECUTOR)
 | 
			
		||||
    public ThreadPoolTaskExecutor notifyThreadPoolTaskExecutor() {
 | 
			
		||||
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
 | 
			
		||||
        executor.setCorePoolSize(8); // 设置核心线程数
 | 
			
		||||
        executor.setMaxPoolSize(16); // 设置最大线程数
 | 
			
		||||
        executor.setKeepAliveSeconds(60); // 设置空闲时间
 | 
			
		||||
        executor.setQueueCapacity(100); // 设置队列大小
 | 
			
		||||
        executor.setThreadNamePrefix("notify-task-"); // 配置线程池的前缀
 | 
			
		||||
        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
 | 
			
		||||
        // 进行加载
 | 
			
		||||
        executor.initialize();
 | 
			
		||||
        return executor;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,4 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 占位
 | 
			
		||||
 */
 | 
			
		||||
package cn.iocoder.yudao.module.pay.framework.job.core;
 | 
			
		||||
@@ -0,0 +1,6 @@
 | 
			
		||||
/**
 | 
			
		||||
 * 属于 pay 模块的 framework 封装
 | 
			
		||||
 *
 | 
			
		||||
 * @author 芋道源码
 | 
			
		||||
 */
 | 
			
		||||
package cn.iocoder.yudao.module.pay.framework;
 | 
			
		||||
@@ -36,6 +36,8 @@ import java.util.Objects;
 | 
			
		||||
import java.util.concurrent.CountDownLatch;
 | 
			
		||||
import java.util.concurrent.TimeUnit;
 | 
			
		||||
 | 
			
		||||
import static cn.iocoder.yudao.module.pay.framework.job.config.PayJobConfiguration.NOTIFY_THREAD_POOL_TASK_EXECUTOR;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 支付通知 Core Service 实现类
 | 
			
		||||
 *
 | 
			
		||||
@@ -67,9 +69,8 @@ public class PayNotifyServiceImpl implements PayNotifyService {
 | 
			
		||||
    @Resource
 | 
			
		||||
    private PayNotifyLogCoreMapper payNotifyLogCoreMapper;
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    @Lazy
 | 
			
		||||
    private ThreadPoolTaskExecutor threadPoolTaskExecutor; // TODO 芋艿:未来提供独立的线程池
 | 
			
		||||
    @Resource(name = NOTIFY_THREAD_POOL_TASK_EXECUTOR)
 | 
			
		||||
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;
 | 
			
		||||
 | 
			
		||||
    @Resource
 | 
			
		||||
    private PayNotifyLockRedisDAO payNotifyLockCoreRedisDAO;
 | 
			
		||||
@@ -120,7 +121,7 @@ public class PayNotifyServiceImpl implements PayNotifyService {
 | 
			
		||||
            }
 | 
			
		||||
        }));
 | 
			
		||||
        // 等待完成
 | 
			
		||||
        this.awaitExecuteNotify(latch);
 | 
			
		||||
        awaitExecuteNotify(latch);
 | 
			
		||||
        // 返回执行完成的任务数(成功 + 失败)
 | 
			
		||||
        return tasks.size();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user