完善积木报表的集成

This commit is contained in:
YunaiV 2022-07-28 23:23:44 +08:00
parent cba217cc29
commit e52a966b81
10 changed files with 53 additions and 31 deletions

View File

@ -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;
}
}

View File

@ -0,0 +1,4 @@
/**
* 占位
*/
package cn.iocoder.yudao.module.pay.framework.job.core;

View File

@ -0,0 +1,6 @@
/**
* 属于 pay 模块的 framework 封装
*
* @author 芋道源码
*/
package cn.iocoder.yudao.module.pay.framework;

View File

@ -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();
}

View File

@ -26,7 +26,7 @@
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-system-biz</artifactId>
<artifactId>yudao-module-system-api</artifactId>
<version>${revision}</version>
</dependency>
@ -35,6 +35,10 @@
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-tenant</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
@ -63,12 +67,6 @@
<dependency>
<groupId>org.jeecgframework.jimureport</groupId>
<artifactId>jimureport-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<artifactId>mongodb-driver-sync</artifactId> <!-- 暂时不使用 MongoDB -->
<groupId>org.mongodb</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

View File

@ -4,6 +4,7 @@ import cn.iocoder.yudao.module.system.api.oauth2.OAuth2TokenApi;
import cn.iocoder.yudao.module.visualization.framework.jmreport.core.service.JmReportTokenServiceImpl;
import org.jeecg.modules.jmreport.api.JmReportTokenServiceI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
/**
@ -12,6 +13,7 @@ import org.springframework.context.annotation.Configuration;
* @author 芋道源码
*/
@Configuration
@ComponentScan(basePackages = "org.jeecg.modules.jmreport") // 扫描积木报表的包
public class JmReportConfiguration {
@Bean

View File

@ -13,7 +13,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @author 芋道源码
*/
@SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${yudao.info.base-package}
@SpringBootApplication(scanBasePackages = {"${yudao.info.base-package}.server", "${yudao.info.base-package}.module", "org.jeecg.modules.jmreport"})
@SpringBootApplication(scanBasePackages = {"${yudao.info.base-package}.server", "${yudao.info.base-package}.module"})
public class YudaoServerApplication {
public static void main(String[] args) {

View File

@ -8,6 +8,7 @@ spring:
autoconfigure:
exclude:
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
- org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration # 排除积木报表带来的 MongoDB 的自动配置
datasource:
druid: # Druid 【监控】相关的全局配置
web-stat-filter:

View File

@ -8,6 +8,7 @@ spring:
autoconfigure:
exclude:
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源
- org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration # 排除积木报表带来的 MongoDB 的自动配置
datasource:
druid: # Druid 【监控】相关的全局配置
web-stat-filter:

View File

@ -1,19 +0,0 @@
<template>
<div>
<doc-alert title="接口文档" url="https://doc.iocoder.cn/api-doc/" />
<i-frame :src="url" />
</div>
</template>
<script>
import iFrame from "@/components/iFrame/index";
import {getAccessToken} from "@/utils/auth";
export default {
name: "JimuReport",
components: { iFrame },
data() {
return {
url: process.env.VUE_APP_BASE_API + "/jmreport/list?token=" + getAccessToken(),
};
},
};
</script>