diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java index f176489..daf2840 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java @@ -109,7 +109,7 @@ public class BeanConfig { .build(); } - @Bean + @Bean(value = "projectThreadPool") public ThreadPoolTaskExecutor getThreadPoolTaskExecutor(){ ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); threadPoolTaskExecutor.setCorePoolSize(5); diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java index 74b12ee..248662d 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java @@ -35,6 +35,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.formula.functions.T; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -45,6 +46,8 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.client.RestTemplate; +import javax.annotation.Resource; +import javax.annotation.Resources; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; @@ -86,7 +89,8 @@ public class GovProjectCollectionManage { private final WpsConvertManage wpsConvertManage; - private final ThreadPoolTaskExecutor threadPoolTaskExecutor; + @Resource(name = "projectThreadPool") + private ThreadPoolTaskExecutor projectThreadPool; @Value("${project.push-url}") private String pushUrl; @@ -441,7 +445,7 @@ public class GovProjectCollectionManage { saveApply.setUpdateBy(user.getUsername()); saveApply.setUpdateOn(LocalDateTime.now()); if(projectApplyService.saveOrUpdate(saveApply)){ - threadPoolTaskExecutor.execute(() -> uploadFileToProvincialOssApply(apply,oldApply,saveApply)); + projectThreadPool.execute(() -> uploadFileToProvincialOssApply(apply,oldApply,saveApply)); } } @@ -466,7 +470,7 @@ public class GovProjectCollectionManage { saveApprove.setUpdateBy(user.getUsername()); saveApprove.setUpdateOn(LocalDateTime.now()); if(approveService.saveOrUpdate(saveApprove)){ - threadPoolTaskExecutor.execute(() -> uploadFileToProvincialOssApprove(approve,oldApprove,saveApprove)); + projectThreadPool.execute(() -> uploadFileToProvincialOssApprove(approve,oldApprove,saveApprove)); } } @@ -492,7 +496,7 @@ public class GovProjectCollectionManage { saveCimplement.setUpdateBy(user.getUsername()); saveCimplement.setUpdateOn(LocalDateTime.now()); if(cimplementService.saveOrUpdate(saveCimplement)){ - threadPoolTaskExecutor.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement)); + projectThreadPool.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement)); } }