Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

[Fix] TourAPI 내 식별자 부재에 대한 처리 로직 추가 #216

Merged
merged 3 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public record PlaceInfo(
String phone,
Integer areaCode,
Integer sigunguCode,
Integer zipCode,
String zipCode,
Double latitude,
Double longitude
) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/fc/be/app/domain/place/Location.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class Location {
private Integer sigunguCode;

@Comment("우편번호")
private Integer zipCode;
private String zipCode;

@Comment("위도")
private Double latitude;
Expand All @@ -35,7 +35,7 @@ public class Location {
private Double longitude;

@Builder
public Location(String address, String addressDetail, String phone, Integer areaCode, Integer sigunguCode, Integer zipCode, Double latitude, Double longitude) {
public Location(String address, String addressDetail, String phone, Integer areaCode, Integer sigunguCode, String zipCode, Double latitude, Double longitude) {
this.address = address;
this.addressDetail = addressDetail;
this.phone = phone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public ContentTypeId deserialize(JsonParser p, DeserializationContext ctxt) thro
AccommodationDTO.class, Accommodation.class,
FacilityDTO.class, Facility.class,
FestivalDTO.class, Festival.class,
LeportsDTO.class, Festival.class,
LeportsDTO.class, Leports.class,
RestaurantDTO.class, Restaurant.class,
ShopDTO.class, Shop.class,
SpotDTO.class, Spot.class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ default Place restaurant() {
.phone("")
.areaCode(1)
.sigunguCode(18)
.zipCode(5838)
.zipCode("5838")
.latitude(37.4776672007)
.longitude(127.1249768726)
.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public PlaceDTO generate(AreaBasedSyncList1Response.Item item) {
.phone(item.tel())
.areaCode(Integer.parseInt(item.areacode()))
.sigunguCode(Integer.parseInt(item.sigungucode()))
.zipCode(Integer.parseInt(item.zipcode()))
.zipCode(item.zipcode())
.latitude(Double.parseDouble(item.mapy()))
.longitude(Double.parseDouble(item.mapx()))
.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public PlaceDTO generate(DetailCommon1Response.Item item) {
.phone(item.tel())
.areaCode(Integer.parseInt(item.areacode()))
.sigunguCode(Integer.parseInt(item.sigungucode()))
.zipCode(Integer.parseInt(item.zipcode()))
.zipCode(item.zipcode())
.latitude(Double.parseDouble(item.mapy()))
.longitude(Double.parseDouble(item.mapx()))
.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class LocationDTO {
private String phone;
private Integer areaCode;
private Integer sigunguCode;
private Integer zipCode;
private String zipCode;
private Double latitude;
private Double longitude;
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ public List<PlaceDTO> fromAreaBasedSyncList(
List<PlaceDTO> result = new ArrayList<>();

for (var item : items) {
if (checkIdentifierCodesInvalid(item.contentid(), item.contenttypeid(), item.areacode(), item.sigungucode())) {
continue;
}

int itemContentTypeId = contentTypeId == 0 ? Integer.parseInt(item.contenttypeid()) : contentTypeId;
var itemClass = convertPlaceToChildDomain(itemContentTypeId);
result.add(generateAndCastItem(item, areaBasedSyncMapper::generate, itemClass));
Expand Down Expand Up @@ -106,6 +110,10 @@ public List<PlaceDTO> fromSearchKeywordList(
List<PlaceDTO> result = new ArrayList<>();

for (var item : items) {
if (checkIdentifierCodesInvalid(item.contentid(), item.contenttypeid(), item.areacode(), item.sigungucode())) {
continue;
}

int itemContentTypeId = contentTypeId == 0 ? Integer.parseInt(item.contenttypeid()) : contentTypeId;
if (ContentTypeId.contains(itemContentTypeId)) {
var itemClass = convertPlaceToChildDomain(itemContentTypeId);
Expand All @@ -129,5 +137,14 @@ private <T, U> T generateAndCastItem(U item, Function<U, PlaceDTO> generator, Cl
}
}

private boolean checkIdentifierCodesInvalid(String... values) {
for (var value : values) {
if (value == null || value.isBlank()) {
return true;
}
}

return false;
}

}
Loading