yumeng 4 gadi atpakaļ
vecāks
revīzija
8db6607510

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouMaterialUploadServiceImpl.java

@@ -18,6 +18,7 @@ import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
 import org.springframework.stereotype.Service;
 import org.springframework.util.LinkedMultiValueMap;
 import org.springframework.util.MultiValueMap;
@@ -223,6 +224,10 @@ public class KuaiShouMaterialUploadServiceImpl implements IKuaiShouMaterialUploa
                         headers.add(key, headerMap.get(key));
                     }
                 }
+                SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
+                requestFactory.setConnectTimeout(1000 * 500);// 设置超时
+                requestFactory.setReadTimeout(1000 * 500);
+                RestTemplate rest = new RestTemplate(requestFactory);
                 HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<>(param, headers);
                 ResponseEntity<String> responseEntity = rest.exchange(url, HttpMethod.POST, httpEntity, String.class);
                 return responseEntity.getBody();