From d9691d52c9edc75002acf9538fc9da19359ce2cd Mon Sep 17 00:00:00 2001 From: mmihye Date: Tue, 11 Jun 2024 13:25:11 +0900 Subject: [PATCH] =?UTF-8?q?[#70]=20feat=20:=20=EA=B2=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EB=B2=84=EC=A0=84=20=EA=B4=80=EA=B4=91=EC=A7=80=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=EB=B3=B4=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../place/controller/PlaceController.java | 5 +++ .../dto/response/PlaceDetailGuestRes.java | 34 +++++++++++++++++++ .../domain/place/service/PlaceService.java | 13 +++++++ .../global/config/SecurityConfig.java | 1 + 4 files changed, 53 insertions(+) create mode 100644 src/main/java/Journey/Together/domain/place/dto/response/PlaceDetailGuestRes.java diff --git a/src/main/java/Journey/Together/domain/place/controller/PlaceController.java b/src/main/java/Journey/Together/domain/place/controller/PlaceController.java index 51bca4a..14f7fa6 100644 --- a/src/main/java/Journey/Together/domain/place/controller/PlaceController.java +++ b/src/main/java/Journey/Together/domain/place/controller/PlaceController.java @@ -44,6 +44,11 @@ public ApiResponse getPlaceDetail(@AuthenticationPrincipal Princ return ApiResponse.success(Success.GET_PLACE_DETAIL_SUCCESS, placeService.getPlaceDetail(principalDetails.getMember(), placeId)); } + @GetMapping("guest/{placeId}") + public ApiResponse getPlaceDetail(@PathVariable Long placeId){ + return ApiResponse.success(Success.GET_PLACE_DETAIL_SUCCESS, placeService.getGeustPlaceDetail(placeId)); + } + @PostMapping("/review/{placeId}") public ApiResponse createReivew(@AuthenticationPrincipal PrincipalDetails principalDetails, @RequestPart(required = false) List images, diff --git a/src/main/java/Journey/Together/domain/place/dto/response/PlaceDetailGuestRes.java b/src/main/java/Journey/Together/domain/place/dto/response/PlaceDetailGuestRes.java new file mode 100644 index 0000000..929d363 --- /dev/null +++ b/src/main/java/Journey/Together/domain/place/dto/response/PlaceDetailGuestRes.java @@ -0,0 +1,34 @@ +package Journey.Together.domain.place.dto.response; + +import Journey.Together.domain.place.entity.Place; + +import java.util.List; + +public record PlaceDetailGuestRes( + Long placeId, + String name, + String imgae, + String address, + String category, + String overview, + String mapX, + String mapY, + + Integer bookmarkNum, + + List disability, + List subDisability, + List reviewList +) { + static String cat = "관광지"; + public static PlaceDetailGuestRes of(Place place, Integer bookmarkNum, List disability, List subDisability, List reviewList){ + if(place.getCategory().equals("B02")) + cat = "숙소"; + else if (place.getCategory().equals("A05")) + cat = "맛집"; + + + return new PlaceDetailGuestRes(place.getId(), place.getName(), place.getFirstImg(), place.getAddress(), cat, place.getOverview(), place.getMapX().toString(), place.getMapY().toString(), + bookmarkNum, disability, subDisability, reviewList); + } +} diff --git a/src/main/java/Journey/Together/domain/place/service/PlaceService.java b/src/main/java/Journey/Together/domain/place/service/PlaceService.java index e79242d..23b1ea6 100644 --- a/src/main/java/Journey/Together/domain/place/service/PlaceService.java +++ b/src/main/java/Journey/Together/domain/place/service/PlaceService.java @@ -81,6 +81,19 @@ public PlaceDetailRes getPlaceDetail(Member member, Long placeId){ } + public PlaceDetailGuestRes getGeustPlaceDetail(Long placeId){ + // PlaceDetailRes of(Place place, Boolean isMark, Integer bookmarkNum, List disability, List subDisability, List< PlaceReviewDto > reviewList) + + Place place = getPlace(placeId); + + List placeBookmarkList = placeBookmarkRepository.findAllByPlace(place); + List disability = disabilityPlaceCategoryRepository.findDisabilityCategoryIds(placeId); + List subDisability = disabilityPlaceCategoryRepository.findDisabilitySubCategoryNames(placeId); + + return PlaceDetailGuestRes.of(place, placeBookmarkList.size(), disability, subDisability, null); + + } + public SearchPlaceRes searchPlaceList(String category, String query, List disabilityType, List detailFilter, String areacode, String sigungucode, String arrange, Pageable pageable, Double minX, Double maxX, Double minY, Double maxY){ List placeResList =new ArrayList<>(); diff --git a/src/main/java/Journey/Together/global/config/SecurityConfig.java b/src/main/java/Journey/Together/global/config/SecurityConfig.java index 152a2f6..c359cda 100644 --- a/src/main/java/Journey/Together/global/config/SecurityConfig.java +++ b/src/main/java/Journey/Together/global/config/SecurityConfig.java @@ -65,6 +65,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .requestMatchers("v1/place/review/{placeReviewId}").permitAll() .requestMatchers("/v1/plan/guest/**").permitAll() .requestMatchers("/v1/place/search").permitAll() + .requestMatchers("/v1/place/guest/**").permitAll() // 메인 페이지, 공고 페이지 등에 한해 인증 정보 없이 접근 가능 (추후 추가) // 이외의 모든 요청은 인증 정보 필요 .anyRequest().authenticated());