扣减后 为0的情况 处理

This commit is contained in:
2025-09-28 17:01:33 +08:00
parent 25f3bea5fe
commit ed35c0a6be

View File

@@ -491,6 +491,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
newTotalAmount = newTotalAmount.subtract(param.getRoundAmount());
//校验最终金额(订单金额 (扣除各类折扣)+打包费 餐位费)
newTotalAmount = newTotalAmount.add(packAmount.getPrice()).add(orderInfo.getSeatAmount());
if (newTotalAmount.compareTo(BigDecimal.ZERO) <= 0) {
newTotalAmount = BigDecimal.ZERO;
}
if (newTotalAmount.compareTo(param.getOrderAmount()) != 0) {
log.info("支付计算金额不正确订单Id:{},最终计算金额为:{},打包费:{},餐位费:{},积分抵扣金额:{},抹零金额:{}",
orderInfo.getId(), newTotalAmount, packAmount.getPrice(), orderInfo.getSeatAmount(),
@@ -1150,7 +1153,11 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
//0元按照现金支付处理
if (orderInfo.getOrderAmount().compareTo(BigDecimal.ZERO) == 0) {
orderInfo.setStatus(OrderStatusEnums.DONE.getCode());
orderInfo.setPayType(PayEnums.CASH_PAY.getValue());
if (param.getPointsDiscountAmount().compareTo(BigDecimal.ZERO) > 0) {
orderInfo.setPayType(PayEnums.VIP_PAY.getValue());
}else {
orderInfo.setPayType(PayEnums.CASH_PAY.getValue());
}
orderInfo.setPaidTime(LocalDateTime.now());
if (orderInfo.getUserId() != null) {
ShopUser shopUser = shopUserService.getShopUserInfo(orderInfo.getShopId(), orderInfo.getUserId());