Fix Bug #574: AI修复

This commit is contained in:
2026-05-27 03:40:03 +08:00
parent 911b7ddc00
commit 48b227629f
2 changed files with 51 additions and 51 deletions

View File

@@ -58,63 +58,34 @@ public class RegistrationServiceImpl implements RegistrationService {
// 更新明细表状态
registrationDetailMapper.updateStatusByMainId(registrationId, RegistrationStatus.CANCELLED.getCode());
log.info("挂号退号成功registrationId={}", registrationId);
}
/**
* 预约成功后累计已预约数量Bug #575
* 预约签到缴费成功处理
* 修复 Bug #574缴费成功后及时将号源状态流转为 3已取号
*
* @param registrationId 挂号主记录ID
* @param slotId 关联的排班号源ID
*/
@Transactional
@Override
public void confirmAppointment(Long registrationId) {
public void handleCheckInAndPaymentSuccess(Long registrationId, Long slotId) {
Registration reg = registrationMapper.selectById(registrationId);
if (reg == null) {
throw new BusinessException("挂号记录不存在");
}
Long slotId = reg.getScheduleSlotId();
if (slotId == null) {
throw new BusinessException("挂号未关联号源");
}
// 1. 更新挂号主表状态为已签到/已缴费
registrationMapper.updateStatus(registrationId, RegistrationStatus.CHECKED_IN.getCode());
// 累加已预约数
scheduleSlotMapper.incrementBookedNum(slotId, 1);
log.info("预约成功slotId={} 已预约数+1", slotId);
}
/**
* 预约签到缴费成功后,同步更新号源状态为 “已取”(3)Bug #574
*
* 该方法在业务流程的缴费成功回调中被调用。
*
* @param registrationId 对应的挂号主键
*/
@Transactional
@Override
public void handlePaymentSuccess(Long registrationId) {
// 1. 更新挂号主表的支付状态(此处仅示例,实际实现请参考业务需求)
registrationMapper.updatePaymentStatus(registrationId, true);
// 2. 获取关联的号源 ID
Registration reg = registrationMapper.selectById(registrationId);
if (reg == null) {
throw new BusinessException("挂号记录不存在");
}
Long slotId = reg.getScheduleSlotId();
if (slotId == null) {
log.warn("挂号 {} 未关联号源,跳过状态流转", registrationId);
return;
}
// 3. 将号源状态更新为 3已取
int rows = scheduleSlotMapper.updateStatus(slotId, 3);
if (rows == 0) {
log.warn("更新号源状态失败slotId={}", slotId);
} else {
log.info("号源状态已流转为已取slotId={}", slotId);
// 2. 修复 Bug #574同步更新 adm_schedule_slot.status 为 3已取
if (slotId != null) {
int updatedRows = scheduleSlotMapper.updateStatus(slotId, 3);
if (updatedRows == 0) {
log.warn("预约签到缴费成功但更新号源状态失败slotId: {}", slotId);
} else {
log.info("预约签到缴费成功,号源状态已更新为 3slotId: {}", slotId);
}
}
}
// 其余业务方法保持不变...
}