对接比亚迪-下载比亚迪的文件接口,传参方式修按照他们的接口,改成URL传参。
This commit is contained in:
+7
-1
@@ -61,6 +61,7 @@ import org.springframework.util.LinkedMultiValueMap;
|
|||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.web.util.UriComponentsBuilder;
|
||||||
import org.w3c.dom.NamedNodeMap;
|
import org.w3c.dom.NamedNodeMap;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
@@ -235,7 +236,12 @@ public class FileSpiltService {
|
|||||||
HttpEntity<Map<String, String>> requestEntity = new HttpEntity<>(params, headers);
|
HttpEntity<Map<String, String>> requestEntity = new HttpEntity<>(params, headers);
|
||||||
|
|
||||||
// 发送POST请求并获取响应
|
// 发送POST请求并获取响应
|
||||||
ResponseEntity<byte[]> responseEntity = restTemplate.postForEntity(bydDownLoadFileUrl, requestEntity, byte[].class);
|
// ResponseEntity<byte[]> responseEntity = restTemplate.postForEntity(bydDownLoadFileUrl, requestEntity, byte[].class);
|
||||||
|
|
||||||
|
Long fileIdLong = Long.valueOf(sarFileSplitInfoEO.getId());
|
||||||
|
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(bydDownLoadFileUrl).queryParam("fileId", fileIdLong);
|
||||||
|
// 发送POST请求并获取响应
|
||||||
|
ResponseEntity<byte[]> responseEntity = restTemplate.postForEntity(builder.toUriString(), requestEntity, byte[].class);
|
||||||
// 获取文件流
|
// 获取文件流
|
||||||
splitFileIs = new ByteArrayInputStream(responseEntity.getBody());
|
splitFileIs = new ByteArrayInputStream(responseEntity.getBody());
|
||||||
}catch (Exception ex){
|
}catch (Exception ex){
|
||||||
|
|||||||
Reference in New Issue
Block a user