From d735f898dcc6684d2b45f9f47af43c74090bfa37 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:35:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=B5=9B=E4=BA=8B=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E5=B7=B2=E6=8A=A5?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YD_Event.Application/Event/Dtos/EventDtos.cs | 5 +++++ YD_Event.Application/Event/EventService.cs | 14 +++++++++----- YD_Event.Application/YD_Event.Application.xml | 5 +++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/YD_Event.Application/Event/Dtos/EventDtos.cs b/YD_Event.Application/Event/Dtos/EventDtos.cs index 85d20d4..7eea00f 100644 --- a/YD_Event.Application/Event/Dtos/EventDtos.cs +++ b/YD_Event.Application/Event/Dtos/EventDtos.cs @@ -553,6 +553,11 @@ public class EventDetailOutput : AddEventInput /// 退款规则详情列表 /// public List? RefundRules { get; set; } + + /// + /// 是否可以编辑项目信息(有报名记录时不能编辑项目和组别 + /// + public bool CanEditProject { get; set; } } /// diff --git a/YD_Event.Application/Event/EventService.cs b/YD_Event.Application/Event/EventService.cs index 1a7018c..3847250 100644 --- a/YD_Event.Application/Event/EventService.cs +++ b/YD_Event.Application/Event/EventService.cs @@ -150,6 +150,10 @@ public class EventService : BaseService, ITransient var output = eventInfo.Adapt(); + // 检查是否有报名记录,决定是否可以编辑项目(有报名记录时不能编辑项目和组别 + var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == id && !x.DeleteMark); + output.CanEditProject = !hasRegistration; + // 1. 获取参与单位 var units = await _unitRepository.GetListAsync(x => x.EventId == id); if (units.Any()) @@ -525,8 +529,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); + // 检查是否有报名记录:如果有人报名,检查是否修改了项目和组别(软删除的不算) + var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == input.Id && !x.DeleteMark); if (hasRegistration) { var hasProjectOrGroupChange = await CheckIfProjectsOrGroupsChanged(input, eventInfo.Id); @@ -1067,7 +1071,7 @@ public class EventService : BaseService, ITransient [DisplayName("删除赛事")] public override async Task Delete(KeyDto dto) { - if (await _registrationRepository.IsAnyAsync(x => x.EventId == dto.Id)) + if (await _registrationRepository.IsAnyAsync(x => x.EventId == dto.Id && !x.DeleteMark)) { throw new InvalidOperationException("已有人员报名此赛事,暂不支持删除"); } @@ -1188,8 +1192,8 @@ public class EventService : BaseService, ITransient throw new InvalidOperationException("请先完成参与单位配置"); } - // 检查是否有报名记录:如果有人报名,检查是否修改了项目和组别 - var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == input.EventId); + // 检查是否有报名记录:如果有人报名,检查是否修改了项目和组别(软删除的不算) + var hasRegistration = await _registrationRepository.IsAnyAsync(x => x.EventId == input.EventId && !x.DeleteMark); if (hasRegistration) { var oldEventProjects = await _eventProjectRepository.GetListAsync(x => x.EventId == input.EventId && !x.DeleteMark); diff --git a/YD_Event.Application/YD_Event.Application.xml b/YD_Event.Application/YD_Event.Application.xml index 0810be6..9a399b7 100644 --- a/YD_Event.Application/YD_Event.Application.xml +++ b/YD_Event.Application/YD_Event.Application.xml @@ -4975,6 +4975,11 @@ 退款规则详情列表 + + + 是否可以编辑项目信息(有报名记录时不能编辑项目和组别 + + 积分规则明细DTO