Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class OrderController {

@GetMapping("/{storeId}")
@Operation(summary = "주점별 주문리스트 조회", description = "특정 주점에 대한 예약리스트 조회")
@ApiResponse(responseCode = "200", description = "주리스트 조회")
@ApiResponse(responseCode = "200", description = "주문 리스트 조회")
public ResponseEntity<?> getOrderListByStoreId(@PathVariable Long storeId,
@AuthenticationPrincipal MemberDetails memberDetails) {
List<OrderResponseDto> response = orderService.findAllOrders(storeId, memberDetails);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.nowait.applicationadmin.order.service;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -46,7 +48,11 @@ public List<OrderResponseDto> findAllOrders(Long storeId, MemberDetails memberDe
if (!Role.SUPER_ADMIN.equals(user.getRole()) && !user.getStoreId().equals(storeId)) {
throw new OrderViewUnauthorizedException();
}
return orderRepository.findAllByStore_StoreId(storeId)

LocalDate today = LocalDate.now(ZoneId.of("Asia/Seoul"));
LocalDateTime startDateTime = today.atStartOfDay();
LocalDateTime endDateTime = today.plusDays(1).atStartOfDay();
return orderRepository.findAllByStore_StoreIdAndCreatedAtBetween(storeId, startDateTime, endDateTime)
.stream()
.map(OrderResponseDto::fromEntity)
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration();

config.setAllowCredentials(true); // 쿠키나 인증헤더 자격증명 허용
config.setAllowedOrigins(List.of("http://localhost:5173", "http://localhost:63342", "https://nowait-user.vercel.app", "https://nowait.co.kr", "https://www.nowait.co.kr")); // 허용할 출처 설정
config.setAllowedOrigins(List.of("http://localhost:5173", "http://localhost:63342", "https://nowait-user.vercel.app", "https://nowait.co.kr")); // 허용할 출처 설정
config.setAllowedMethods(List.of("GET", "POST", "PATCH", "PUT", "DELETE", "OPTIONS")); // 메서드 허용
config.setAllowedHeaders(List.of("*")); //클라이언트가 보낼 수 있는 헤더
config.setExposedHeaders(List.of("Authorization")); //클라이언트(브라우저)가 접근할 수 있는 헤더 지정
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import com.nowait.domainadminrdb.statistic.dto.StoreSales;
import com.nowait.domainadminrdb.statistic.dto.TopSalesStoresDetail;



public interface StatisticCustomRepository {

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

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


// redis 사용하는 부분
List<StoreSales> findTotalSales();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ public interface OrderRepository extends JpaRepository<UserOrder, Long> {
List<UserOrder> findByStore_StoreIdAndTableIdAndSessionId(Long storeId, Long tableId, String sessionId);

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