From 43315000b2840313a5aff96bf314b3c061e4616d Mon Sep 17 00:00:00 2001
From: zepengdev <lzpsmith@outlook.com>
Date: Mon, 14 Jul 2025 21:00:53 +0800
Subject: [PATCH] feat: 增加店铺和商品审核功能

---
 oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java |   38 ++++++++++++++++++++------------------
 1 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java b/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java
index 04dd21d..b98c44f 100644
--- a/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java
+++ b/oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java
@@ -1,17 +1,17 @@
 package com.oying.modules.pc.store.rest;
 
+import cn.hutool.core.util.ObjUtil;
 import com.oying.modules.pc.product.domain.Product;
 import com.oying.modules.pc.product.domain.dto.ProductQueryCriteria;
 import com.oying.modules.pc.product.domain.enums.ProductStatusEnum;
 import com.oying.modules.pc.product.service.ProductService;
 import com.oying.modules.pc.store.domain.Store;
-import com.oying.modules.pc.store.domain.StoreQualification;
-import com.oying.modules.pc.store.domain.dto.StoreCustomerDetailDto;
-import com.oying.modules.pc.store.domain.dto.StoreQualificationQueryCriteria;
 import com.oying.modules.pc.store.domain.dto.StoreQueryCriteria;
+import com.oying.modules.pc.store.domain.enums.StoreStatusEnum;
 import com.oying.modules.pc.store.service.StoreQualificationService;
 import com.oying.modules.pc.store.service.StoreQueryService;
 import com.oying.modules.pc.store.service.StoreService;
+import com.oying.modules.pc.store.view.CustomerStoreView;
 import com.oying.modules.pc.utils.BusinessHoursUtils;
 import com.oying.utils.PageResult;
 import com.oying.utils.R;
@@ -47,29 +47,31 @@
     @GetMapping(value = "/page")
     @ApiOperation("查询店铺")
     public ResponseEntity<?> getStoresByPage(StoreQueryCriteria criteria) {
+        criteria.setLimit(1000);
+        criteria.setBusinessStatus(StoreStatusEnum.OPEN.getValue());
         PageResult<Store> pagedStores = storeQueryService.findPagedStores(criteria);
-        List<Store> stores = pagedStores.getContent();
-        for (Store store : stores) {
-            store.setProducts(this.getProductsByStoreId(store.getStoreId()));
-        }
-        return ResponseEntity.ok(R.success(stores));
+        pagedStores.getContent().forEach(store -> store.setProducts(this.getProductsByStoreId(store.getStoreId())));
+        return ResponseEntity.ok(R.success(pagedStores));
     }
 
     @GetMapping(value = "/{storeId}")
     @ApiOperation("查询店铺")
-    public ResponseEntity<?> getStoreDetailsById(@PathVariable("storeId") Long storeId) {
+    public ResponseEntity<?> getStoreById(@PathVariable("storeId") Long storeId) {
         Store store = storeService.getById(storeId);
-        //store.setQualifications(this.getQualificationsByStoreId(store.getStoreId()));
-        StoreCustomerDetailDto storeDto = new StoreCustomerDetailDto();
-        BeanUtils.copyProperties(store, storeDto);
-        storeDto.setBusinessHours(BusinessHoursUtils.formatBusinessHours(store.getOpenTime(), store.getCloseTime()));
-        return ResponseEntity.ok(R.success(storeDto));
+        CustomerStoreView view = new CustomerStoreView();
+        BeanUtils.copyProperties(store, view);
+        view.setBusinessHours(BusinessHoursUtils.formatBusinessHours(store.getOpenTime(), store.getCloseTime()));
+        return ResponseEntity.ok(R.success(view));
     }
 
-    private List<StoreQualification> getQualificationsByStoreId(Long storeId) {
-        StoreQualificationQueryCriteria criteria = new StoreQualificationQueryCriteria();
-        criteria.setStoreId(storeId);
-        return storeQualificationService.queryAll(criteria);
+    @GetMapping(value = "/{storeId}/details")
+    @ApiOperation("查询店铺")
+    public ResponseEntity<?> getStoreDetailsById(@PathVariable("storeId") Long storeId) {
+        Store store = storeService.getById(storeId);
+        if (ObjUtil.isNotEmpty(store)) {
+            store.setQualifications(storeQualificationService.getByStoreId(storeId));
+        }
+        return ResponseEntity.ok(R.success(store));
     }
 
     private List<Product> getProductsByStoreId(Long storeId) {

--
Gitblit v1.9.3