From f285c439a8d7b4219ff85daaa7afd2d4767159e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Mon, 20 Apr 2026 14:34:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=9B=E4=BA=8B=E8=AE=B0=E5=BD=95=E6=9B=B4?= =?UTF-8?q?=E6=8D=A2=E9=98=9F=E5=91=98=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Event/Dtos/UserCompetitionDtos.cs | 5 +++++ .../Event/UnifiedRegistrationService.cs | 12 ++++++++++-- YD_Event.Application/Event/UserEventRecordService.cs | 2 +- YD_Event.Application/YD_Event.Application.xml | 7 ++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/YD_Event.Application/Event/Dtos/UserCompetitionDtos.cs b/YD_Event.Application/Event/Dtos/UserCompetitionDtos.cs index 1427242..e4a746a 100644 --- a/YD_Event.Application/Event/Dtos/UserCompetitionDtos.cs +++ b/YD_Event.Application/Event/Dtos/UserCompetitionDtos.cs @@ -1137,6 +1137,11 @@ public class RegistrationLimitCheckInput /// 组别ID列表 (旧结构,向后兼容) /// public List GroupIds { get; set; } + + /// + /// 要排除的报名ID(更换队员时使用,排除当前正在更新的报名记录) + /// + public long? ExcludeRegistrationId { get; set; } } /// diff --git a/YD_Event.Application/Event/UnifiedRegistrationService.cs b/YD_Event.Application/Event/UnifiedRegistrationService.cs index 7a0effb..6d37ab2 100644 --- a/YD_Event.Application/Event/UnifiedRegistrationService.cs +++ b/YD_Event.Application/Event/UnifiedRegistrationService.cs @@ -1125,7 +1125,7 @@ public class UnifiedRegistrationService : ITransient /// /// 检查报名限制 /// - public async Task CheckRegistrationLimitAsync(UnifiedRegistrationInput input) + public async Task CheckRegistrationLimitAsync(UnifiedRegistrationInput input, long? excludeRegistrationId = null) { var result = new RegistrationLimitCheckOutput { @@ -1144,13 +1144,21 @@ public class UnifiedRegistrationService : ITransient // 先获取所有报名信息,供后续检查使用 // 线上支付类型的报名记录,仅统计PaymentStatus == 1(已支付)的记录 // 线下支付类型的报名记录,同时统计PaymentStatus == 1(已支付)和PaymentStatus == 0(未支付)的记录 - var eventRegistrations = await _registrationRepository.GetListAsync(x => + var eventRegistrationsQuery = _registrationRepository.AsQueryable().Where(x => x.EventId == input.EventId && !x.DeleteMark && ( (x.PaymentMethod == 2 && x.PaymentStatus == 1) || (x.PaymentMethod == 1 && x.PaymentStatus == 1) || (x.PaymentMethod == 1 && x.PaymentStatus == 0) )); + + // 如果指定了要排除的报名ID,则排除该记录 + if (excludeRegistrationId.HasValue) + { + eventRegistrationsQuery = eventRegistrationsQuery.Where(x => x.Id != excludeRegistrationId.Value); + } + + var eventRegistrations = await eventRegistrationsQuery.ToListAsync(); var eventRegistrationIds = eventRegistrations.Select(r => r.Id).ToList(); var registrationPersons = await _registrationPersonRepository.GetListAsync(x => eventRegistrationIds.Contains(x.RegistrationId) && !x.DeleteMark); diff --git a/YD_Event.Application/Event/UserEventRecordService.cs b/YD_Event.Application/Event/UserEventRecordService.cs index 780a3fe..723d2d9 100644 --- a/YD_Event.Application/Event/UserEventRecordService.cs +++ b/YD_Event.Application/Event/UserEventRecordService.cs @@ -907,6 +907,6 @@ public class UserEventRecordService : IDynamicApiController, ITransient } // 调用统一的限制检查方法 - return await _unifiedRegistrationService.CheckRegistrationLimitAsync(unifiedInput); + return await _unifiedRegistrationService.CheckRegistrationLimitAsync(unifiedInput, input.ExcludeRegistrationId); } } diff --git a/YD_Event.Application/YD_Event.Application.xml b/YD_Event.Application/YD_Event.Application.xml index 55befc9..d21143d 100644 --- a/YD_Event.Application/YD_Event.Application.xml +++ b/YD_Event.Application/YD_Event.Application.xml @@ -7491,6 +7491,11 @@ 组别ID列表 (旧结构,向后兼容) + + + 要排除的报名ID(更换队员时使用,排除当前正在更新的报名记录) + + 报名限制详情 @@ -8208,7 +8213,7 @@ 处理线下支付 - + 检查报名限制