From c5de02328e4b365a56d2500ac297d96614d68c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=9E=AC=ED=98=81?= Date: Sun, 24 Nov 2024 05:29:33 +0900 Subject: [PATCH] fix: don't conflict plz (#146) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat : updatedAt 추가 * fix:conflict (#144) * feat: 장바구니 추가 기능 구현 * feat: 장바구니 조회 기능 구현 * feat: 상품 주문과 식권 사용 기능 구현 * style: 포인트트랜잭션 레포지토리명 변경 * deploy: 재배포 * deploy: 재배포2 * deploy: 로그인 로직 수정에 따른 재배포 * deploy: 로그인 로직 수정에 따른 재배포2 * feat: 식권 사용 기능 구현 * feat: yml 수정 사항 반영 * feat: 식권 사용 로직 수정 * feat: 주문 로직 수정 완료 * fix: 장바구니에 아무것도 없을 때 주문 시 active 되는 현상 수정 * feat: 주문 완료 시 리턴 값 수정 * feat: 내 그룹 조회 기능 구현 * feat: 기본 프로필 이미지 url 추가 * feat: 그룹 멤버 전체 조회 기능 구현 * feat: 1인당 사용 가능 금액 설정 컬럼 추가 * feat: 내 지갑 조회 기능 구현 * feat: 선결제 기능 구현 * feat: 유저 홈 화면 조회 기능 구현 * feat: 그룹 상세 조회 기능 구현 * feat: 가게 상세 조회 쿼리 수정 * deploy: 변경사항 반영을 위한 커밋 * deploy: 수정 사항 반영 재배포 * deploy: rds 교체로 인한 재배포 * deploy: rds 교체로 인한 재배포2 * feat: 홈 화면 소속팀 조회 쿼리 제대로 안되던 현상 해결, 대표이미지 반환 추가 * feat: 그룹 상세 조회 응답 컬럼명 변경 * feat: memberLimit 컬럼 삭제 * feat: 선결제 시 기존 결제 내역과 멱등성 문제 해결 * fix: 팀 상세 조회 시 이미지 쿼리가 의미 없이 join 되던 쿼리 수정 * feat: 가게 검색 기능 대폭 수정 * feat: 프론트 요구사 반영 * feat: searchcondition 삭제 * feat: 팀타입 desription 리턴 하도록 수정 * feat: 카테고리별 팀 조회 시 팀 생성일 컬럼 추가 * feat: 매장찾기_상세 페이지 조회 기능 구현 * feat: 비밀 코드 조회 기능 엔드 포인트 수정 * fix: conflict fix --------- Co-authored-by: HyunWoo9930 Co-authored-by: Oh Hyun Woo --- .../store/controller/StoreController.java | 215 +++++++++--------- .../store/domain/StoreTeamResponseDTO.java | 18 +- .../domain/store/dto/StoreTeamResponse.java | 57 +++-- .../domain/store/service/StoreService.java | 16 +- 4 files changed, 150 insertions(+), 156 deletions(-) diff --git a/src/main/java/com/jangburich/domain/store/controller/StoreController.java b/src/main/java/com/jangburich/domain/store/controller/StoreController.java index 65fa5ab..b674d94 100644 --- a/src/main/java/com/jangburich/domain/store/controller/StoreController.java +++ b/src/main/java/com/jangburich/domain/store/controller/StoreController.java @@ -1,5 +1,6 @@ package com.jangburich.domain.store.controller; +import com.jangburich.domain.store.dto.response.StoreSearchDetailsResponse; import java.util.List; import org.springframework.data.domain.Page; @@ -20,14 +21,13 @@ import com.jangburich.domain.store.domain.Category; import com.jangburich.domain.store.domain.StoreCreateRequestDTO; import com.jangburich.domain.store.domain.StoreGetResponseDTO; +import com.jangburich.domain.store.domain.StoreTeamResponseDTO; import com.jangburich.domain.store.domain.StoreUpdateRequestDTO; -import com.jangburich.domain.store.dto.StoreTeamResponse; import com.jangburich.domain.store.dto.response.OrdersDetailResponse; import com.jangburich.domain.store.dto.response.OrdersGetResponse; import com.jangburich.domain.store.dto.response.OrdersTodayResponse; import com.jangburich.domain.store.dto.response.PaymentGroupDetailResponse; import com.jangburich.domain.store.dto.response.SearchStoresResponse; -import com.jangburich.domain.store.dto.response.StoreSearchDetailsResponse; import com.jangburich.domain.store.service.StoreService; import com.jangburich.global.payload.Message; import com.jangburich.global.payload.ResponseCustom; @@ -44,110 +44,109 @@ @RequestMapping("/store") public class StoreController { - private final StoreService storeService; - - @Operation(summary = "카테고리 별 가게 목록 조회", description = "카테고리 별로 가게 목록을 조회합니다.") - @PostMapping("/category") - public ResponseCustom> searchByCategory( - Authentication authentication, - @RequestParam(required = false, defaultValue = "3") Integer searchRadius, - @RequestParam(required = false, defaultValue = "ALL") Category category, - Double lat, - Double lon, Pageable pageable) { - return ResponseCustom.OK( - storeService.searchByCategory(AuthenticationParser.parseUserId(authentication), searchRadius, category, lat, - lon, - pageable)); - } - - @Operation(summary = "매장 찾기(검색)", description = "검색어와 매장 유형에 맞는 매장을 검색합니다.") - @GetMapping("/search") - public ResponseCustom> searchStores( - Authentication authentication, - @RequestParam(required = false, defaultValue = "") String keyword, Pageable pageable) { - return ResponseCustom.OK( - storeService.searchStores(AuthenticationParser.parseUserId(authentication), keyword, pageable)); - } - - @Operation(summary = "매장 찾기 상세 페이지 조회", description = "매장을 상세 조회합니다.") - @GetMapping("/{storeId}") - public ResponseCustom storeSearchDetails( - Authentication authentication, - @PathVariable Long storeId - ) { - System.out.println("authentication = " + authentication); - return ResponseCustom.OK( - storeService.storeSearchDetails(AuthenticationParser.parseUserId(authentication), storeId)); - } - - @Operation(summary = "가게 등록", description = "신규 파트너 가게를 등록합니다.") - @PostMapping(value = "/create", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - public ResponseCustom createStore( - Authentication authentication, - @Parameter(name = "image", description = "업로드 사진 데이터") @RequestPart(value = "image") MultipartFile image, - @RequestPart(value = "store") StoreCreateRequestDTO storeCreateRequestDTO, - @RequestPart(value = "menuImages", required = false) List menuImages) { - - storeService.createStore(AuthenticationParser.parseUserId(authentication), storeCreateRequestDTO, image, - menuImages); - return ResponseCustom.OK(Message.builder().message("success").build()); - } - - @Operation(summary = "가게 정보 수정", description = "가게 정보를 수정합니다.") - @PatchMapping("/update") - public ResponseCustom updateStore(Authentication authentication, - @RequestBody StoreUpdateRequestDTO storeUpdateRequestDTO) { - storeService.updateStore(AuthenticationParser.parseUserId(authentication), storeUpdateRequestDTO); - return ResponseCustom.OK(Message.builder().message("success").build()); - } - - @Operation(summary = "가게 정보 조회", description = "가게 상세 정보를 조회합니다.") - @GetMapping("") - public ResponseCustom getStoreInfo(Authentication authentication) { - return ResponseCustom.OK(storeService.getStoreInfo(AuthenticationParser.parseUserId(authentication))); - } - - @Operation(summary = "결제 그룹 조회", description = "장부 결제 그룹을 조회합니다.") - @GetMapping("/payment_group") - public ResponseCustom> getPaymentGroup(Authentication authentication) { - return ResponseCustom.OK( - storeService.getPaymentGroup(AuthenticationParser.parseUserId(authentication))); - } - - @Operation(summary = "결제 그룹 상세 조회", description = "장부 결제 그룹을 상세 조회합니다.") - @GetMapping("/payment_group/{teamId}") - public ResponseCustom getPaymentGroupDetail(Authentication authentication, - @PathVariable Long teamId) { - return ResponseCustom.OK( - storeService.getPaymentGroupDetail(AuthenticationParser.parseUserId(authentication), teamId)); - } - - @Operation(summary = "결제 내역 조회", description = "가게에서 일어난 결제 내역을 조회합니다.") - @GetMapping("/payment_history") - public ResponseCustom getPaymentHistory(Authentication authentication) { - return ResponseCustom.OK( - storeService.getPaymentHistory(AuthenticationParser.parseUserId(authentication))); - } - - @Operation(summary = "지난 주문 조회", description = "가게에 있는 지난 주문을 조회합니다") - @GetMapping("/orders/last") - public ResponseCustom> getLastOrders(Authentication authentication) { - List ordersLast = storeService.getOrdersLast( - AuthenticationParser.parseUserId(authentication)); - return ResponseCustom.OK(ordersLast); - } - - @Operation(summary = "오늘 주문 조회", description = "가게에 있는 오늘 주문을 조회합니다") - @GetMapping("/orders/today") - public ResponseCustom getTodayOrders(Authentication authentication) { - return ResponseCustom.OK(storeService.getTodayOrders( - AuthenticationParser.parseUserId(authentication))); - } - - @Operation(summary = "주문 상세 조회", description = "가게에 있는 주문을 상세 조회합니다") - @GetMapping("/orders/{ordersId}") - public ResponseCustom getOrders(Authentication authentication, @RequestParam Long orderId) { - return ResponseCustom.OK( - storeService.getOrderDetails(AuthenticationParser.parseUserId(authentication), orderId)); - } + private final StoreService storeService; + + @Operation(summary = "카테고리 별 가게 목록 조회", description = "카테고리 별로 가게 목록을 조회합니다.") + @PostMapping("/category") + public ResponseCustom> searchByCategory( + Authentication authentication, + @RequestParam(required = false, defaultValue = "3") Integer searchRadius, + @RequestParam(required = false, defaultValue = "ALL") Category category, + Double lat, + Double lon, Pageable pageable) { + return ResponseCustom.OK( + storeService.searchByCategory(AuthenticationParser.parseUserId(authentication), searchRadius, category, lat, lon, + pageable)); + } + + @Operation(summary = "매장 찾기(검색)", description = "검색어와 매장 유형에 맞는 매장을 검색합니다.") + @GetMapping("/search") + public ResponseCustom> searchStores( + Authentication authentication, + @RequestParam(required = false, defaultValue = "") String keyword, Pageable pageable) { + return ResponseCustom.OK( + storeService.searchStores(AuthenticationParser.parseUserId(authentication), keyword, pageable)); + } + + @Operation(summary = "매장 찾기 상세 페이지 조회", description = "매장을 상세 조회합니다.") + @GetMapping("/{storeId}") + public ResponseCustom storeSearchDetails( + Authentication authentication, + @PathVariable Long storeId + ) { + System.out.println("authentication = " + authentication); + return ResponseCustom.OK(storeService.storeSearchDetails(AuthenticationParser.parseUserId(authentication), storeId)); + } + + @Operation(summary = "가게 등록", description = "신규 파트너 가게를 등록합니다.") + @PostMapping(value = "/create", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + public ResponseCustom createStore( + Authentication authentication, + @Parameter(name = "image", description = "업로드 사진 데이터") @RequestPart(value = "image") MultipartFile image, + @RequestPart(value = "store") StoreCreateRequestDTO storeCreateRequestDTO, + @RequestPart(value = "menuImages", required = false) List menuImages) { + + storeService.createStore(AuthenticationParser.parseUserId(authentication), storeCreateRequestDTO, image, + menuImages); + return ResponseCustom.OK(Message.builder().message("success").build()); + } + + + @Operation(summary = "가게 정보 수정", description = "가게 정보를 수정합니다.") + @PatchMapping("/update") + public ResponseCustom updateStore(Authentication authentication, + @RequestBody StoreUpdateRequestDTO storeUpdateRequestDTO) { + storeService.updateStore(AuthenticationParser.parseUserId(authentication), storeUpdateRequestDTO); + return ResponseCustom.OK(Message.builder().message("success").build()); + } + + @Operation(summary = "가게 정보 조회", description = "가게 상세 정보를 조회합니다.") + @GetMapping("") + public ResponseCustom getStoreInfo(Authentication authentication) { + return ResponseCustom.OK(storeService.getStoreInfo(AuthenticationParser.parseUserId(authentication))); + } + + @Operation(summary = "결제 그룹 조회", description = "장부 결제 그룹을 조회합니다.") + @GetMapping("/payment_group") + public ResponseCustom> getPaymentGroup(Authentication authentication) { + return ResponseCustom.OK( + storeService.getPaymentGroup(AuthenticationParser.parseUserId(authentication))); + } + + @Operation(summary = "결제 그룹 상세 조회", description = "장부 결제 그룹을 상세 조회합니다.") + @GetMapping("/payment_group/{teamId}") + public ResponseCustom getPaymentGroupDetail(Authentication authentication, + @PathVariable Long teamId) { + return ResponseCustom.OK( + storeService.getPaymentGroupDetail(AuthenticationParser.parseUserId(authentication), teamId)); + } + + @Operation(summary = "결제 내역 조회", description = "가게에서 일어난 결제 내역을 조회합니다.") + @GetMapping("/payment_history") + public ResponseCustom getPaymentHistory(Authentication authentication) { + return ResponseCustom.OK( + storeService.getPaymentHistory(AuthenticationParser.parseUserId(authentication))); + } + + @Operation(summary = "지난 주문 조회", description = "가게에 있는 지난 주문을 조회합니다") + @GetMapping("/orders/last") + public ResponseCustom> getLastOrders(Authentication authentication) { + List ordersLast = storeService.getOrdersLast( + AuthenticationParser.parseUserId(authentication)); + return ResponseCustom.OK(ordersLast); + } + + @Operation(summary = "오늘 주문 조회", description = "가게에 있는 오늘 주문을 조회합니다") + @GetMapping("/orders/today") + public ResponseCustom getTodayOrders(Authentication authentication) { + return ResponseCustom.OK(storeService.getTodayOrders( + AuthenticationParser.parseUserId(authentication))); + } + + @Operation(summary = "주문 상세 조회", description = "가게에 있는 주문을 상세 조회합니다") + @GetMapping("/orders/{ordersId}") + public ResponseCustom getOrders(Authentication authentication, @RequestParam Long orderId) { + return ResponseCustom.OK( + storeService.getOrderDetails(AuthenticationParser.parseUserId(authentication), orderId)); + } } \ No newline at end of file diff --git a/src/main/java/com/jangburich/domain/store/domain/StoreTeamResponseDTO.java b/src/main/java/com/jangburich/domain/store/domain/StoreTeamResponseDTO.java index 6318300..608908d 100644 --- a/src/main/java/com/jangburich/domain/store/domain/StoreTeamResponseDTO.java +++ b/src/main/java/com/jangburich/domain/store/domain/StoreTeamResponseDTO.java @@ -8,18 +8,18 @@ @Builder public record StoreTeamResponseDTO( - Long id, - Integer remainPoint, - Long teamId, - String teamName, - String teamDescription, - Long storeId, - LocalDateTime updatedAt + Long id, + Integer remainPoint, + Long teamId, + String teamName, + String teamDescription, + Long storeId, + LocalDateTime updatedAt ) { @QueryProjection public StoreTeamResponseDTO(Long id, Integer remainPoint, Long teamId, String teamName, String teamDescription, - Long storeId, LocalDateTime updatedAt) { + Long storeId, LocalDateTime updatedAt) { this.id = id; this.remainPoint = remainPoint; this.teamId = teamId; @@ -28,4 +28,4 @@ public StoreTeamResponseDTO(Long id, Integer remainPoint, Long teamId, String te this.storeId = storeId; this.updatedAt = updatedAt; } -} +} \ No newline at end of file diff --git a/src/main/java/com/jangburich/domain/store/dto/StoreTeamResponse.java b/src/main/java/com/jangburich/domain/store/dto/StoreTeamResponse.java index 0e553de..73267ba 100644 --- a/src/main/java/com/jangburich/domain/store/dto/StoreTeamResponse.java +++ b/src/main/java/com/jangburich/domain/store/dto/StoreTeamResponse.java @@ -4,36 +4,33 @@ import java.time.format.DateTimeFormatter; public class StoreTeamResponse { - Long id; - Integer remainPoint; - Long teamId; - String teamName; - String teamDescription; - Long storeId; - String period; + Long id; + Integer remainPoint; + Long teamId; + String teamName; + String teamDescription; + Long storeId; + String period; - public StoreTeamResponse(Long id, Integer remainPoint, Long teamId, String teamName, String teamDescription, - Long storeId, LocalDateTime period, long maxReservation) { - this.id = id; - this.remainPoint = remainPoint; - this.teamId = teamId; - this.teamName = teamName; - this.teamDescription = teamDescription; - this.storeId = storeId; - this.period = calculateDateRange(period, maxReservation); - } + public StoreTeamResponse(Long id, Integer remainPoint, Long teamId, String teamName, String teamDescription, + Long storeId, LocalDateTime period, long maxReservation) { + this.id = id; + this.remainPoint = remainPoint; + this.teamId = teamId; + this.teamName = teamName; + this.teamDescription = teamDescription; + this.storeId = storeId; + this.period = calculateDateRange(period, maxReservation); + } - private String calculateDateRange(LocalDateTime updatedAt, long maxReservation) { - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); - - // 시작 날짜 - String startDate = updatedAt.format(formatter); - - // 종료 날짜 - LocalDateTime endDateTime = updatedAt.plusDays(maxReservation); - String endDate = endDateTime.format(formatter); - - // 범위 문자열 생성 - return startDate + " ~ " + endDate; - } + private String calculateDateRange(LocalDateTime updatedAt, long maxReservation) { + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); + // 시작 날짜 + String startDate = updatedAt.format(formatter); + // 종료 날짜 + LocalDateTime endDateTime = updatedAt.plusDays(maxReservation); + String endDate = endDateTime.format(formatter); + // 범위 문자열 생성 + return startDate + " ~ " + endDate; + } } diff --git a/src/main/java/com/jangburich/domain/store/service/StoreService.java b/src/main/java/com/jangburich/domain/store/service/StoreService.java index 086a053..e65035d 100644 --- a/src/main/java/com/jangburich/domain/store/service/StoreService.java +++ b/src/main/java/com/jangburich/domain/store/service/StoreService.java @@ -1,5 +1,6 @@ package com.jangburich.domain.store.service; +import com.jangburich.domain.store.dto.StoreTeamResponse; import com.jangburich.domain.store.dto.response.StoreSearchDetailsResponse; import java.time.LocalDate; import java.time.LocalDateTime; @@ -34,7 +35,6 @@ import com.jangburich.domain.store.domain.StoreTeam; import com.jangburich.domain.store.domain.StoreTeamResponseDTO; import com.jangburich.domain.store.domain.StoreUpdateRequestDTO; -import com.jangburich.domain.store.dto.StoreTeamResponse; import com.jangburich.domain.store.dto.condition.StoreSearchCondition; import com.jangburich.domain.store.dto.condition.StoreSearchConditionWithType; import com.jangburich.domain.store.dto.response.OrdersDetailResponse; @@ -212,21 +212,19 @@ public StoreGetResponseDTO getStoreInfo(String authentication) { return new StoreGetResponseDTO().of(store); } - public List getPaymentGroup(String userId) { + public List getPaymentGroup(String userId) { User user = userRepository.findByProviderId(userId) - .orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION)); + .orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION)); Owner owner = ownerRepository.findByUser(user) - .orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION)); + .orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION)); Store store = storeRepository.findByOwner(owner) - .orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION)); + .orElseThrow(() -> new DefaultNullPointerException(ErrorCode.INVALID_AUTHENTICATION)); - List list = storeTeamRepository.findAllByStore(store).stream().map(storeTeamResponseDTO -> { - return new StoreTeamResponse(storeTeamResponseDTO.id(), storeTeamResponseDTO.remainPoint(), + List list = storeTeamRepository.findAllByStore(store).stream().map(storeTeamResponseDTO -> new StoreTeamResponse(storeTeamResponseDTO.id(), storeTeamResponseDTO.remainPoint(), storeTeamResponseDTO.teamId(), storeTeamResponseDTO.teamName(), storeTeamResponseDTO.teamDescription(), - storeTeamResponseDTO.storeId(), storeTeamResponseDTO.updatedAt(), store.getMaxReservation()); - }).toList(); + storeTeamResponseDTO.storeId(), storeTeamResponseDTO.updatedAt(), store.getMaxReservation())).toList(); return list; }