预报名查询筛选

This commit is contained in:
马梓彭 2026-05-11 14:56:42 +08:00
parent e054865d27
commit 12562f962c
9 changed files with 46 additions and 11 deletions

View File

@ -913,6 +913,9 @@ public class EventClientController : IDynamicApiController
if (reg == null) throw Oops.Bah("报名记录不存在");
// 预报名记录不可见
if (reg.PaymentStatus == 5) throw Oops.Bah("报名记录不存在");
// 计算 EventStatus
EventStatus status = EventStatus.Enrolling;
var now = DateTime.Now;

View File

@ -605,7 +605,7 @@ public class MyController : IDynamicApiController
// 1. 先分页查询报名记录
var regQuery = _registrationRepository.AsQueryable()
.Where(r => r.CreatedUserId == userId && !r.DeleteMark && r.PaymentStatus != 3 && r.PaymentStatus != 4)
.Where(r => r.CreatedUserId == userId && !r.DeleteMark && r.PaymentStatus != 3 && r.PaymentStatus != 4 && r.PaymentStatus != 5)
.OrderByDescending(r => r.RegistrationTime);
var pagedRegs = await regQuery.ToPagedListAsync(input);

View File

@ -107,7 +107,7 @@ namespace YD_Event.Application.Event;
.InnerJoin<EventRegistration>((p, r) => p.RegistrationId == r.Id)
.Where((p, r) => r.EventId == eventId
&& r.PaymentStatus != 4 && r.PaymentStatus != 3 // 排除已取消的报名
&& r.PaymentStatus != 3 // 排除已退款的报名
&& r.PaymentStatus != 5 // 排除预报名记录
&& !p.DeleteMark // 排除已删除的人员
&& p.PersonType == PersonType.Athlete) // 只统计运动员
.GroupBy((p, r) => new { p.ProjectId, p.GroupName })
@ -119,6 +119,7 @@ namespace YD_Event.Application.Event;
.InnerJoin<EventRegistration>((p, r) => p.RegistrationId == r.Id)
.Where((p, r) => r.EventId == eventId
&& r.PaymentStatus != 4 && r.PaymentStatus != 3
&& r.PaymentStatus != 5 // 排除预报名记录
&& !p.DeleteMark
&& p.PersonType == PersonType.Athlete
&& r.TeamName != null)
@ -284,6 +285,7 @@ namespace YD_Event.Application.Event;
.InnerJoin<EventRegistration>((p, r) => p.RegistrationId == r.Id)
.Where((p, r) => r.EventId == eventId
&& r.PaymentStatus != 4 && r.PaymentStatus != 3
&& r.PaymentStatus != 5 // 排除预报名记录
&& !p.DeleteMark
&& p.PersonType == PersonType.Athlete)
.GroupBy((p, r) => new { p.ProjectId, p.GroupName })
@ -295,6 +297,7 @@ namespace YD_Event.Application.Event;
.InnerJoin<EventRegistration>((p, r) => p.RegistrationId == r.Id)
.Where((p, r) => r.EventId == eventId
&& r.PaymentStatus != 4 && r.PaymentStatus != 3
&& r.PaymentStatus != 5 // 排除预报名记录
&& !p.DeleteMark
&& p.PersonType == PersonType.Athlete
&& r.TeamName != null)
@ -325,6 +328,7 @@ namespace YD_Event.Application.Event;
.InnerJoin<EventRegistration>((p, r) => p.RegistrationId == r.Id)
.Where((p, r) => p.ProjectId == eventProj.Id
&& r.PaymentStatus != 4 && r.PaymentStatus != 3
&& r.PaymentStatus != 5 // 排除预报名记录
&& !p.DeleteMark
&& p.PersonType == PersonType.Athlete)
.OrderBy(p => p.GroupName)

View File

@ -86,6 +86,7 @@ public class EventRecordService : BaseService<EventRegistration>, ITransient
.LeftJoin<AppUserEntity>((r, e, u) => r.CreatedUserId == u.Id)
.LeftJoin<SysUserEntity>((r, e, u, s) => r.CreatedUserId == s.Id)
.LeftJoin<MerchantEntity>((r, e, u, s, m) => r.CreatedUserId == m.CreatedUserId)
.Where((r, e, u, s, m) => r.PaymentStatus != 5) // 排除预报名记录
.WhereIF(!string.IsNullOrWhiteSpace(input.EventName), (r, e, u, s, m) => e.EventName.Contains(input.EventName))
.WhereIF(input.StartTime.HasValue, (r, e, u, s, m) => e.MatchStartTime >= input.StartTime)
.WhereIF(input.EndTime.HasValue, (r, e, u, s, m) => e.MatchStartTime <= input.EndTime)

