diff --git a/YD_Event.Application/Event/Dtos/EventRecordDtos.cs b/YD_Event.Application/Event/Dtos/EventRecordDtos.cs index 0f00401..6845c98 100644 --- a/YD_Event.Application/Event/Dtos/EventRecordDtos.cs +++ b/YD_Event.Application/Event/Dtos/EventRecordDtos.cs @@ -284,6 +284,16 @@ public class CertificateListItemDTO /// 颁发时间 /// public DateTime IssuedTime { get; set; } + + /// + /// 成绩 + /// + public string? Score { get; set; } + + /// + /// 名次 + /// + public int? Rank { get; set; } } /// diff --git a/YD_Event.Application/Event/UserEventRecordService.cs b/YD_Event.Application/Event/UserEventRecordService.cs index 69c51e6..2fcf658 100644 --- a/YD_Event.Application/Event/UserEventRecordService.cs +++ b/YD_Event.Application/Event/UserEventRecordService.cs @@ -36,6 +36,7 @@ public class UserEventRecordService : IDynamicApiController, ITransient private readonly ISqlSugarRepository _projectRepository; private readonly ISqlSugarRepository _userRepository; private readonly ISqlSugarRepository _certificateRepository; + private readonly ISqlSugarRepository _eventResultRepository; private readonly ISqlSugarRepository _orderRepository; private readonly ISqlSugarRepository _eventRepository; private readonly ISqlSugarRepository _sysUserRepository; @@ -56,6 +57,7 @@ public class UserEventRecordService : IDynamicApiController, ITransient ISqlSugarRepository projectRepository, ISqlSugarRepository userRepository, ISqlSugarRepository certificateRepository, + ISqlSugarRepository eventResultRepository, ISqlSugarRepository orderRepository, ISqlSugarRepository eventRepository, ISqlSugarRepository sysUserRepository, @@ -75,6 +77,7 @@ public class UserEventRecordService : IDynamicApiController, ITransient _projectRepository = projectRepository; _userRepository = userRepository; _certificateRepository = certificateRepository; + _eventResultRepository = eventResultRepository; _orderRepository = orderRepository; _eventRepository = eventRepository; _sysUserRepository = sysUserRepository; @@ -530,6 +533,11 @@ public class UserEventRecordService : IDynamicApiController, ITransient var persons = await _registrationPersonRepository.GetListAsync(x => personIds.Contains(x.Id)); var personDict = persons.ToDictionary(x => x.Id, x => x); + // 获取成绩信息 + var resultIds = allowedCerts.Where(x => x.ResultId > 0).Select(x => x.ResultId).Distinct().ToList(); + var results = await _eventResultRepository.GetListAsync(x => resultIds.Contains(x.Id)); + var resultDict = results.ToDictionary(x => x.Id, x => x); + var result = allowedCerts.Select(cert => { // 查找对应的报名项目 - 只通过项目ID查找 @@ -561,6 +569,9 @@ public class UserEventRecordService : IDynamicApiController, ITransient } } + // 获取成绩和名次 + var resultEntity = resultDict.TryGetValue(cert.ResultId, out var r) ? r : null; + return new CertificateListItemDTO { CertificateId = cert.Id, @@ -572,7 +583,9 @@ public class UserEventRecordService : IDynamicApiController, ITransient RegistrationItemId = registrationItemId, Role = role, CertificateType = cert.CertificateType, - IssuedTime = cert.IssuedTime ?? DateTime.MinValue + IssuedTime = cert.IssuedTime ?? DateTime.MinValue, + Score = resultEntity?.Score, + Rank = resultEntity?.Rank }; }).ToList(); diff --git a/YD_Event.Application/YD_Event.Application.xml b/YD_Event.Application/YD_Event.Application.xml index 7cc9ef7..da0238b 100644 --- a/YD_Event.Application/YD_Event.Application.xml +++ b/YD_Event.Application/YD_Event.Application.xml @@ -5114,6 +5114,16 @@ 颁发时间 + + + 成绩 + + + + + 名次 + + 取消报名预览输入