From b3c51ff79d55d22fd5893e607847d925eb031859 Mon Sep 17 00:00:00 2001 From: Timmy Zhang Date: Thu, 16 Apr 2020 22:23:25 +0800 Subject: [PATCH] fix the bug of retrieve userCouponId (#371) the original logic is wrong, it will just get the last coupon item of a user, mismatch the couponId and discount. --- .../org/linlinjava/litemall/wx/web/WxCartController.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCartController.java b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCartController.java index f1d933c4..fecc2b20 100644 --- a/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCartController.java +++ b/litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxCartController.java @@ -469,8 +469,7 @@ public class WxCartController { int tmpCouponLength = 0; List couponUserList = couponUserService.queryAll(userId); for(LitemallCouponUser couponUser : couponUserList){ - tmpUserCouponId = couponUser.getId(); - LitemallCoupon coupon = couponVerifyService.checkCoupon(userId, couponUser.getCouponId(), tmpUserCouponId, checkedGoodsPrice); + LitemallCoupon coupon = couponVerifyService.checkCoupon(userId, couponUser.getCouponId(), couponUser.getId(), checkedGoodsPrice); if(coupon == null){ continue; } @@ -479,6 +478,7 @@ public class WxCartController { if(tmpCouponPrice.compareTo(coupon.getDiscount()) == -1){ tmpCouponPrice = coupon.getDiscount(); tmpCouponId = coupon.getId(); + tmpUserCouponId = couponUser.getId(); } } // 获取优惠券减免金额,优惠券可用数量 @@ -541,4 +541,4 @@ public class WxCartController { data.put("checkedGoodsList", checkedGoodsList); return ResponseUtil.ok(data); } -} \ No newline at end of file +}