添加线程池配置

This commit is contained in:
齐天大圣 2023-11-01 16:57:21 +08:00
parent 7f168fe62d
commit 98d8b99d82
4 changed files with 55 additions and 2 deletions

View File

@ -3,17 +3,17 @@ package com.fuint.business.marketingActivity.cardFule.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.marketingActivity.cardFule.entity.CardFuelDiesel;
import com.fuint.business.marketingActivity.cardFule.service.CardFuelDieselService;
import com.fuint.business.marketingActivity.cardGift.entity.CardGift;
import com.fuint.business.store.service.StoreService;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

View File

@ -24,6 +24,8 @@ public class CardFuelDiesel extends Model<CardFuelDiesel> {
private Integer storeId;
//储值卡状态 1在用 2挂失 3停用
private String status;
//油卡类型 0汽油卡 1柴油卡 2天然气
private String type;
//油品类型00# 1-10# 2京0#
private String oilType;
//锁价单价
@ -86,6 +88,14 @@ public class CardFuelDiesel extends Model<CardFuelDiesel> {
this.status = status;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getOilType() {
return oilType;
}

View File

@ -0,0 +1,39 @@
package com.fuint.framework.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* @Description 异步任务线程池配置类
* @Author 纪寒
* @Date 2023-03-17 09:55:36
* @Version 1.0
*/
@Slf4j
@Configuration
@EnableAsync
public class AsyncExecutorConfig {
/**
* 创建一个核心线程为10个最大线程为20等待队列为10拒绝策略为线程最大需求满就返回给调度线程执行
*
* @return 创建完的线程池
*/
@Bean
public Executor asyncThreadServiceExecutor() {
log.info("异步线程池配置执行");
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(10);
executor.setMaxPoolSize(20);
executor.setQueueCapacity(10);
executor.setThreadNamePrefix("async-thread-service-");
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
executor.initialize();
return executor;
}
}

View File

@ -45,6 +45,10 @@
<artifactId>poi-ooxml</artifactId>
<version>3.14</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!-- poi end -->
</dependencies>