Skip to content
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 @@ -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;


Expand Down Expand Up @@ -67,7 +68,7 @@ public Slice<MemberCourseResponse> findCourseByBookmarks(Long memberId, int page
@Override
public Slice<MemberCourseResponse> findCourseByFilters(CourseType courseType, String upperLocation,
String lowerLocation, Long memberId, Long lastCourseId) {
List<MemberCourseResponse> results = queryFactory.select(Projections.constructor(MemberCourseResponse.class,
List<MemberCourseResponse> results = queryFactory.selectDistinct(Projections.constructor(MemberCourseResponse.class,
course.id,
course.courseType,
course.courseImage,
Expand All @@ -76,6 +77,8 @@ public Slice<MemberCourseResponse> 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),
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -55,30 +56,35 @@ 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())
.rating(rating)
.reviewCount(reviewCount)
.placeLatitude(place.getLatitude())
.placeLongitude(place.getLongitude())
.visited(isVisited)
.isVisited(isVisited)
.liked(isLiked)
.build();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/umc/catchy/domain/place/domain/Place.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down