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