diff --git a/src/main/java/com/yeonieum/productservice/domain/product/dto/customerservice/ProductManagementResponse.java b/src/main/java/com/yeonieum/productservice/domain/product/dto/customerservice/ProductManagementResponse.java index 2cdc175..1524e50 100644 --- a/src/main/java/com/yeonieum/productservice/domain/product/dto/customerservice/ProductManagementResponse.java +++ b/src/main/java/com/yeonieum/productservice/domain/product/dto/customerservice/ProductManagementResponse.java @@ -178,9 +178,10 @@ public static class ProductOrderCount { @Getter @Builder - public static class OfGenderRank { + public static class OfStatisticsProduct { private Long productId; private String productName; + private String categoryName; private String image; private Long orderCount; private double averageScore; diff --git a/src/main/java/com/yeonieum/productservice/domain/product/service/customerservice/ProductManagementService.java b/src/main/java/com/yeonieum/productservice/domain/product/service/customerservice/ProductManagementService.java index b22364f..6236796 100644 --- a/src/main/java/com/yeonieum/productservice/domain/product/service/customerservice/ProductManagementService.java +++ b/src/main/java/com/yeonieum/productservice/domain/product/service/customerservice/ProductManagementService.java @@ -28,5 +28,5 @@ public interface ProductManagementService { ProductManagementResponse.OfRetrieveProductOrder retrieveProductInformation(Long productId); Map<Long, ProductManagementResponse.OfRetrieveProductOrder> bulkRetrieveProductInformation(List<Long> productIdList); List<ProductManagementResponse.OfOrderInformation> retrieveOrderInformation(StockUsageRequest.IncreaseStockUsageList increaseStockUsageList); - List<ProductManagementResponse.OfGenderRank> retrieveTopProductsByCondition(Long customerId, Gender gender, Integer ageRange, OrderType orderType); + List<ProductManagementResponse.OfStatisticsProduct> retrieveTopProductsByCondition(Long customerId, Gender gender, Integer ageRange, OrderType orderType); } diff --git a/src/main/java/com/yeonieum/productservice/domain/product/service/customerservice/ProductManagementServiceImpl.java b/src/main/java/com/yeonieum/productservice/domain/product/service/customerservice/ProductManagementServiceImpl.java index f1ffb55..c8b0d1b 100644 --- a/src/main/java/com/yeonieum/productservice/domain/product/service/customerservice/ProductManagementServiceImpl.java +++ b/src/main/java/com/yeonieum/productservice/domain/product/service/customerservice/ProductManagementServiceImpl.java @@ -341,7 +341,7 @@ public void uploadCertificationImage(Long productId, String imageUrl, ProductMan */ @Override @Transactional - public List<ProductManagementResponse.OfGenderRank> retrieveTopProductsByCondition(Long customerId, Gender gender, Integer ageRange, OrderType orderType) { + public List<ProductManagementResponse.OfStatisticsProduct> retrieveTopProductsByCondition(Long customerId, Gender gender, Integer ageRange, OrderType orderType) { ResponseEntity<ApiResponse<List<ProductManagementResponse.ProductOrderCount>>> productOrderCounts = null; List<ProductManagementResponse.ProductOrderCount> productOrderCountList = null; @@ -368,15 +368,16 @@ public List<ProductManagementResponse.OfGenderRank> retrieveTopProductsByConditi } //반환값 (상품 정보) - List<ProductManagementResponse.OfGenderRank> genderRanks = new ArrayList<>(); + List<ProductManagementResponse.OfStatisticsProduct> genderRanks = new ArrayList<>(); for(ProductManagementResponse.ProductOrderCount productOrderCount : productOrderCountList){ Product targetProduct = productRepository.findById(productOrderCount.getProductId()) .orElseThrow(() -> new ProductException(PRODUCT_NOT_FOUND, HttpStatus.NOT_FOUND)); - ProductManagementResponse.OfGenderRank genderRank = ProductManagementResponse.OfGenderRank.builder() + ProductManagementResponse.OfStatisticsProduct genderRank = ProductManagementResponse.OfStatisticsProduct.builder() .productId(productOrderCount.getProductId()) .productName(targetProduct.getProductName()) + .categoryName(targetProduct.getProductDetailCategory().getDetailCategoryName()) .image(targetProduct.getProductImage()) .orderCount(productOrderCount.getOrderCount()) .averageScore(targetProduct.getAverageScore()) diff --git a/src/main/java/com/yeonieum/productservice/web/controller/ProductManagementController.java b/src/main/java/com/yeonieum/productservice/web/controller/ProductManagementController.java index fef99bc..42f56fa 100644 --- a/src/main/java/com/yeonieum/productservice/web/controller/ProductManagementController.java +++ b/src/main/java/com/yeonieum/productservice/web/controller/ProductManagementController.java @@ -222,12 +222,12 @@ public ResponseEntity<ApiResponse> bulkRetrieveProductInformation(@RequestParam .build(), HttpStatus.OK); } - @Operation(summary = "고객의 성별 및 연령별 TOP3 상품정보 조회", description = "고객의 성별 및 연령별 TOP3 상품을 조회하는 기능입니다.") + @Operation(summary = "고객의 상품 통계정보 조회", description = "고객의 상품들의 통계정보를 조회하는 기능입니다.") @ApiResponses({ @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "201", description = "상품 정보 조회 성공"), @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "500", description = "상품 정보 조회 실패") }) - @GetMapping("/ranking/gender-product") + @GetMapping("/ranking/statistics-product") public ResponseEntity<ApiResponse> getProductByCondition(@RequestParam Long customerId, @RequestParam(required = false) Gender gender, @RequestParam(required = false) Integer ageRange,