zepengdev
2025-07-21 7440258d31a6ef7d76eb2351852cec9f2bdd4222
oying-system/src/main/java/com/oying/modules/pc/product/rest/ProductCustomerController.java
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.ProductImageService;
import com.oying.modules.pc.product.service.ProductLabelService;
import com.oying.modules.pc.product.service.ProductService;
@@ -18,7 +19,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.*;
@@ -55,6 +55,7 @@
        criteria.setCategoryId(categoryId);
        criteria.setSecondCategoryId(secondCategoryId);
        criteria.setBlurry(blurry);
        criteria.setShelfStatus(ProductStatusEnum.AVAILABLE.getValue());
        Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize());
        PageResult<Product> productPageResult = productService.queryAll(criteria, page);
@@ -63,7 +64,7 @@
        PageResult<ProductCustomerView> viewPageResult = new PageResult<>(
                productList.stream().map(i -> {
                    ProductCustomerView view = new ProductCustomerView();
                    BeanUtils.copyProperties(i, view);
                    BeanUtil.copyProperties(i, view);
                    return view;
                }).collect(Collectors.toList()),
                productPageResult.getTotalElements());
@@ -75,7 +76,11 @@
    /*@PreAuthorize("@el.check('merchant:product:byProductId')")*/
    public ResponseEntity<?> getProductDetails(@PathVariable Long productId) {
        Product product = productService.getById(productId);
        if (ObjUtil.isEmpty(product)) {
            return ResponseEntity.ok(R.success());
        }
        ProductCustomerView customerView = new ProductCustomerView();
        BeanUtil.copyProperties(product, customerView);
        if (ObjUtil.isNotEmpty(product)) {
            customerView.setImages(productImageService.queryImagesByProductId(productId).stream().map(i -> {
                ProductImageCustomerView imageCustomerView = new ProductImageCustomerView();