From 9534df9c12adc71274c994df8765c788222a0f7b Mon Sep 17 00:00:00 2001
From: 彭雪彬 <1724387007@qq.com>
Date: Thu, 04 Sep 2025 10:34:03 +0800
Subject: [PATCH] 返回抛出异常
---
oying-system/src/main/java/com/oying/modules/pc/product/rest/ProductCustomerController.java | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/oying-system/src/main/java/com/oying/modules/pc/product/rest/ProductCustomerController.java b/oying-system/src/main/java/com/oying/modules/pc/product/rest/ProductCustomerController.java
index fae7204..000ecca 100644
--- a/oying-system/src/main/java/com/oying/modules/pc/product/rest/ProductCustomerController.java
+++ b/oying-system/src/main/java/com/oying/modules/pc/product/rest/ProductCustomerController.java
@@ -18,7 +18,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.*;
@@ -63,7 +62,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 +74,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();
--
Gitblit v1.9.3