From 53c315297a3906e567b01107a85836528a664206 Mon Sep 17 00:00:00 2001 From: seatonwan9 Date: 星期二, 19 八月 2025 18:11:38 +0800 Subject: [PATCH] 产品订购sql --- src/main/java/com/webmanage/service/impl/ProductPricingServiceImpl.java | 27 +++++++++++++++++++++++---- 1 files changed, 23 insertions(+), 4 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..0d59412 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); -- Gitblit v1.8.0