From 82c000e3f5c58b7c7d70af7f56e937d50701d339 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Mon, 8 Jun 2026 17:57:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E5=8F=96=E6=B6=88=E7=9A=84=E6=8A=A5?= =?UTF-8?q?=E5=90=8D=E4=B8=8D=E7=AE=97=E6=8A=A5=E5=90=8D=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YD_Event.Application/Event/EventService.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/YD_Event.Application/Event/EventService.cs b/YD_Event.Application/Event/EventService.cs index 3847250..5f828c8 100644 --- a/YD_Event.Application/Event/EventService.cs +++ b/YD_Event.Application/Event/EventService.cs @@ -150,8 +150,9 @@ public class EventService : BaseService, ITransient var output = eventInfo.Adapt(); - // 检查是否有报名记录,决定是否可以编辑项目(有报名记录时不能编辑项目和组别 - var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == id && !x.DeleteMark); + // 检查是否有报名记录,决定是否可以编辑项目(有报名记录时不能编辑项目和组别) + // 排除已取消(PaymentStatus = 4)和软删除的报名记录 + var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == id && !x.DeleteMark && x.PaymentStatus != 4); output.CanEditProject = !hasRegistration; // 1. 获取参与单位 @@ -529,8 +530,8 @@ public class EventService : BaseService, ITransient var eventInfo = await _repository.GetByIdAsync(input.Id); if (eventInfo == null) throw new InvalidOperationException("赛事不存在"); - // 检查是否有报名记录:如果有人报名,检查是否修改了项目和组别(软删除的不算) - var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == input.Id && !x.DeleteMark); + // 检查是否有报名记录:如果有人报名,检查是否修改了项目和组别(软删除和已取消的不算) + var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == input.Id && !x.DeleteMark && x.PaymentStatus != 4); if (hasRegistration) { var hasProjectOrGroupChange = await CheckIfProjectsOrGroupsChanged(input, eventInfo.Id); @@ -1071,7 +1072,8 @@ public class EventService : BaseService, ITransient [DisplayName("删除赛事")] public override async Task Delete(KeyDto dto) { - if (await _registrationRepository.IsAnyAsync(x => x.EventId == dto.Id && !x.DeleteMark)) + // 检查是否有报名记录(排除已取消和软删除的) + if (await _registrationRepository.IsAnyAsync(x => x.EventId == dto.Id && !x.DeleteMark && x.PaymentStatus != 4)) { throw new InvalidOperationException("已有人员报名此赛事,暂不支持删除"); }