证书列表返回成绩和名次
This commit is contained in:
parent
aa31a153a2
commit
e0e4f02f9e
@ -284,6 +284,16 @@ public class CertificateListItemDTO
|
||||
/// 颁发时间
|
||||
/// </summary>
|
||||
public DateTime IssuedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成绩
|
||||
/// </summary>
|
||||
public string? Score { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名次
|
||||
/// </summary>
|
||||
public int? Rank { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -36,6 +36,7 @@ public class UserEventRecordService : IDynamicApiController, ITransient
|
||||
private readonly ISqlSugarRepository<YD_Event.Core.Entities.Project> _projectRepository;
|
||||
private readonly ISqlSugarRepository<YD_Event.Core.Entities.AppUser> _userRepository;
|
||||
private readonly ISqlSugarRepository<EventCertificate> _certificateRepository;
|
||||
private readonly ISqlSugarRepository<EventResult> _eventResultRepository;
|
||||
private readonly ISqlSugarRepository<YD_Event.Core.Entities.Order> _orderRepository;
|
||||
private readonly ISqlSugarRepository<EventInfo> _eventRepository;
|
||||
private readonly ISqlSugarRepository<SysUser> _sysUserRepository;
|
||||
@ -56,6 +57,7 @@ public class UserEventRecordService : IDynamicApiController, ITransient
|
||||
ISqlSugarRepository<YD_Event.Core.Entities.Project> projectRepository,
|
||||
ISqlSugarRepository<YD_Event.Core.Entities.AppUser> userRepository,
|
||||
ISqlSugarRepository<EventCertificate> certificateRepository,
|
||||
ISqlSugarRepository<EventResult> eventResultRepository,
|
||||
ISqlSugarRepository<YD_Event.Core.Entities.Order> orderRepository,
|
||||
ISqlSugarRepository<EventInfo> eventRepository,
|
||||
ISqlSugarRepository<SysUser> 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();
|
||||
|
||||
|
||||
@ -5114,6 +5114,16 @@
|
||||
颁发时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.CertificateListItemDTO.Score">
|
||||
<summary>
|
||||
成绩
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:YD_Event.Application.Event.Dtos.CertificateListItemDTO.Rank">
|
||||
<summary>
|
||||
名次
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:YD_Event.Application.Event.Dtos.CancelPreviewInput">
|
||||
<summary>
|
||||
取消报名预览输入
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user