Parcourir la source

PDF转换 线程池

tags/24080901
PoffyZhang il y a 1 an
Parent
révision
5301ec11e5
3 fichiers modifiés avec 7 ajouts et 18 suppressions
  1. +0
    -11
      pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java
  2. +1
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java
  3. +6
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java

+ 0
- 11
pmapi/src/main/java/com/ningdatech/pmapi/common/config/BeanConfig.java Voir le fichier

@@ -108,15 +108,4 @@ public class BeanConfig {
.setRetryHandler(new DefaultHttpRequestRetryHandler(2, true))
.build();
}

@Bean(value = "projectThreadPool")
public ThreadPoolTaskExecutor getThreadPoolTaskExecutor(){
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor();
threadPoolTaskExecutor.setCorePoolSize(5);
threadPoolTaskExecutor.setKeepAliveSeconds(200);
threadPoolTaskExecutor.setMaxPoolSize(10);
threadPoolTaskExecutor.setQueueCapacity(20);
threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
return threadPoolTaskExecutor;
}
}

+ 1
- 2
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/RegionConst.java Voir le fichier

@@ -24,13 +24,12 @@ public interface RegionConst {
* 丽水行政区划编码
*/
String RC_LS = "331100";
//丽水开发区
String LS_KF = "331118";
String LS_KF_IRS = "331151";
String RC_LS_SBJ_IRS = "331101";
//遂昌县
String RC_SC = "331123";
//丽水开发区
String LS_KF = "331118";
String LS_KF_NAME = "开发区";

/**


+ 6
- 5
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java Voir le fichier

@@ -42,6 +42,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
@@ -89,8 +90,8 @@ public class GovProjectCollectionManage {

private final WpsConvertManage wpsConvertManage;

@Resource(name = "projectThreadPool")
private ThreadPoolTaskExecutor projectThreadPool;
@Resource
private ThreadPoolTaskScheduler threadPoolTaskScheduler;

@Value("${project.push-url}")
private String pushUrl;
@@ -445,7 +446,7 @@ public class GovProjectCollectionManage {
saveApply.setUpdateBy(user.getUsername());
saveApply.setUpdateOn(LocalDateTime.now());
if(projectApplyService.saveOrUpdate(saveApply)){
projectThreadPool.execute(() -> uploadFileToProvincialOssApply(apply,oldApply,saveApply));
threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApply(apply,oldApply,saveApply));
}
}

@@ -470,7 +471,7 @@ public class GovProjectCollectionManage {
saveApprove.setUpdateBy(user.getUsername());
saveApprove.setUpdateOn(LocalDateTime.now());
if(approveService.saveOrUpdate(saveApprove)){
projectThreadPool.execute(() -> uploadFileToProvincialOssApprove(approve,oldApprove,saveApprove));
threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssApprove(approve,oldApprove,saveApprove));
}
}

@@ -496,7 +497,7 @@ public class GovProjectCollectionManage {
saveCimplement.setUpdateBy(user.getUsername());
saveCimplement.setUpdateOn(LocalDateTime.now());
if(cimplementService.saveOrUpdate(saveCimplement)){
projectThreadPool.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement));
threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement));
}
}



Chargement…
Annuler
Enregistrer