| | |
| | | couponType = appMemberCouponVo.getCouponType(); |
| | | if (couponType == 1 && appMemberCouponVo.getMoneyThreshold() != null && appMemberCouponVo.getDiscountMoney() != null) { |
| | | moneyThreshold = appMemberCouponVo.getMoneyThreshold(); |
| | | if (goodsTotalPrice.compareTo(moneyThreshold) >= 0) { |
| | | discountMoney = appMemberCouponVo.getDiscountMoney(); |
| | | discountMoney = appMemberCouponVo.getDiscountMoney(); |
| | | if (goodsTotalPrice.compareTo(moneyThreshold) >= 0 && goodsTotalPrice.compareTo(discountMoney)>0) { |
| | | goodsRealPrice = goodsTotalPrice.subtract(discountMoney); |
| | | useCoupon = 1; |
| | | userCouponIdSet.add(memberCouponId); |
| | |
| | | appSureOrderGoodsVo.setMemberCouponId(memberCouponId); |
| | | } else if (couponType == 3 && appMemberCouponVo.getDiscountMoney() != null) { |
| | | discountMoney = appMemberCouponVo.getDiscountMoney(); |
| | | goodsRealPrice = goodsTotalPrice.subtract(discountMoney); |
| | | if(goodsRealPrice.compareTo(BigDecimal.ZERO)<0){ |
| | | goodsRealPrice = BigDecimal.ZERO; |
| | | if(goodsTotalPrice.compareTo(discountMoney)>0){ |
| | | goodsRealPrice = goodsTotalPrice.subtract(discountMoney); |
| | | if(goodsRealPrice.compareTo(BigDecimal.ZERO)<0){ |
| | | goodsRealPrice = BigDecimal.ZERO; |
| | | } |
| | | useCoupon = 1; |
| | | userCouponIdSet.add(memberCouponId); |
| | | appSureOrderGoodsVo.setMemberCouponId(memberCouponId); |
| | | } |
| | | useCoupon = 1; |
| | | userCouponIdSet.add(memberCouponId); |
| | | appSureOrderGoodsVo.setMemberCouponId(memberCouponId); |
| | | } |
| | | } |
| | | } |
| | |
| | | appGoodsMemberCouponVoList = new ArrayList<>(); |
| | | for(AppMemberCouponVo entity : appMemberCouponVoList){ |
| | | if(StringUtils.isBlank(entity.getRelGoodsIds())||entity.getRelGoodsIds().contains(sureOrderGoodsVo.getGoodsId())){ |
| | | if(entity.getCouponType()!=1){ |
| | | if(entity.getCouponType()==1){ |
| | | if(entity.getMoneyThreshold().compareTo(sureOrderGoodsVo.getGoodsTotalPrice())<0&&entity.getDiscountMoney().compareTo(sureOrderGoodsVo.getGoodsTotalPrice())<0){ |
| | | appGoodsMemberCouponVoList.add(entity); |
| | | } |
| | | }else if(entity.getCouponType()==2){ |
| | | appGoodsMemberCouponVoList.add(entity); |
| | | }else{ |
| | | if(entity.getMoneyThreshold().compareTo(sureOrderGoodsVo.getGoodsTotalPrice())<0){ |
| | | }else if(entity.getCouponType()==3){ |
| | | if(entity.getDiscountMoney().compareTo(sureOrderGoodsVo.getGoodsTotalPrice())<0){ |
| | | appGoodsMemberCouponVoList.add(entity); |
| | | } |
| | | } |