From 6416e025afd6b3d19347610b3e441ac6a12a0f8f Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Thu, 25 Sep 2025 22:59:05 +0800
Subject: [PATCH] 工具:支付配置
---
oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java | 69 ++++++++++++++++++++++++++++++----
1 files changed, 61 insertions(+), 8 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 0dfd954..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,14 +1,32 @@
package com.oying.modules.pc.store.rest;
-import com.oying.utils.R;
-import com.oying.modules.pc.store.domain.dto.StoreCustomerDetailDto;
-import com.oying.modules.pc.store.domain.dto.StoreCustomerQueryCriteria;
+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.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;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
/**
* 店铺
@@ -22,15 +40,50 @@
@RequiredArgsConstructor
public class StoreCustomerController {
+ private final StoreService storeService;
private final StoreQueryService storeQueryService;
+ private final StoreQualificationService storeQualificationService;
+ private final ProductService productService;
+
+ @GetMapping(value = "/page")
+ @ApiOperation("查询店铺")
+ public ResponseEntity<?> getStoresByPage(StoreQueryCriteria criteria) {
+ criteria.setLimit(1000);
+ criteria.setBusinessStatus(StoreStatusEnum.OPEN.getValue());
+ PageResult<Store> pagedStores = storeQueryService.findPagedStores(criteria);
+ pagedStores.getContent().forEach(store -> store.setProducts(this.getProductsByStoreId(store.getStoreId())));
+ return ResponseEntity.ok(R.success(pagedStores));
+ }
@GetMapping(value = "/{storeId}")
@ApiOperation("查询店铺")
- public ResponseEntity<?> getCustomerStoreById(@PathVariable("storeId") Long storeId) {
- StoreCustomerQueryCriteria criteria = new StoreCustomerQueryCriteria();
+ public ResponseEntity<?> getStoreById(@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()));
+ return ResponseEntity.ok(R.success(view));
+ }
+
+ @GetMapping(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)) {
+ view.setQualifications(storeQualificationService.getByStoreId(storeId));
+ }
+ return ResponseEntity.ok(R.success(view));
+ }
+
+ private List<Product> getProductsByStoreId(Long storeId) {
+ ProductQueryCriteria criteria = new ProductQueryCriteria();
criteria.setStoreId(storeId);
- StoreCustomerDetailDto detailDto = storeQueryService.getCustomerStoreDetail(criteria);
- return ResponseEntity.ok(R.success(detailDto));
+ criteria.setShelfStatus(ProductStatusEnum.AVAILABLE.getValue());
+ criteria.setLimit(3);
+ return productService.queryAll(criteria);
}
}
--
Gitblit v1.9.3