对接比亚迪-下载比亚迪的文件接口,传参方式修按照他们的接口,改成URL传参。

This commit is contained in:
wangzhijiang
2024-03-29 17:54:39 +08:00
parent 264f98bf05
commit 91a570f21a
@@ -61,6 +61,7 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import org.springframework.core.io.Resource;
import org.springframework.web.util.UriComponentsBuilder;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -235,7 +236,12 @@ public class FileSpiltService {
HttpEntity<Map<String, String>> requestEntity = new HttpEntity<>(params, headers);
// 发送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());
}catch (Exception ex){