|
@@ -13,8 +13,6 @@ import org.springframework.http.HttpMethod;
|
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
-import org.springframework.util.LinkedMultiValueMap;
|
|
|
|
|
-import org.springframework.util.MultiValueMap;
|
|
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -55,21 +53,17 @@ public class SafetyKoreaApi {
|
|
|
* @since 2020. 12. 1
|
|
* @since 2020. 12. 1
|
|
|
*/
|
|
*/
|
|
|
public String getKoreaCertifyNo(String goodsCd) throws Exception {
|
|
public String getKoreaCertifyNo(String goodsCd) throws Exception {
|
|
|
- // Parameter
|
|
|
|
|
- MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
|
|
|
|
|
- params.add("conditionKey", "all");
|
|
|
|
|
- params.add("conditionValue", goodsCd);
|
|
|
|
|
- log.info("params: {}", params);
|
|
|
|
|
-
|
|
|
|
|
// Header
|
|
// Header
|
|
|
HttpHeaders headers = new HttpHeaders();
|
|
HttpHeaders headers = new HttpHeaders();
|
|
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
|
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
|
|
headers.add("AuthKey", authKey);
|
|
headers.add("AuthKey", authKey);
|
|
|
|
|
|
|
|
- URI url = URI.create(apiUrl);
|
|
|
|
|
|
|
+ String requestUrl = apiUrl + "?conditionKey=all&conditionValue=" + goodsCd;
|
|
|
|
|
+ log.info("requestUrl: {}", requestUrl);
|
|
|
|
|
+ URI url = URI.create(requestUrl);
|
|
|
|
|
|
|
|
// GET방식으로 호출
|
|
// GET방식으로 호출
|
|
|
- HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<MultiValueMap<String, String>>(params, headers);
|
|
|
|
|
|
|
+ HttpEntity<String> request = new HttpEntity<String>(headers);
|
|
|
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, String.class);
|
|
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, String.class);
|
|
|
log.info("responseEntity.getStatusCode(): {} ", responseEntity.getStatusCode());
|
|
log.info("responseEntity.getStatusCode(): {} ", responseEntity.getStatusCode());
|
|
|
|
|
|