Browse Source

PDF转换 线程池

tags/24080901
PoffyZhang 1 year ago
parent
commit
5301ec11e5
3 changed files with 7 additions and 18 deletions
  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 View File

@@ -108,15 +108,4 @@ public class BeanConfig {
.setRetryHandler(new DefaultHttpRequestRetryHandler(2, true)) .setRetryHandler(new DefaultHttpRequestRetryHandler(2, true))
.build(); .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 View File

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


/** /**


+ 6
- 5
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java View File

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


private final WpsConvertManage wpsConvertManage; private final WpsConvertManage wpsConvertManage;


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


@Value("${project.push-url}") @Value("${project.push-url}")
private String pushUrl; private String pushUrl;
@@ -445,7 +446,7 @@ public class GovProjectCollectionManage {
saveApply.setUpdateBy(user.getUsername()); saveApply.setUpdateBy(user.getUsername());
saveApply.setUpdateOn(LocalDateTime.now()); saveApply.setUpdateOn(LocalDateTime.now());
if(projectApplyService.saveOrUpdate(saveApply)){ 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.setUpdateBy(user.getUsername());
saveApprove.setUpdateOn(LocalDateTime.now()); saveApprove.setUpdateOn(LocalDateTime.now());
if(approveService.saveOrUpdate(saveApprove)){ 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.setUpdateBy(user.getUsername());
saveCimplement.setUpdateOn(LocalDateTime.now()); saveCimplement.setUpdateOn(LocalDateTime.now());
if(cimplementService.saveOrUpdate(saveCimplement)){ if(cimplementService.saveOrUpdate(saveCimplement)){
projectThreadPool.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement));
threadPoolTaskScheduler.execute(() -> uploadFileToProvincialOssCimplement(cimplement,oldCimplement,saveCimplement));
} }
} }




Loading…
Cancel
Save