View File

@ -66,7 +66,7 @@ public class EventRegistrationService : BaseService<EventRegistration>, ITransie
public async Task<PageResult<RegistrationListOutput>> Page(RegistrationQueryInput input)
{
var query = _repository.AsQueryable()
.Where(x => x.PaymentStatus != 4 && x.PaymentStatus != 3) // 过滤掉已取消和已退款的报名记录
.Where(x => x.PaymentStatus != 4 && x.PaymentStatus != 3 && x.PaymentStatus != 5) // 过滤掉已取消、已退款和预报名的记录
.WhereIF(input.EventId.HasValue, x => x.EventId == input.EventId)
.WhereIF(input.RegistrationMode.HasValue, x => x.RegistrationMode == input.RegistrationMode)
.WhereIF(!string.IsNullOrWhiteSpace(input.UnitName), x => x.TeamName.Contains(input.UnitName))
@ -490,7 +490,7 @@ public class EventRegistrationService : BaseService<EventRegistration>, ITransie
public async Task<byte[]> Export(RegistrationQueryInput input)
{
var registrations = await _repository.AsQueryable()
.Where(x => x.PaymentStatus != 4 && x.PaymentStatus != 3) // 过滤掉已取消和已退款的报名记录
.Where(x => x.PaymentStatus != 4 && x.PaymentStatus != 3 && x.PaymentStatus != 5) // 过滤掉已取消、已退款和预报名的记录
.WhereIF(input.EventId.HasValue, x => x.EventId == input.EventId)
.WhereIF(input.RegistrationMode.HasValue, x => x.RegistrationMode == input.RegistrationMode)
.WhereIF(!string.IsNullOrWhiteSpace(input.UnitName), x => x.TeamName.Contains(input.UnitName))

View File

@ -133,6 +133,7 @@ public class EventScoreService : BaseService<EventResult>, ITransient
.Where((p, r, res, c) => r.EventId == input.EventId
&& r.PaymentStatus != 3 // 排除已退款的报名
&& r.PaymentStatus != 4 // 排除已取消的报名
&& r.PaymentStatus != 5 // 排除预报名记录
&& (p.PersonType == PersonType.Athlete || p.PersonType == PersonType.User));
// 应用筛选条件
@ -338,7 +339,9 @@ public class EventScoreService : BaseService<EventResult>, ITransient
// 步骤1:获取该赛事的所有运动员的 UserId
var athleteUserIds = await _personRepository.AsQueryable()
.InnerJoin<EventRegistration>((p, r) => p.RegistrationId == r.Id)
.Where((p, r) => r.EventId == input.EventId && p.PersonType == PersonType.Athlete && !p.DeleteMark)
.Where((p, r) => r.EventId == input.EventId
&& r.PaymentStatus != 5 // 排除预报名记录
&& p.PersonType == PersonType.Athlete && !p.DeleteMark)
.Select(p => p.UserId)
.ToListAsync();
@ -378,7 +381,9 @@ public class EventScoreService : BaseService<EventResult>, ITransient
// 这样可以获取到 EventRegistrationPerson.Id 用于证书发放
var existingPersons = await _personRepository.AsQueryable()
.InnerJoin<EventRegistration>((p, r) => p.RegistrationId == r.Id)
.Where((p, r) => r.EventId == input.EventId && coachLeaderUserIds.Contains(p.UserId) && p.PersonType == input.PersonType && !p.DeleteMark)
.Where((p, r) => r.EventId == input.EventId
&& r.PaymentStatus != 5 // 排除预报名记录
&& coachLeaderUserIds.Contains(p.UserId) && p.PersonType == input.PersonType && !p.DeleteMark)
.LeftJoin<YD_Event.Core.Entities.AppUser>((p, r, u) => p.UserId == u.Id)
.Select((p, r, u) => new
{
@ -893,7 +898,9 @@ public class EventScoreService : BaseService<EventResult>, ITransient
var relatedAthleteRegistrations = await _personRepository.AsQueryable()
.InnerJoin<EventRegistration>((p, r) => p.RegistrationId == r.Id)
.InnerJoin<TeamMember>((p, r, tm) => p.UserId == tm.UserId)
.Where((p, r, tm) => r.EventId == input.EventId && teamIds.Contains(tm.TeamId) && !p.DeleteMark)
.Where((p, r, tm) => r.EventId == input.EventId
&& r.PaymentStatus != 5 // 排除预报名记录
&& teamIds.Contains(tm.TeamId) && !p.DeleteMark)
.Select((p, r) => r)
.ToListAsync();

View File

@ -179,7 +179,7 @@ public class UnifiedRegistrationService : ITransient
registration.TeamName = input.RegistrationMode == 2 ? input.TeamName : null;
registration.ContactName = input.ContactName;
registration.ContactPhone = input.ContactPhone;
registration.PaymentStatus = 0;
registration.PaymentStatus = 5; // 5=待支付确认,不占用正式名额
registration.OrderNo = string.Empty; // 清空旧的订单号,确保重新生成新订单
registration.UpdatedTime = DateTime.Now;
registration.UpdatedUserId = input.CreatedUserId;

View File

@ -109,9 +109,11 @@ public class UserEventRecordService : IDynamicApiController, ITransient
// - 免费赛事:直接显示
// - 线下支付时:显示未支付(0)和已支付(1)状态的数据
// - 线上支付时:仅显示已支付(1)状态的数据
// - 排除预报名记录(5),仅在支付成功后才可见
.Where((r, e, fc) =>
r.PaymentStatus != 3 && // 排除已退款的报名
r.PaymentStatus != 4 && // 排除已取消的报名
r.PaymentStatus != 5 && // 排除预报名记录
((e.ChargeMode == ChargeMode.Free) ||
(r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1)) ||
(r.PaymentMethod == 2 && r.PaymentStatus == 1)))
@ -646,6 +648,9 @@ public class UserEventRecordService : IDynamicApiController, ITransient
var userId = _authManager.UserId;
var registration = await _registrationRepository.GetFirstAsync(x => x.Id == registrationId && x.CreatedUserId == userId);
if (registration == null) throw Oops.Bah("报名记录不存在");
// 预报名记录不可见
if (registration.PaymentStatus == 5) throw Oops.Bah("报名记录不存在");
// 获取赛事信息
var eventInfo = await _eventRepository.GetByIdAsync(registration.EventId);

View File

@ -2792,9 +2792,19 @@
退款原因
</summary>
</member>
<member name="P:YD_Event.Application.Client.Dtos.CancelRegistrationRefundInput.CancelItemIds">
<member name="P:YD_Event.Application.Client.Dtos.CancelRegistrationRefundInput.CancelType">
<summary>
取消的项目ID列表(可选,用于部分取消)
取消类型:0-全部取消,1-部分取消
</summary>
</member>
<member name="P:YD_Event.Application.Client.Dtos.CancelRegistrationRefundInput.PersonIds">
<summary>
取消的人员ID列表(部分取消时使用)
</summary>
</member>
<member name="P:YD_Event.Application.Client.Dtos.CancelRegistrationRefundInput.CancelTeams">
<summary>
取消的团队Key列表(部分取消时使用)
</summary>
</member>
<member name="T:YD_Event.Application.Client.Dtos.MiniProgramLoginInput">
@ -3701,6 +3711,11 @@
<param name="input">上传素材输入参数</param>
<returns>操作是否成功</returns>
</member>
<member name="M:YD_Event.Application.Client.EventClientController.CalculateRefundAmount(YD_Event.Application.Event.Dtos.CalculateRefundAmountInput)">
<summary>
计算退款金额
</summary>
</member>
<member name="M:YD_Event.Application.Client.EventClientController.CancelRegistrationRefund(YD_Event.Application.Client.Dtos.CancelRegistrationRefundInput)">
<summary>
取消报名并申请退款
@ -8719,7 +8734,7 @@
<member name="T:YD_Event.Application.Event.EventStatusUpdateService">
<summary>
赛事状态自动更新后台服务
每5分钟执行一次,自动更新赛事状态
每10秒执行一次,自动更新赛事状态
</summary>
</member>
<member name="M:YD_Event.Application.Event.EventStatusUpdateService.CalculateEventStatus(YD_Event.Core.Entities.EventInfo,System.DateTime)">