Fix Bug #506: fallback修复

This commit is contained in:
2026-05-27 00:07:30 +08:00
parent 8fc6a3e5c1
commit 8412e06c7d
2 changed files with 28 additions and 34 deletions

View File

@@ -13,7 +13,9 @@ import java.util.Map;
* 门诊退号数据访问层
* 修复 Bug #506修正退号流程中多表状态更新 SQL对齐 PRD 定义
*
* 新增:支付成功后号源状态流转为“已取”(status=3)的更新方法。
* 新增:
* 1. updatePoolAfterCancel 退号后更新排班池的 version 与 booked_num。
* 2. insertRefundLog 记录退费日志,确保 refund_log 表状态与 PRD 定义保持一致。
*/
@Mapper
public interface RegistrationCancelMapper {
@@ -48,22 +50,20 @@ public interface RegistrationCancelMapper {
/**
* 更新排班池版本与已约数
* 修复点version=version+1, booked_num=booked_num-1(修正此前版本中两者写反的问题)
* 修复点version=version+1, booked_num=booked_num-1
*/
@Update("UPDATE adm_schedule_pool " +
"SET version = version + 1, " +
" booked_num = booked_num - 1 " +
"WHERE id = (SELECT pool_id FROM adm_schedule_slot WHERE order_id = #{orderId} LIMIT 1)")
int updatePoolAfterCancel(@Param("orderId") Long orderId);
"WHERE id = #{poolId}")
int updatePoolAfterCancel(@Param("poolId") Long poolId);
/**
* 支付成功后,将号源状态置为“已取”(status=3)
*
* @param orderId 关联的挂号订单ID
* @return 更新行数
* 插入退费日志
*/
@Update("UPDATE adm_schedule_slot " +
"SET status = 3 " + // 3 表示已取
"WHERE order_id = #{orderId}")
int updateSlotStatusToTaken(@Param("orderId") Long orderId);
@Insert("INSERT INTO refund_log (order_id, refund_amount, refund_time, remark) " +
"VALUES (#{orderId}, #{refundAmount}, NOW(), #{remark})")
int insertRefundLog(@Param("orderId") Long orderId,
@Param("refundAmount") BigDecimal refundAmount,
@Param("remark") String remark);
}