From 728466c4924c04dc162811f34086855c51ec0878 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Fri, 29 Aug 2025 14:30:23 +0800
Subject: [PATCH] Merge branch 'master' into xin
---
oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 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 3208951..8e0c22d 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,15 +1,15 @@
package com.oying.modules.pc.store.rest;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.bean.copier.CopyOptions;
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;
@@ -20,7 +20,6 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
-import org.springframework.beans.BeanUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -49,12 +48,11 @@
@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}")
@@ -62,7 +60,7 @@
public ResponseEntity<?> getStoreById(@PathVariable("storeId") Long storeId) {
Store store = storeService.getById(storeId);
CustomerStoreView view = new CustomerStoreView();
- BeanUtils.copyProperties(store, view);
+ BeanUtil.copyProperties(store, view, CopyOptions.create().setIgnoreNullValue(true));
view.setBusinessHours(BusinessHoursUtils.formatBusinessHours(store.getOpenTime(), store.getCloseTime()));
return ResponseEntity.ok(R.success(view));
}
@@ -71,16 +69,19 @@
@ApiOperation("查询店铺")
public ResponseEntity<?> getStoreDetailsById(@PathVariable("storeId") Long storeId) {
Store store = storeService.getById(storeId);
+ CustomerStoreView view = new CustomerStoreView();
+ BeanUtil.copyProperties(store, view, CopyOptions.create().setIgnoreNullValue(true));
+ view.setBusinessHours(BusinessHoursUtils.formatBusinessHours(store.getOpenTime(), store.getCloseTime()));
if (ObjUtil.isNotEmpty(store)) {
- store.setQualifications(storeQualificationService.queryByStoreId(storeId));
+ view.setQualifications(storeQualificationService.getByStoreId(storeId));
}
- return ResponseEntity.ok(R.success(store));
+ return ResponseEntity.ok(R.success(view));
}
private List<Product> getProductsByStoreId(Long storeId) {
ProductQueryCriteria criteria = new ProductQueryCriteria();
criteria.setStoreId(storeId);
- criteria.setStatus(ProductStatusEnum.AVAILABLE.getValue());
+ criteria.setShelfStatus(ProductStatusEnum.AVAILABLE.getValue());
criteria.setLimit(3);
return productService.queryAll(criteria);
}
--
Gitblit v1.9.3