优惠券 门槛金额校验问题
This commit is contained in:
parent
2aa5064d5f
commit
d3018a1536
|
|
@ -393,7 +393,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
if (coupon.getOtherCouponShare() != 1) {
|
||||
otherCouponShare.set(false);
|
||||
}
|
||||
if (coupon.getFullAmount().compareTo(totalAmount.getPrice()) > 0) {
|
||||
if (coupon.getFullAmount().compareTo(BigDecimal.ZERO) > 0 && coupon.getFullAmount().compareTo(totalAmount.getPrice()) > 0) {
|
||||
throw new ValidateException("生成支付订单失败,商品券:" + coupon + " 未达到使用门槛" + coupon.getFullAmount() + "元");
|
||||
}
|
||||
boolean isAllFoods = true;
|
||||
|
|
@ -432,7 +432,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
if (type == 3) {
|
||||
BigDecimal rate = new BigDecimal(record.getDiscountRate());
|
||||
rateAmount.setPrice(rate.multiply(totalAmount.getPrice().subtract(tempAmount.getPrice()).subtract(prodCouponAmount.getPrice())).setScale(2, RoundingMode.DOWN));
|
||||
if (rateAmount.getPrice().compareTo(coupon.getMaxDiscountAmount()) > 0) {
|
||||
if (coupon.getMaxDiscountAmount().compareTo(BigDecimal.ZERO) > 0 && rateAmount.getPrice().compareTo(coupon.getMaxDiscountAmount()) > 0) {
|
||||
rateAmount.setPrice(coupon.getMaxDiscountAmount());
|
||||
}
|
||||
} else {
|
||||
|
|
@ -690,6 +690,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
* @param couponFoodIds 门槛商品
|
||||
*/
|
||||
private void thresholdCalculate(List<OrderDetail> orderDetails, boolean isAllFoods, List<Long> couponFoodIds, BigDecimal thresholdAmount) {
|
||||
if (thresholdAmount.compareTo(BigDecimal.ZERO) == 0) {
|
||||
return;
|
||||
}
|
||||
BigDecimal foodsAmount = BigDecimal.ZERO;
|
||||
for (OrderDetail detail : orderDetails) {
|
||||
if ((isAllFoods || couponFoodIds.contains(detail.getProductId())) || couponFoodIds.contains(detail.getProductId())
|
||||
|
|
|
|||
Loading…
Reference in New Issue