付款金额为0时 折扣

This commit is contained in:
2025-03-04 16:43:30 +08:00
parent c3bb6ef38e
commit cc53abccc4

View File

@@ -694,7 +694,11 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
//折扣信息
orderInfo.setDiscountInfo(buildDiscountInfo(orderInfo));
//最终折扣
orderInfo.setDiscountRatio(orderInfo.getOriginAmount().divide(param.getOrderAmount(), 2, RoundingMode.UP));
if (param.getOrderAmount().compareTo(BigDecimal.ZERO) != 0) {
orderInfo.setDiscountRatio(orderInfo.getOriginAmount().divide(param.getOrderAmount(), 2, RoundingMode.UP));
} else {
orderInfo.setDiscountRatio(BigDecimal.ZERO);
}
saveOrUpdate(orderInfo);
}