From 5e92bbf41bc98ec69276bbc183446b2c805ae995 Mon Sep 17 00:00:00 2001 From: nowgnas Date: Tue, 16 Jan 2024 19:25:02 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EA=B0=80=EA=B2=8C=20=ED=8F=89=EC=A0=90?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=20=EC=88=98=EC=A0=95=20=EB=B0=8F=20?= =?UTF-8?q?=EC=83=81=ED=92=88=20=EC=A1=B0=ED=9A=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/adapter/out/mongo/ProductQueryRepository.java | 4 +++- .../product/application/port/in/ProductQueryInputPort.java | 6 +----- .../kr/bb/product/domain/product/mapper/ProductCommand.java | 1 + 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/kr/bb/product/domain/product/adapter/out/mongo/ProductQueryRepository.java b/src/main/java/kr/bb/product/domain/product/adapter/out/mongo/ProductQueryRepository.java index 86b0e5e..bfa1a16 100644 --- a/src/main/java/kr/bb/product/domain/product/adapter/out/mongo/ProductQueryRepository.java +++ b/src/main/java/kr/bb/product/domain/product/adapter/out/mongo/ProductQueryRepository.java @@ -237,10 +237,12 @@ public Map> findProductsByProductsGroupByStoreId(List findStoreAverageRating() { + AggregationOperation matchReviewsGreaterThanOne = + Aggregation.match(Criteria.where("reviewCount").gt(1)); AggregationOperation groupByStoreId = Aggregation.group("storeId").avg("averageRating").as("averageRating"); TypedAggregation aggregation = - Aggregation.newAggregation(Product.class, groupByStoreId); + Aggregation.newAggregation(Product.class, matchReviewsGreaterThanOne, groupByStoreId); // Execute the aggregation AggregationResults aggregate = diff --git a/src/main/java/kr/bb/product/domain/product/application/port/in/ProductQueryInputPort.java b/src/main/java/kr/bb/product/domain/product/application/port/in/ProductQueryInputPort.java index 4bb33f0..bf31891 100644 --- a/src/main/java/kr/bb/product/domain/product/application/port/in/ProductQueryInputPort.java +++ b/src/main/java/kr/bb/product/domain/product/application/port/in/ProductQueryInputPort.java @@ -89,7 +89,7 @@ private static Pageable getPageable(Pageable pageable, ProductCommand.SortOption return PageRequest.of( pageable.getPageNumber(), pageable.getPageSize(), - Sort.by(Direction.DESC, "product_sale_status") + Sort.by(Direction.DESC, "productSaleStatus") .and(Sort.by(direction, sortOption.getSortOption()))); } @@ -346,10 +346,6 @@ public StoreAverageDto getStoreAverageRating() { @Override public List getFlowerAmountGroupByStoreId(ProcessOrderDto processOrderDto) { - processOrderDto - .getProducts() - .keySet() - .forEach(key -> log.info("!!!!!!!!! {}", processOrderDto.getProducts().get(key))); Map> productsByProductsGroupByStoreId = productQueryOutPort.findProductsByProductsGroupByStoreId( new ArrayList<>(processOrderDto.getProducts().keySet())); diff --git a/src/main/java/kr/bb/product/domain/product/mapper/ProductCommand.java b/src/main/java/kr/bb/product/domain/product/mapper/ProductCommand.java index 38961c6..c8c09de 100644 --- a/src/main/java/kr/bb/product/domain/product/mapper/ProductCommand.java +++ b/src/main/java/kr/bb/product/domain/product/mapper/ProductCommand.java @@ -166,6 +166,7 @@ public static List getFlowerAmountOfStore( @Getter public enum SortOption { TOP_SALE("productSaleAmount"), + SALE("productSaleAmount"), BOTTOM_SALE("productSaleAmount"), NEW("createdAt"), OLD("createdAt"),