From cec511e4a14931ed67d09292fbbb01fe5126e5cf Mon Sep 17 00:00:00 2001
From: lisy <linlangsur163@163.com>
Date: 星期一, 07 八月 2023 18:59:28 +0800
Subject: [PATCH] app端:优惠券的规则字段处理

---
 cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
index 081772c..75a7ffd 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
@@ -221,9 +221,10 @@
                 return ResultUtil.error("优惠券已过期");
             }
             if(coupon.getType() == 1){//满减
+//                {"conditionalAmount":50,"deductionAmount":10,"experienceName":""}
                 JSONObject jsonObject = JSON.parseObject(coupon.getContent());
-                Double num1 = jsonObject.getDouble("num1");
-                Double num2 = jsonObject.getDouble("num2");
+                Double num1 = jsonObject.getDouble("conditionalAmount");
+                Double num2 = jsonObject.getDouble("deductionAmount");
                 if(payMoney.compareTo(num1) <= 0){
                     return ResultUtil.error("该优惠券无法使用");
                 }
@@ -232,7 +233,7 @@
             }
             if(coupon.getType() == 2){//代金券
                 JSONObject jsonObject = JSON.parseObject(coupon.getContent());
-                Double num1 = jsonObject.getDouble("num1");
+                Double num1 = jsonObject.getDouble("conditionalAmount");
                 if(payMoney.compareTo(num1) <= 0){
                     return ResultUtil.error("该优惠券无法使用");
                 }
@@ -545,14 +546,15 @@
             UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(),appUser.getId()));
             Coupon coupon = couponClient.queryCouponById(userCoupon.getCouponId());
             if(coupon.getType() == 1){//满减
+//                {"conditionalAmount":50,"deductionAmount":10,"experienceName":""}
                 JSONObject jsonObject = JSON.parseObject(coupon.getContent());
-                Double num1 = jsonObject.getDouble("num1");
-                Double num2 = jsonObject.getDouble("num2");
+                Double num1 = jsonObject.getDouble("conditionalAmount");
+                Double num2 = jsonObject.getDouble("deductionAmount");
                 payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
             }
             if(coupon.getType() == 2){//代金券
                 JSONObject jsonObject = JSON.parseObject(coupon.getContent());
-                Double num1 = jsonObject.getDouble("num1");
+                Double num1 = jsonObject.getDouble("conditionalAmount");
                 payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
             }
             userCoupon.setStatus(2);
@@ -610,14 +612,15 @@
             UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(),siteBooking.getAppUserId()));
             Coupon coupon = couponClient.queryCouponById(userCoupon.getCouponId());
             if(coupon.getType() == 1){//满减
+//                {"conditionalAmount":50,"deductionAmount":10,"experienceName":""}
                 JSONObject jsonObject = JSON.parseObject(coupon.getContent());
-                Double num1 = jsonObject.getDouble("num1");
-                Double num2 = jsonObject.getDouble("num2");
+                Double num1 = jsonObject.getDouble("conditionalAmount");
+                Double num2 = jsonObject.getDouble("deductionAmount");
                 payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
             }
             if(coupon.getType() == 2){//代金券
                 JSONObject jsonObject = JSON.parseObject(coupon.getContent());
-                Double num1 = jsonObject.getDouble("num1");
+                Double num1 = jsonObject.getDouble("conditionalAmount");
                 payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
             }
         }

--
Gitblit v1.7.1