diff --git a/src/main/java/umc/catchy/domain/mapping/memberCourse/dao/MemberCourseRepositoryImpl.java b/src/main/java/umc/catchy/domain/mapping/memberCourse/dao/MemberCourseRepositoryImpl.java index 8728444f..48aacb13 100644 --- a/src/main/java/umc/catchy/domain/mapping/memberCourse/dao/MemberCourseRepositoryImpl.java +++ b/src/main/java/umc/catchy/domain/mapping/memberCourse/dao/MemberCourseRepositoryImpl.java @@ -10,6 +10,7 @@ import umc.catchy.domain.category.domain.BigCategory; import umc.catchy.domain.course.domain.CourseType; +import umc.catchy.domain.course.util.LocationUtils; import umc.catchy.domain.mapping.memberCourse.dto.response.MemberCourseResponse; @@ -67,7 +68,7 @@ public Slice findCourseByBookmarks(Long memberId, int page @Override public Slice findCourseByFilters(CourseType courseType, String upperLocation, String lowerLocation, Long memberId, Long lastCourseId) { - List results = queryFactory.select(Projections.constructor(MemberCourseResponse.class, + List results = queryFactory.selectDistinct(Projections.constructor(MemberCourseResponse.class, course.id, course.courseType, course.courseImage, @@ -76,6 +77,8 @@ public Slice findCourseByFilters(CourseType courseType, St .from(memberCourse) .leftJoin(memberCourse.course,course).on(memberCourse.course.id.eq(course.id)) .leftJoin(memberCourse.member,member).on(memberCourse.member.id.eq(member.id)) + .leftJoin(placeCourse).on(course.id.eq(placeCourse.course.id)) + .leftJoin(place).on(placeCourse.place.id.eq(place.id)) .where( memberCourse.member.id.eq(memberId), course.courseType.eq(courseType), @@ -126,7 +129,7 @@ private BooleanExpression upperLocationFilter(String upperLocation) { if ("all".equals(upperLocation)) { return null; } - return place.roadAddress.startsWith(upperLocation + " "); + return place.roadAddress.startsWith(LocationUtils.normalizeLocation(upperLocation) + " "); } private BooleanExpression lowerLocationFilter(String lowerLocation) { diff --git a/src/main/java/umc/catchy/domain/mapping/placeCourse/dto/response/PlaceInfoDetail.java b/src/main/java/umc/catchy/domain/mapping/placeCourse/dto/response/PlaceInfoDetail.java index 973d7898..2863b9a7 100644 --- a/src/main/java/umc/catchy/domain/mapping/placeCourse/dto/response/PlaceInfoDetail.java +++ b/src/main/java/umc/catchy/domain/mapping/placeCourse/dto/response/PlaceInfoDetail.java @@ -20,6 +20,6 @@ public class PlaceInfoDetail { private Long reviewCount; private Double placeLatitude; private Double placeLongitude; - private boolean visited; + private boolean isVisited; private boolean liked; } diff --git a/src/main/java/umc/catchy/domain/mapping/placeCourse/service/PlaceCourseService.java b/src/main/java/umc/catchy/domain/mapping/placeCourse/service/PlaceCourseService.java index 8b67546b..dd757e97 100644 --- a/src/main/java/umc/catchy/domain/mapping/placeCourse/service/PlaceCourseService.java +++ b/src/main/java/umc/catchy/domain/mapping/placeCourse/service/PlaceCourseService.java @@ -366,6 +366,8 @@ private String parsePlaceImageFromJson(String response) throws Exception { } } + if (photoReference.isBlank()) return null; + // photo_reference로 photo_url 받아오기 String query = String.format( "photo?maxwidth=400&photoreference=%s&key=GOOGLE_API_KEY", diff --git a/src/main/java/umc/catchy/domain/place/converter/PlaceConverter.java b/src/main/java/umc/catchy/domain/place/converter/PlaceConverter.java index cfbe92b2..cf147704 100644 --- a/src/main/java/umc/catchy/domain/place/converter/PlaceConverter.java +++ b/src/main/java/umc/catchy/domain/place/converter/PlaceConverter.java @@ -8,6 +8,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import umc.catchy.domain.category.domain.BigCategory; import umc.catchy.domain.course.dto.response.CourseInfoResponse; import umc.catchy.domain.mapping.placeCourse.dto.response.PlaceInfoDetail; import umc.catchy.domain.mapping.placeCourse.dto.response.PlaceInfoPreview; @@ -55,22 +56,27 @@ public static PlaceInfoPreview toPlaceInfoPreview(Place place, Long reviewCount, } public static PlaceInfoDetail toPlaceInfoDetail (Place place, Long reviewCount, Boolean isVisited, Boolean isLiked) { - String categoryName = null; + BigCategory categoryName = null; Double rating = 0.0; if (place.getCategory() != null) { - categoryName = place.getCategory().getName(); + categoryName = place.getCategory().getBigCategory(); } if (place.getRating() != null) { rating = place.getRating(); } + String category; + + if (categoryName == null) category = null; + else category = categoryName.toString(); + return PlaceInfoDetail.builder() .placeId(place.getId()) .imageUrl(place.getImageUrl()) .placeName(place.getPlaceName()) - .categoryName(categoryName) + .categoryName(category) .roadAddress(place.getRoadAddress()) .activeTime(place.getActiveTime()) .placeSite(place.getPlaceSite()) @@ -78,7 +84,7 @@ public static PlaceInfoDetail toPlaceInfoDetail (Place place, Long reviewCount, .reviewCount(reviewCount) .placeLatitude(place.getLatitude()) .placeLongitude(place.getLongitude()) - .visited(isVisited) + .isVisited(isVisited) .liked(isLiked) .build(); } diff --git a/src/main/java/umc/catchy/domain/place/domain/Place.java b/src/main/java/umc/catchy/domain/place/domain/Place.java index f703406f..1eb57c90 100644 --- a/src/main/java/umc/catchy/domain/place/domain/Place.java +++ b/src/main/java/umc/catchy/domain/place/domain/Place.java @@ -51,7 +51,7 @@ public class Place extends BaseTimeEntity { private Double rating; // 장소 총 평점 : 처음에 0으로 초기화해주세요 @Setter - @ManyToOne(fetch = FetchType.LAZY) + @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "category_id") private Category category;