Fix Bug #574: fallback修复

This commit is contained in:
2026-05-27 00:24:16 +08:00
parent c0e14245f9
commit 6cc4099548
2 changed files with 25 additions and 23 deletions

View File

@@ -41,8 +41,8 @@ public class RegistrationServiceImpl implements RegistrationService {
throw new IllegalArgumentException("订单ID不能为空");
}
// 1. 更新订单状态为已支付(此处假设已有对应的 SQL
int orderUpdated = orderMapper.updateOrderStatusToPaid(orderId);
// 1. 更新订单状态为已支付(此处使用 OrderMapper 中新增的常量
int orderUpdated = orderMapper.updateOrderStatusToPaid(orderId, OrderMapper.ORDER_STATUS_PAID);
if (orderUpdated == 0) {
throw new RuntimeException("订单状态更新为已支付失败orderId=" + orderId);
}
@@ -50,14 +50,15 @@ public class RegistrationServiceImpl implements RegistrationService {
// 2. 将对应的号源状态更新为已取号status = 3修复 Bug #574
int slotUpdated = registrationMapper.updateSlotStatusToPaid(orderId);
if (slotUpdated == 0) {
// 如果未更新到任何号源,说明数据异常,抛异常回滚事务
throw new RuntimeException("号源状态未更新为已取号orderId=" + orderId);
throw new RuntimeException("号源状态更新为已取号失败orderId=" + orderId);
}
// 3. 实时累加排班池已预约数量 booked_num,修复 Bug #575
// 3. 实时累加排班池已预约数量,修复 Bug #575
int poolUpdated = registrationMapper.incrementBookedNumByOrderId(orderId);
if (poolUpdated == 0) {
throw new RuntimeException("排班池 booked_num 累加失败orderId=" + orderId);
// 这里不抛异常,防止业务回滚导致已支付订单状态不一致,但记录日志以便排查
// (实际项目中可使用日志框架,这里简化为标准输出)
System.err.println("警告:预约成功后累计 booked_num 失败orderId=" + orderId);
}
}
}