Skip to content

Commit

Permalink
fix: don't conflict plz (#146)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: Oh Hyun Woo <[email protected]>
  • Loading branch information
3 people authored Nov 23, 2024
1 parent 7ec927c commit c5de023
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 156 deletions.
215 changes: 107 additions & 108 deletions src/main/java/com/jangburich/domain/store/controller/StoreController.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -44,110 +44,109 @@
@RequestMapping("/store")
public class StoreController {

private final StoreService storeService;

@Operation(summary = "카테고리 별 가게 목록 조회", description = "카테고리 별로 가게 목록을 조회합니다.")
@PostMapping("/category")
public ResponseCustom<Page<SearchStoresResponse>> 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<Page<SearchStoresResponse>> 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<StoreSearchDetailsResponse> 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<Message> createStore(
Authentication authentication,
@Parameter(name = "image", description = "업로드 사진 데이터") @RequestPart(value = "image") MultipartFile image,
@RequestPart(value = "store") StoreCreateRequestDTO storeCreateRequestDTO,
@RequestPart(value = "menuImages", required = false) List<MultipartFile> menuImages) {

storeService.createStore(AuthenticationParser.parseUserId(authentication), storeCreateRequestDTO, image,
menuImages);
return ResponseCustom.OK(Message.builder().message("success").build());
}

@Operation(summary = "가게 정보 수정", description = "가게 정보를 수정합니다.")
@PatchMapping("/update")
public ResponseCustom<Message> 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<StoreGetResponseDTO> getStoreInfo(Authentication authentication) {
return ResponseCustom.OK(storeService.getStoreInfo(AuthenticationParser.parseUserId(authentication)));
}

@Operation(summary = "결제 그룹 조회", description = "장부 결제 그룹을 조회합니다.")
@GetMapping("/payment_group")
public ResponseCustom<List<StoreTeamResponse>> getPaymentGroup(Authentication authentication) {
return ResponseCustom.OK(
storeService.getPaymentGroup(AuthenticationParser.parseUserId(authentication)));
}

@Operation(summary = "결제 그룹 상세 조회", description = "장부 결제 그룹을 상세 조회합니다.")
@GetMapping("/payment_group/{teamId}")
public ResponseCustom<PaymentGroupDetailResponse> 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<List<OrdersGetResponse>> getLastOrders(Authentication authentication) {
List<OrdersGetResponse> ordersLast = storeService.getOrdersLast(
AuthenticationParser.parseUserId(authentication));
return ResponseCustom.OK(ordersLast);
}

@Operation(summary = "오늘 주문 조회", description = "가게에 있는 오늘 주문을 조회합니다")
@GetMapping("/orders/today")
public ResponseCustom<OrdersTodayResponse> getTodayOrders(Authentication authentication) {
return ResponseCustom.OK(storeService.getTodayOrders(
AuthenticationParser.parseUserId(authentication)));
}

@Operation(summary = "주문 상세 조회", description = "가게에 있는 주문을 상세 조회합니다")
@GetMapping("/orders/{ordersId}")
public ResponseCustom<OrdersDetailResponse> 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<Page<SearchStoresResponse>> 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<Page<SearchStoresResponse>> 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<StoreSearchDetailsResponse> 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<Message> createStore(
Authentication authentication,
@Parameter(name = "image", description = "업로드 사진 데이터") @RequestPart(value = "image") MultipartFile image,
@RequestPart(value = "store") StoreCreateRequestDTO storeCreateRequestDTO,
@RequestPart(value = "menuImages", required = false) List<MultipartFile> menuImages) {

storeService.createStore(AuthenticationParser.parseUserId(authentication), storeCreateRequestDTO, image,
menuImages);
return ResponseCustom.OK(Message.builder().message("success").build());
}


@Operation(summary = "가게 정보 수정", description = "가게 정보를 수정합니다.")
@PatchMapping("/update")
public ResponseCustom<Message> 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<StoreGetResponseDTO> getStoreInfo(Authentication authentication) {
return ResponseCustom.OK(storeService.getStoreInfo(AuthenticationParser.parseUserId(authentication)));
}

@Operation(summary = "결제 그룹 조회", description = "장부 결제 그룹을 조회합니다.")
@GetMapping("/payment_group")
public ResponseCustom<List<com.jangburich.domain.store.dto.StoreTeamResponse>> getPaymentGroup(Authentication authentication) {
return ResponseCustom.OK(
storeService.getPaymentGroup(AuthenticationParser.parseUserId(authentication)));
}

@Operation(summary = "결제 그룹 상세 조회", description = "장부 결제 그룹을 상세 조회합니다.")
@GetMapping("/payment_group/{teamId}")
public ResponseCustom<PaymentGroupDetailResponse> 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<List<OrdersGetResponse>> getLastOrders(Authentication authentication) {
List<OrdersGetResponse> ordersLast = storeService.getOrdersLast(
AuthenticationParser.parseUserId(authentication));
return ResponseCustom.OK(ordersLast);
}

@Operation(summary = "오늘 주문 조회", description = "가게에 있는 오늘 주문을 조회합니다")
@GetMapping("/orders/today")
public ResponseCustom<OrdersTodayResponse> getTodayOrders(Authentication authentication) {
return ResponseCustom.OK(storeService.getTodayOrders(
AuthenticationParser.parseUserId(authentication)));
}

@Operation(summary = "주문 상세 조회", description = "가게에 있는 주문을 상세 조회합니다")
@GetMapping("/orders/{ordersId}")
public ResponseCustom<OrdersDetailResponse> getOrders(Authentication authentication, @RequestParam Long orderId) {
return ResponseCustom.OK(
storeService.getOrderDetails(AuthenticationParser.parseUserId(authentication), orderId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,4 +28,4 @@ public StoreTeamResponseDTO(Long id, Integer remainPoint, Long teamId, String te
this.storeId = storeId;
this.updatedAt = updatedAt;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -212,21 +212,19 @@ public StoreGetResponseDTO getStoreInfo(String authentication) {
return new StoreGetResponseDTO().of(store);
}

public List<StoreTeamResponse> getPaymentGroup(String userId) {
public List<com.jangburich.domain.store.dto.StoreTeamResponse> 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<StoreTeamResponse> list = storeTeamRepository.findAllByStore(store).stream().map(storeTeamResponseDTO -> {
return new StoreTeamResponse(storeTeamResponseDTO.id(), storeTeamResponseDTO.remainPoint(),
List<com.jangburich.domain.store.dto.StoreTeamResponse> 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;
}

Expand Down

0 comments on commit c5de023

Please sign in to comment.