From c67c3be16c4a9aa7c6617d43da886850d717a009 Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Fri, 07 Nov 2025 14:38:26 +0800
Subject: [PATCH] 商品门店匿名访问
---
oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 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 bfcf1c1..36bf3df 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,6 +1,9 @@
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.annotation.rest.AnonymousGetMapping;
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;
@@ -18,7 +21,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;
@@ -44,7 +46,7 @@
private final StoreQualificationService storeQualificationService;
private final ProductService productService;
- @GetMapping(value = "/page")
+ @AnonymousGetMapping(value = "/page")
@ApiOperation("查询店铺")
public ResponseEntity<?> getStoresByPage(StoreQueryCriteria criteria) {
criteria.setLimit(1000);
@@ -59,19 +61,22 @@
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));
}
- @GetMapping(value = "/{storeId}/details")
+ @AnonymousGetMapping(value = "/{storeId}/details")
@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.getByStoreId(storeId));
+ view.setQualifications(storeQualificationService.getByStoreId(storeId));
}
- return ResponseEntity.ok(R.success(store));
+ return ResponseEntity.ok(R.success(view));
}
private List<Product> getProductsByStoreId(Long storeId) {
--
Gitblit v1.9.3