Bläddra i källkod

批量返回优惠价格

Bob 4 dagar sedan
förälder
incheckning
720758952c

+ 6 - 1
pdf-office-pdf-website/src/main/java/cn/kdan/cloud/pdf/office/website/service/impl/ProductInfoServiceImpl.java

@@ -198,7 +198,7 @@ public class ProductInfoServiceImpl implements ProductInfoService {
             throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_PRODUCT_NOT_EXIST);
         }
         // 目前只支持标准买断可以批量购买的阶梯价格 advanced-permanent
-        BigDecimal batchPrice, totalPrice, cnyBatchPrice, cnyTotalPrice;
+        BigDecimal batchPrice, totalPrice, cnyBatchPrice, cnyTotalPrice, discountPrice, cnyDiscountPrice;
         if ("advanced-permanent".equals(productVO.getCode())) {
             // 标准买断
             // 2-5	10% OFF	$107.99/个  ¥701.93/个
@@ -240,14 +240,19 @@ public class ProductInfoServiceImpl implements ProductInfoService {
         } else {
             throw new BackendRuntimeException(ExceptionEnum.EXCEPTION_PRODUCT_NOT_SUPPORT_BATCH);
         }
+        discountPrice = productVO.getPrice().multiply(BigDecimal.valueOf(num)).subtract(totalPrice);
+        cnyDiscountPrice = productVO.getCnyPrice().multiply(BigDecimal.valueOf(num)).subtract(cnyTotalPrice);
         Map<String, String> map = new HashMap<>();
         map.put("productId", productId);
+        map.put("num", String.valueOf(num));
         map.put("price", productVO.getPrice().toEngineeringString());
         map.put("cnyPrice", productVO.getCnyPrice().toEngineeringString());
         map.put("batchPrice", batchPrice.toEngineeringString());
         map.put("totalPrice", totalPrice.toEngineeringString());
+        map.put("discountPrice", discountPrice.toEngineeringString());
         map.put("cnyBatchPrice", cnyBatchPrice.toEngineeringString());
         map.put("cnyTotalPrice", cnyTotalPrice.toEngineeringString());
+        map.put("cnyDiscountPrice", cnyDiscountPrice.toEngineeringString());
         return map;
 
     }