From f0da95925bcb8ad19b0d1cc78afe4b4a4ae188a6 Mon Sep 17 00:00:00 2001
From: p-honggang.li <p-honggang.li@pcitc.com>
Date: 星期四, 28 八月 2025 09:55:51 +0800
Subject: [PATCH] Merge branch 'master' of http://xearth.cn:6600/r/web-manage/web-manage-back

---
 src/main/java/com/webmanage/service/impl/ProductPricingServiceImpl.java |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/webmanage/service/impl/ProductPricingServiceImpl.java b/src/main/java/com/webmanage/service/impl/ProductPricingServiceImpl.java
index f14987b..a5a63ee 100644
--- a/src/main/java/com/webmanage/service/impl/ProductPricingServiceImpl.java
+++ b/src/main/java/com/webmanage/service/impl/ProductPricingServiceImpl.java
@@ -5,6 +5,7 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.webmanage.common.BusinessException;
+import com.webmanage.emun.PriceTypeEnum;
 import com.webmanage.entity.ProductPricing;
 import com.webmanage.mapper.ProductPricingMapper;
 import com.webmanage.service.ProductPricingService;
@@ -47,8 +48,17 @@
             if (!StringUtils.hasText(productPricing.getPriceType())) {
                 throw new BusinessException("浠锋牸璁剧疆涓嶈兘涓虹┖");
             }
-            if (productPricing.getPrice() == null || productPricing.getPrice().doubleValue() < 0) {
-                throw new BusinessException("浠锋牸鍊间笉鑳戒负绌轰笖涓嶈兘涓鸿礋鏁�");
+            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.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) {
                 throw new BusinessException("浜у搧ID涓嶈兘涓虹┖");
@@ -96,8 +106,17 @@
             if (!StringUtils.hasText(productPricing.getPriceType())) {
                 throw new BusinessException("浠锋牸璁剧疆涓嶈兘涓虹┖");
             }
-            if (productPricing.getPrice() == null || productPricing.getPrice().doubleValue() < 0) {
-                throw new BusinessException("浠锋牸鍊间笉鑳戒负绌轰笖涓嶈兘涓鸿礋鏁�");
+            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.getPriceType().indexOf(PriceTypeEnum.CURRENCY.getName()) > -1
+                    && productPricing.getCurrencyPrice()== null ||
+                    productPricing.getPriceType().indexOf(PriceTypeEnum.CURRENCY.getName()) > -1
+                            && productPricing.getCurrencyPrice().doubleValue() < 0) {
+                throw new BusinessException("璐у竵浠锋牸鍊间笉鑳戒负绌轰笖涓嶈兘涓鸿礋鏁�");
             }
             
             boolean result = updateById(productPricing);
@@ -143,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