From 1cda9be49d77c83bdab4cfea7e3558fd4064bdb1 Mon Sep 17 00:00:00 2001
From: seatonwan9
Date: 星期四, 28 八月 2025 02:03:11 +0800
Subject: [PATCH] 更新代码

---
 src/main/java/com/webmanage/service/impl/ProductPricingServiceImpl.java |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/webmanage/service/impl/ProductPricingServiceImpl.java b/src/main/java/com/webmanage/service/impl/ProductPricingServiceImpl.java
index 25076bf..a5a63ee 100644
--- a/src/main/java/com/webmanage/service/impl/ProductPricingServiceImpl.java
+++ b/src/main/java/com/webmanage/service/impl/ProductPricingServiceImpl.java
@@ -48,10 +48,16 @@
             if (!StringUtils.hasText(productPricing.getPriceType())) {
                 throw new BusinessException("浠锋牸璁剧疆涓嶈兘涓虹┖");
             }
-            if (productPricing.getPointsPrice() == null || productPricing.getPointsPrice().doubleValue() < 0) {
+            if (productPricing.getPriceType().indexOf(PriceTypeEnum.POINTS.getName()) > -1
+                    && productPricing.getPointsPrice() == null ||
+                    productPricing.getPriceType().indexOf(PriceTypeEnum.POINTS.getName()) > -1
+                            &&productPricing.getPointsPrice().doubleValue() < 0) {
                 throw new BusinessException("绉垎浠锋牸鍊间笉鑳戒负绌轰笖涓嶈兘涓鸿礋鏁�");
             }
-            if (productPricing.getCurrencyPrice()== null || productPricing.getCurrencyPrice().doubleValue() < 0) {
+            if (productPricing.getPriceType().indexOf(PriceTypeEnum.CURRENCY.getName()) > -1
+                    && productPricing.getCurrencyPrice()== null ||
+                    productPricing.getPriceType().indexOf(PriceTypeEnum.CURRENCY.getName()) > -1
+                            && productPricing.getCurrencyPrice().doubleValue() < 0){
                 throw new BusinessException("璐у竵浠锋牸鍊间笉鑳戒负绌轰笖涓嶈兘涓鸿礋鏁�");
             }
             if (productPricing.getProductId() == null) {
@@ -156,11 +162,8 @@
     }
 
     @Override
-    public List<ProductPricing> getPricingByProductId(Long productId) {
+    public List<ProductPricing> getPricingByProductId(String productId) {
         try {
-            if (productId == null) {
-                throw new BusinessException("浜у搧ID涓嶈兘涓虹┖");
-            }
             return baseMapper.selectByProductId(productId);
         } catch (Exception e) {
             log.error("鏍规嵁浜у搧ID鏌ヨ瀹氫环澶辫触: ", e);

--
Gitblit v1.8.0