Browse Source

设置数据读取超时时长为2分钟,送货提醒轮询数据改成100条

XiaoST 5 years ago
parent
commit
bdd92f58bc

+ 1 - 1
src/main/java/com/uas/erp/schedular/b2b/task/PurchaseNotifyTask.java

@@ -27,7 +27,7 @@ public class PurchaseNotifyTask extends AbstractTask {
 
     @TaskMapping(title = "上传送货提醒", fixedDelay = 30000)
     public void uploadPurchaseNotify() {
-        List<PurchaseNotify> notifies = jdbcTemplate.queryForBeanList("select * from (select purchasenotify.*,ve_uu,pr_zxbzs from purchasenotify left join purchase on pn_ordercode=pu_code left join vendor on pu_vendcode=ve_code left join product on pr_code=pn_prodcode where nvl(PN_SENDSTATUS,' ')='待上传'and pn_status<>'已取消' and nvl(pu_sendstatus, '') = '已上传' and nvl(pu_ordertype,' ')<>'B2C' and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)<>0 order by pn_indate) where rownum <=60",
+        List<PurchaseNotify> notifies = jdbcTemplate.queryForBeanList("select * from (select purchasenotify.*,ve_uu,pr_zxbzs from purchasenotify left join purchase on pn_ordercode=pu_code left join vendor on pu_vendcode=ve_code left join product on pr_code=pn_prodcode where nvl(PN_SENDSTATUS,' ')='待上传'and pn_status<>'已取消' and nvl(pu_sendstatus, '') = '已上传' and nvl(pu_ordertype,' ')<>'B2C' and coalesce(ve_uu, '0') <> '0' and nvl(ve_b2benable,0)<>0 order by pn_indate) where rownum <=100",
                 PurchaseNotify.class);
         if (!CollectionUtils.isEmpty(notifies)) {
             ContextHolder.setDataSize(notifies.size());

+ 4 - 1
src/main/java/com/uas/erp/schedular/config/WebMvcConfig.java

@@ -2,6 +2,7 @@ package com.uas.erp.schedular.config;
 
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
 import org.springframework.http.converter.HttpMessageConverter;
 import org.springframework.http.converter.StringHttpMessageConverter;
 import org.springframework.web.client.RestTemplate;
@@ -54,7 +55,9 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
 
     @Bean
     public RestTemplate restTemplate() {
-        RestTemplate restTemplate = new RestTemplate();
+        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
+        requestFactory.setReadTimeout(120000);  //@add xiaost 20200226 设置数据读取超时时长为2分钟
+        RestTemplate restTemplate = new RestTemplate(requestFactory);
         restTemplate.getMessageConverters().add(0, responseBodyConverter());
         return restTemplate;
     }