Skip to content

Commit 887c367

Browse files
authored
Merge pull request #249 from GTable/refoctor#248-Order-DateFilter
Refoctor: 주문 내역 조회 날짜 필터링 추가
2 parents 4cfd8e0 + 3ef6ea5 commit 887c367

5 files changed

Lines changed: 10 additions & 7 deletions

File tree

nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/order/controller/OrderController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class OrderController {
3535

3636
@GetMapping("/{storeId}")
3737
@Operation(summary = "주점별 주문리스트 조회", description = "특정 주점에 대한 예약리스트 조회")
38-
@ApiResponse(responseCode = "200", description = "주리스트 조회")
38+
@ApiResponse(responseCode = "200", description = "주문 리스트 조회")
3939
public ResponseEntity<?> getOrderListByStoreId(@PathVariable Long storeId,
4040
@AuthenticationPrincipal MemberDetails memberDetails) {
4141
List<OrderResponseDto> response = orderService.findAllOrders(storeId, memberDetails);

nowait-app-admin-api/src/main/java/com/nowait/applicationadmin/order/service/OrderService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.nowait.applicationadmin.order.service;
22

33
import java.time.LocalDate;
4+
import java.time.LocalDateTime;
5+
import java.time.ZoneId;
46
import java.util.List;
57
import java.util.stream.Collectors;
68

@@ -46,7 +48,11 @@ public List<OrderResponseDto> findAllOrders(Long storeId, MemberDetails memberDe
4648
if (!Role.SUPER_ADMIN.equals(user.getRole()) && !user.getStoreId().equals(storeId)) {
4749
throw new OrderViewUnauthorizedException();
4850
}
49-
return orderRepository.findAllByStore_StoreId(storeId)
51+
52+
LocalDate today = LocalDate.now(ZoneId.of("Asia/Seoul"));
53+
LocalDateTime startDateTime = today.atStartOfDay();
54+
LocalDateTime endDateTime = today.plusDays(1).atStartOfDay();
55+
return orderRepository.findAllByStore_StoreIdAndCreatedAtBetween(storeId, startDateTime, endDateTime)
5056
.stream()
5157
.map(OrderResponseDto::fromEntity)
5258
.collect(Collectors.toList());

nowait-app-user-api/src/main/java/com/nowait/applicationuser/config/security/CorsConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public CorsConfigurationSource corsConfigurationSource() {
1515
CorsConfiguration config = new CorsConfiguration();
1616

1717
config.setAllowCredentials(true); // 쿠키나 인증헤더 자격증명 허용
18-
config.setAllowedOrigins(List.of("http://localhost:5173", "http://localhost:63342", "https://nowait-user.vercel.app", "https://nowait.co.kr", "https://www.nowait.co.kr")); // 허용할 출처 설정
18+
config.setAllowedOrigins(List.of("http://localhost:5173", "http://localhost:63342", "https://nowait-user.vercel.app", "https://nowait.co.kr")); // 허용할 출처 설정
1919
config.setAllowedMethods(List.of("GET", "POST", "PATCH", "PUT", "DELETE", "OPTIONS")); // 메서드 허용
2020
config.setAllowedHeaders(List.of("*")); //클라이언트가 보낼 수 있는 헤더
2121
config.setExposedHeaders(List.of("Authorization")); //클라이언트(브라우저)가 접근할 수 있는 헤더 지정

nowait-domain/domain-admin-rdb/src/main/java/com/nowait/domainadminrdb/statistic/repository/StatisticCustomRepository.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import com.nowait.domainadminrdb.statistic.dto.StoreSales;
1010
import com.nowait.domainadminrdb.statistic.dto.TopSalesStoresDetail;
1111

12-
13-
1412
public interface StatisticCustomRepository {
1513

1614
OrderSalesSumDetail findSalesSumByStoreId(Long storeId, LocalDate date);
@@ -19,7 +17,6 @@ public interface StatisticCustomRepository {
1917

2018
Map<Long, Integer> findOrderCountByStoreIds(List<Long> storeIds);
2119

22-
2320
// redis 사용하는 부분
2421
List<StoreSales> findTotalSales();
2522

nowait-domain/domain-core-rdb/src/main/java/com/nowait/domaincorerdb/order/repository/OrderRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ public interface OrderRepository extends JpaRepository<UserOrder, Long> {
1616
List<UserOrder> findByStore_StoreIdAndTableIdAndSessionId(Long storeId, Long tableId, String sessionId);
1717

1818
@EntityGraph(attributePaths = {"orderItems", "orderItems.menu"})
19-
List<UserOrder> findAllByStore_StoreId(Long storeId);
19+
List<UserOrder> findAllByStore_StoreIdAndCreatedAtBetween(Long storeId, LocalDateTime startDateTime, LocalDateTime endDateTime);
2020
}

0 commit comments

Comments
 (0)