From 2d749372176795db62e1b3694f69c2d3ad2f4e93 Mon Sep 17 00:00:00 2001 From: parkrootseok Date: Wed, 10 May 2023 16:18:30 +0900 Subject: [PATCH] =?UTF-8?q?[Chore]=20#268=20-=20Coordinate=20DTO=20?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EB=B0=8D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...dinateVO.java => ExtKakaoCoordinateOutDTO.java} | 3 ++- .../coordinate/{dto => entity}/Documents.java | 2 +- .../coordinate/service/CoordinateService.java | 14 +++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) rename src/main/java/shop/cazait/domain/coordinate/dto/{CoordinateVO.java => ExtKakaoCoordinateOutDTO.java} (71%) rename src/main/java/shop/cazait/domain/coordinate/{dto => entity}/Documents.java (91%) diff --git a/src/main/java/shop/cazait/domain/coordinate/dto/CoordinateVO.java b/src/main/java/shop/cazait/domain/coordinate/dto/ExtKakaoCoordinateOutDTO.java similarity index 71% rename from src/main/java/shop/cazait/domain/coordinate/dto/CoordinateVO.java rename to src/main/java/shop/cazait/domain/coordinate/dto/ExtKakaoCoordinateOutDTO.java index 1637347c..2bdfc28d 100644 --- a/src/main/java/shop/cazait/domain/coordinate/dto/CoordinateVO.java +++ b/src/main/java/shop/cazait/domain/coordinate/dto/ExtKakaoCoordinateOutDTO.java @@ -4,10 +4,11 @@ import java.util.List; import lombok.Data; import lombok.NoArgsConstructor; +import shop.cazait.domain.coordinate.entity.Documents; @Data @NoArgsConstructor -public class CoordinateVO { +public class ExtKakaoCoordinateOutDTO { private List documents = new ArrayList<>(); diff --git a/src/main/java/shop/cazait/domain/coordinate/dto/Documents.java b/src/main/java/shop/cazait/domain/coordinate/entity/Documents.java similarity index 91% rename from src/main/java/shop/cazait/domain/coordinate/dto/Documents.java rename to src/main/java/shop/cazait/domain/coordinate/entity/Documents.java index f88438ef..ab38e808 100644 --- a/src/main/java/shop/cazait/domain/coordinate/dto/Documents.java +++ b/src/main/java/shop/cazait/domain/coordinate/entity/Documents.java @@ -1,4 +1,4 @@ -package shop.cazait.domain.coordinate.dto; +package shop.cazait.domain.coordinate.entity; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.PropertyNamingStrategies; diff --git a/src/main/java/shop/cazait/domain/coordinate/service/CoordinateService.java b/src/main/java/shop/cazait/domain/coordinate/service/CoordinateService.java index 079faa51..710e9c69 100644 --- a/src/main/java/shop/cazait/domain/coordinate/service/CoordinateService.java +++ b/src/main/java/shop/cazait/domain/coordinate/service/CoordinateService.java @@ -7,7 +7,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.client.WebClient; -import shop.cazait.domain.coordinate.dto.CoordinateVO; +import shop.cazait.domain.coordinate.dto.ExtKakaoCoordinateOutDTO; import shop.cazait.domain.cafe.dto.PostCafeReq; import shop.cazait.domain.coordinate.entity.Coordinate; @@ -20,15 +20,15 @@ public class CoordinateService { private String uri = "/v2/local/search/address.json"; public Coordinate getCoordinate(PostCafeReq cafeReq) throws JsonProcessingException { - CoordinateVO coordinateVO = getCoordinateFromAddress(cafeReq.getAddress()); + ExtKakaoCoordinateOutDTO extKakaoCoordinateOutDTO = getCoordinateFromAddress(cafeReq.getAddress()); Coordinate coordinate = Coordinate.builder() - .longitude(coordinateVO.getDocuments().get(0).getLongitude()) - .latitude(coordinateVO.getDocuments().get(0).getLatitude()) + .longitude(extKakaoCoordinateOutDTO.getDocuments().get(0).getLongitude()) + .latitude(extKakaoCoordinateOutDTO.getDocuments().get(0).getLatitude()) .build(); return coordinate; } - private CoordinateVO getCoordinateFromAddress(String address) throws JsonProcessingException { + private ExtKakaoCoordinateOutDTO getCoordinateFromAddress(String address) throws JsonProcessingException { ObjectMapper mapper = new ObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); @@ -46,8 +46,8 @@ private CoordinateVO getCoordinateFromAddress(String address) throws JsonProcess return response.bodyToMono(String.class); }).block(); - CoordinateVO coordinateVO = mapper.readValue(jsonString, CoordinateVO.class); - return coordinateVO; + ExtKakaoCoordinateOutDTO extKakaoCoordinateOutDTO = mapper.readValue(jsonString, ExtKakaoCoordinateOutDTO.class); + return extKakaoCoordinateOutDTO; } }