Fix Bug #574: fallback修复
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user