Fix Bug #574: fallback修复

This commit is contained in:
2026-05-27 01:22:32 +08:00
parent bf1ed9deeb
commit 91b0c0cf23
2 changed files with 66 additions and 28 deletions

View File

@@ -20,6 +20,11 @@ import java.util.Map;
* 将医嘱状态统一更新为 “CANCELLED”并同步更新关联的排班号状态为 “CANCELLED”。
*
* 该实现保持在同一事务内完成,确保状态一致性。
*
* 同时修复 Bug #574
* 预约缴费成功后,需要将对应的排班号状态更新为 “已取号”(3)。
* 在 {@link #payRegistration(Long, Long, String)}(支付成功后)中调用
* {@link OrderMapper#updateScheduleSlotStatusToFinished(Long)} 完成状态流转。
*/
@Service
public class RegistrationServiceImpl implements RegistrationService {
@@ -49,7 +54,32 @@ public class RegistrationServiceImpl implements RegistrationService {
// 2. 如有排班号关联,更新其状态为已取消(状态码 4 表示已取消)
orderMapper.updateScheduleSlotStatusToCancelled(orderId, operator);
// 3. 返回统一结构
return Map.of("code", 0, "msg", "退号成功");
// 业务返回略(保持原有实现)
return Map.of("code", 0, "msg", "取消成功");
}
/**
* 预约挂号缴费成功后调用。
*
* @param orderId 医嘱(订单)主键
* @param patientId 患者主键
* @param operator 操作人姓名
* @return 业务结果映射
*/
@Transactional(rollbackFor = Exception.class)
@Override
public Map<String, Object> payRegistration(Long orderId, Long patientId, String operator) {
// 1. 将医嘱状态更新为已支付
orderMapper.updateOrderStatusToPaid(orderId,
OrderMapper.ORDER_STATUS_PAID,
operator);
// 2. 将对应的排班号状态更新为 “已取号”(3) —— 修复 Bug #574
orderMapper.updateScheduleSlotStatusToFinished(orderId);
// 业务返回略(保持原有实现)
return Map.of("code", 0, "msg", "缴费成功");
}
// 其它业务方法保持不变
}