From 6d31d535d737ed26c4d9d61cd4e0b5483cb9b0ba Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Wed, 17 Sep 2025 19:44:00 +0800
Subject: [PATCH] Merge branch 'refs/heads/master' into xin
---
oying-system/src/main/java/com/oying/modules/pc/product/service/impl/ProductMerchantServiceImpl.java | 19 +++----------------
1 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/oying-system/src/main/java/com/oying/modules/pc/product/service/impl/ProductMerchantServiceImpl.java b/oying-system/src/main/java/com/oying/modules/pc/product/service/impl/ProductMerchantServiceImpl.java
index 24ed038..e4eef20 100644
--- a/oying-system/src/main/java/com/oying/modules/pc/product/service/impl/ProductMerchantServiceImpl.java
+++ b/oying-system/src/main/java/com/oying/modules/pc/product/service/impl/ProductMerchantServiceImpl.java
@@ -1,11 +1,9 @@
package com.oying.modules.pc.product.service.impl;
import cn.hutool.core.collection.CollectionUtil;
-import cn.hutool.core.util.ObjUtil;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.oying.exception.BadRequestException;
-import com.oying.exception.EntityNotFoundException;
import com.oying.modules.pc.common.core.constrant.AuditStatusEnum;
import com.oying.modules.pc.product.converter.ProductImageAssembler;
import com.oying.modules.pc.product.converter.ProductLabelAssembler;
@@ -30,7 +28,6 @@
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
-import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -77,7 +74,7 @@
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ProductMerchantUpdateRequest request) {
- Product existingProduct = this.findOrThrow(request.getProductId());
+ Product existingProduct = productService.getProduct(request.getProductId());
this.validateApprovedStatus(existingProduct.getShelfStatus());
this.processImagesUpdate(request);
this.processLabelsUpdate(request);
@@ -88,18 +85,16 @@
@Override
@Transactional(rollbackFor = Exception.class)
public void updateImages(ProductMerchantUpdateRequest request) {
- Product existingProduct = this.findOrThrow(request.getProductId());
+ Product existingProduct = productService.getProduct(request.getProductId());
this.validateApprovedStatus(existingProduct.getShelfStatus());
- this.findOrThrow(request.getProductId());
this.processImagesUpdate(request);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateLabels(ProductMerchantUpdateRequest request) {
- Product existingProduct = this.findOrThrow(request.getProductId());
+ Product existingProduct = productService.getProduct(request.getProductId());
this.validateApprovedStatus(existingProduct.getShelfStatus());
- this.findOrThrow(request.getProductId());
this.processImagesUpdate(request);
}
@@ -160,14 +155,6 @@
} catch (Exception e) {
log.error("处理商品审核结果异常", e);
}
- }
-
- private Product findOrThrow(Long productId) {
- Product existingProduct = productService.getById(productId);
- if (ObjUtil.isEmpty(existingProduct)) {
- throw new EntityNotFoundException(Product.class, "id", Optional.ofNullable(productId).map(Object::toString).orElse("null"));
- }
- return existingProduct;
}
private void processImagesUpdate(ProductMerchantUpdateRequest request) {
--
Gitblit v1.9.3