diff --git a/src/main/java/team7/inplace/place/application/PlaceService.java b/src/main/java/team7/inplace/place/application/PlaceService.java index 2222c4f8..022a1554 100644 --- a/src/main/java/team7/inplace/place/application/PlaceService.java +++ b/src/main/java/team7/inplace/place/application/PlaceService.java @@ -1,5 +1,11 @@ package team7.inplace.place.application; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; @@ -22,15 +28,13 @@ import team7.inplace.place.domain.Place; import team7.inplace.place.persistence.PlaceRepository; import team7.inplace.placeMessage.application.command.PlaceMessageCommand; +import team7.inplace.review.persistence.ReviewRepository; import team7.inplace.security.util.AuthorizationUtil; import team7.inplace.user.domain.User; import team7.inplace.user.persistence.UserRepository; import team7.inplace.video.domain.Video; import team7.inplace.video.persistence.VideoRepository; -import java.util.*; -import java.util.stream.Collectors; - @Service @RequiredArgsConstructor public class PlaceService { @@ -43,22 +47,24 @@ public class PlaceService { private final LikedPlaceRepository likedPlaceRepository; + private final ReviewRepository reviewRepository; + public Page getPlacesWithinRadius( - PlacesCoordinateCommand placesCoordinateCommand, - PlacesFilterParamsCommand placesFilterParamsCommand) { + PlacesCoordinateCommand placesCoordinateCommand, + PlacesFilterParamsCommand placesFilterParamsCommand) { // categories와 influencers 필터 처리 List categoryFilters = placesFilterParamsCommand.isCategoryFilterExists() - ? Arrays.stream(placesFilterParamsCommand.categories().split(",")).toList() - : null; + ? Arrays.stream(placesFilterParamsCommand.categories().split(",")).toList() + : null; List influencerFilters = placesFilterParamsCommand.isInfluencerFilterExists() - ? Arrays.stream(placesFilterParamsCommand.influencers().split(",")).toList() - : null; + ? Arrays.stream(placesFilterParamsCommand.influencers().split(",")).toList() + : null; // 주어진 좌표로 장소를 찾고, 해당 페이지의 결과를 가져옵니다. Page placesPage = getPlacesByDistance(placesCoordinateCommand, categoryFilters, - influencerFilters); + influencerFilters); // Place ID 목록 추출 List placeIds = getPlaceIds(placesPage); @@ -66,7 +72,7 @@ public Page getPlacesWithinRadius( // influencer 조회 => video->Map(placeId, influencerName) List