fix: 优惠券使用调整

This commit is contained in:
张松
2024-11-23 10:24:21 +08:00
parent d9fc12fdeb
commit e5e3bbc9f8
2 changed files with 18 additions and 3 deletions

View File

@@ -1433,18 +1433,32 @@ public class CartService {
// 获取台桌信息
TbShopTable shopTable = getTableInfoByEatType(shopEatTypeInfoDTO);
// 获取详细的购物车信息
OrderCartInfoDTO cartInfoDTO = getCartInfoForOrder(shopEatTypeInfoDTO, cashierCartList, shopTable, tbShopUser);
// 获取订单信息
TbOrderInfo orderInfo = null;
if (cartInfoDTO.getOrderId() != null) {
OrderCartInfoDTO cartInfoDTO = null;
if (orderDTO.getOrderId() != null) {
orderInfo = mpOrderInfoMapper.selectById(cartInfoDTO.getOrderId());
if (!"unpaid".equals(orderInfo.getStatus())) {
return Result.fail("订单正在支付中,请稍后再试");
}
// 返还上次使用的券
returnCoupon(orderInfo);
cartInfoDTO = getCartInfoForOrder(shopEatTypeInfoDTO, cashierCartList, shopTable, tbShopUser);
}else {
// 获取详细的购物车信息
cartInfoDTO = getCartInfoForOrder(shopEatTypeInfoDTO, cashierCartList, shopTable, tbShopUser);
if (cartInfoDTO.getOrderId() != null) {
orderInfo = mpOrderInfoMapper.selectById(cartInfoDTO.getOrderId());
if (!"unpaid".equals(orderInfo.getStatus())) {
return Result.fail("订单正在支付中,请稍后再试");
}
// 返还上次使用的券
returnCoupon(orderInfo);
}
cartInfoDTO = getCartInfoForOrder(shopEatTypeInfoDTO, cashierCartList, shopTable, tbShopUser);
}
// 获取优惠券信息

View File

@@ -505,6 +505,7 @@ public class PayService {
orderInfo.setUserCouponId(null);
orderInfo.setUseCouponInfo(null);
orderInfo.setFullCouponDiscountAmount(BigDecimal.ZERO);
orderInfo.setProductCouponDiscountAmount(BigDecimal.ZERO);
// 修改购物车券信息
cashierCartMapper.update(null, new LambdaUpdateWrapper<TbCashierCart>()