|
|
|
|
@ -1,11 +1,11 @@
|
|
|
|
|
package com.mfsys.aconnect.client.service;
|
|
|
|
|
|
|
|
|
|
import com.mfsys.aconnect.configuration.config.WebClientConfig;
|
|
|
|
|
import org.springframework.util.*;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.core.ParameterizedTypeReference;
|
|
|
|
|
import org.springframework.http.*;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
@ -19,10 +19,9 @@ public class UploadDocumentService {
|
|
|
|
|
@Value("${app.crm.uri}")
|
|
|
|
|
private String crmURI;
|
|
|
|
|
|
|
|
|
|
private final RestTemplate restTemplate;
|
|
|
|
|
|
|
|
|
|
public UploadDocumentService(RestTemplate restTemplate){
|
|
|
|
|
this.restTemplate = restTemplate;
|
|
|
|
|
private final WebClientConfig webClientConfig;
|
|
|
|
|
public UploadDocumentService(WebClientConfig webClientConfig){
|
|
|
|
|
this.webClientConfig = webClientConfig;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ResponseEntity<Map<String, String>> depositCacheFiles(
|
|
|
|
|
@ -44,12 +43,10 @@ public class UploadDocumentService {
|
|
|
|
|
body.add("file", file.getResource());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers);
|
|
|
|
|
|
|
|
|
|
return restTemplate.exchange(
|
|
|
|
|
return webClientConfig.postMultipart(
|
|
|
|
|
url,
|
|
|
|
|
HttpMethod.POST,
|
|
|
|
|
requestEntity,
|
|
|
|
|
body,
|
|
|
|
|
headers,
|
|
|
|
|
new ParameterizedTypeReference<Map<String, String>>() {}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
@ -73,12 +70,10 @@ public class UploadDocumentService {
|
|
|
|
|
body.add("file", file.getResource());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers);
|
|
|
|
|
|
|
|
|
|
return restTemplate.exchange(
|
|
|
|
|
return webClientConfig.postMultipart(
|
|
|
|
|
url,
|
|
|
|
|
HttpMethod.POST,
|
|
|
|
|
requestEntity,
|
|
|
|
|
body,
|
|
|
|
|
headers,
|
|
|
|
|
new ParameterizedTypeReference<Map<String, String>>() {}
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|