diff --git a/YD_Event.Application/Client/EventClientController.cs b/YD_Event.Application/Client/EventClientController.cs index ef69f49..615bbdb 100644 --- a/YD_Event.Application/Client/EventClientController.cs +++ b/YD_Event.Application/Client/EventClientController.cs @@ -262,7 +262,8 @@ public class EventClientController : IDynamicApiController { var userId = GetCurrentUserId(); isRegistered = await _registrationRepository.IsAnyAsync(r => - r.EventId == id && r.CreatedUserId == userId && r.PaymentStatus != 4 && r.PaymentStatus == 1); + r.EventId == id && r.CreatedUserId == userId && + ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1)))); } catch { @@ -855,8 +856,9 @@ public class EventClientController : IDynamicApiController var query = _registrationRepository.AsQueryable() .LeftJoin((r, e) => r.EventId == e.Id) - // 只显示未取消的报名,排除 PaymentStatus=3(已退款/已取消)的记录 - .Where(r => r.CreatedUserId == userId && !r.DeleteMark && r.PaymentStatus == 1) + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + .Where(r => r.CreatedUserId == userId && !r.DeleteMark && + ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1)))) .OrderByDescending(r => r.RegistrationTime) .Select((r, e) => new MyEventListDto { diff --git a/YD_Event.Application/Client/MyController.cs b/YD_Event.Application/Client/MyController.cs index 4e222d2..00ab16f 100644 --- a/YD_Event.Application/Client/MyController.cs +++ b/YD_Event.Application/Client/MyController.cs @@ -605,7 +605,8 @@ public class MyController : IDynamicApiController // 1. 先分页查询报名记录 var regQuery = _registrationRepository.AsQueryable() - .Where(r => r.CreatedUserId == userId && !r.DeleteMark && r.PaymentStatus != 3 && r.PaymentStatus != 4 && r.PaymentStatus != 5) + .Where(r => r.CreatedUserId == userId && !r.DeleteMark && + ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1)))) .OrderByDescending(r => r.RegistrationTime); var pagedRegs = await regQuery.ToPagedListAsync(input); diff --git a/YD_Event.Application/Event/EventArrangementService.cs b/YD_Event.Application/Event/EventArrangementService.cs index 62b8492..55a2fe5 100644 --- a/YD_Event.Application/Event/EventArrangementService.cs +++ b/YD_Event.Application/Event/EventArrangementService.cs @@ -106,8 +106,8 @@ namespace YD_Event.Application.Event; var counts = await _personRepository.AsQueryable() .InnerJoin((p, r) => p.RegistrationId == r.Id) .Where((p, r) => r.EventId == eventId - && r.PaymentStatus != 4 && r.PaymentStatus != 3 // 排除已取消的报名 - && r.PaymentStatus != 5 // 排除预报名记录 + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + && ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1))) && !p.DeleteMark // 排除已删除的人员 && p.PersonType == PersonType.Athlete) // 只统计运动员 .GroupBy((p, r) => new { p.ProjectId, p.GroupName }) @@ -118,8 +118,8 @@ namespace YD_Event.Application.Event; var personWithTeam = await _personRepository.AsQueryable() .InnerJoin((p, r) => p.RegistrationId == r.Id) .Where((p, r) => r.EventId == eventId - && r.PaymentStatus != 4 && r.PaymentStatus != 3 - && r.PaymentStatus != 5 // 排除预报名记录 + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + && ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1))) && !p.DeleteMark && p.PersonType == PersonType.Athlete && r.TeamName != null) @@ -284,8 +284,8 @@ namespace YD_Event.Application.Event; var counts = await _personRepository.AsQueryable() .InnerJoin((p, r) => p.RegistrationId == r.Id) .Where((p, r) => r.EventId == eventId - && r.PaymentStatus != 4 && r.PaymentStatus != 3 - && r.PaymentStatus != 5 // 排除预报名记录 + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + && ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1))) && !p.DeleteMark && p.PersonType == PersonType.Athlete) .GroupBy((p, r) => new { p.ProjectId, p.GroupName }) @@ -296,8 +296,8 @@ namespace YD_Event.Application.Event; var personWithTeam = await _personRepository.AsQueryable() .InnerJoin((p, r) => p.RegistrationId == r.Id) .Where((p, r) => r.EventId == eventId - && r.PaymentStatus != 4 && r.PaymentStatus != 3 - && r.PaymentStatus != 5 // 排除预报名记录 + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + && ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1))) && !p.DeleteMark && p.PersonType == PersonType.Athlete && r.TeamName != null) @@ -327,8 +327,8 @@ namespace YD_Event.Application.Event; var basicPersons = await _personRepository.AsQueryable() .InnerJoin((p, r) => p.RegistrationId == r.Id) .Where((p, r) => p.ProjectId == eventProj.Id - && r.PaymentStatus != 4 && r.PaymentStatus != 3 - && r.PaymentStatus != 5 // 排除预报名记录 + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + && ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1))) && !p.DeleteMark && p.PersonType == PersonType.Athlete) .OrderBy(p => p.GroupName) diff --git a/YD_Event.Application/Event/EventRecordService.cs b/YD_Event.Application/Event/EventRecordService.cs index 30f9bd0..1fd21c5 100644 --- a/YD_Event.Application/Event/EventRecordService.cs +++ b/YD_Event.Application/Event/EventRecordService.cs @@ -86,7 +86,8 @@ public class EventRecordService : BaseService, ITransient .LeftJoin((r, e, u) => r.CreatedUserId == u.Id) .LeftJoin((r, e, u, s) => r.CreatedUserId == s.Id) .LeftJoin((r, e, u, s, m) => r.CreatedUserId == m.CreatedUserId) - .Where((r, e, u, s, m) => r.PaymentStatus != 5) // 排除预报名记录 + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + .Where((r, e, u, s, m) => (r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1))) .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) diff --git a/YD_Event.Application/Event/EventRegistrationService.cs b/YD_Event.Application/Event/EventRegistrationService.cs index 94e6873..19732de 100644 --- a/YD_Event.Application/Event/EventRegistrationService.cs +++ b/YD_Event.Application/Event/EventRegistrationService.cs @@ -66,7 +66,8 @@ public class EventRegistrationService : BaseService, ITransie public async Task> Page(RegistrationQueryInput input) { var query = _repository.AsQueryable() - .Where(x => x.PaymentStatus != 4 && x.PaymentStatus != 3 && x.PaymentStatus != 5) // 过滤掉已取消、已退款和预报名的记录 + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + .Where(x => (x.PaymentMethod == 2 && x.PaymentStatus == 1) || (x.PaymentMethod == 1 && (x.PaymentStatus == 0 || x.PaymentStatus == 1))) .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)) @@ -500,7 +501,8 @@ public class EventRegistrationService : BaseService, ITransie public async Task Export(RegistrationQueryInput input) { var registrations = await _repository.AsQueryable() - .Where(x => x.PaymentStatus != 4 && x.PaymentStatus != 3 && x.PaymentStatus != 5) // 过滤掉已取消、已退款和预报名的记录 + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + .Where(x => (x.PaymentMethod == 2 && x.PaymentStatus == 1) || (x.PaymentMethod == 1 && (x.PaymentStatus == 0 || x.PaymentStatus == 1))) .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)) diff --git a/YD_Event.Application/Event/EventScoreService.cs b/YD_Event.Application/Event/EventScoreService.cs index ec544cc..8dafea3 100644 --- a/YD_Event.Application/Event/EventScoreService.cs +++ b/YD_Event.Application/Event/EventScoreService.cs @@ -131,9 +131,8 @@ public class EventScoreService : BaseService, ITransient .LeftJoin((p, r, res) => p.Id == res.RegistrationPersonId) .LeftJoin((p, r, res, c) => res.Id == c.ResultId) .Where((p, r, res, c) => r.EventId == input.EventId - && r.PaymentStatus != 3 // 排除已退款的报名 - && r.PaymentStatus != 4 // 排除已取消的报名 - && r.PaymentStatus != 5 // 排除预报名记录 + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + && ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1))) && (p.PersonType == PersonType.Athlete || p.PersonType == PersonType.User)); // 应用筛选条件 @@ -172,8 +171,8 @@ public class EventScoreService : BaseService, ITransient // 先查找所有可能的 MerchantCertificationId var registrationIds = await _registrationRepository.AsQueryable() .Where(r => r.EventId == input.EventId - && r.PaymentStatus != 3 - && r.PaymentStatus != 4) + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + && ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1)))) .Select(r => r.MerchantCertificationId) .ToListAsync(); @@ -340,7 +339,8 @@ public class EventScoreService : BaseService, ITransient var athleteUserIds = await _personRepository.AsQueryable() .InnerJoin((p, r) => p.RegistrationId == r.Id) .Where((p, r) => r.EventId == input.EventId - && r.PaymentStatus != 5 // 排除预报名记录 + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + && ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1))) && p.PersonType == PersonType.Athlete && !p.DeleteMark) .Select(p => p.UserId) .ToListAsync(); @@ -382,7 +382,8 @@ public class EventScoreService : BaseService, ITransient var existingPersons = await _personRepository.AsQueryable() .InnerJoin((p, r) => p.RegistrationId == r.Id) .Where((p, r) => r.EventId == input.EventId - && r.PaymentStatus != 5 // 排除预报名记录 + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + && ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1))) && coachLeaderUserIds.Contains(p.UserId) && p.PersonType == input.PersonType && !p.DeleteMark) .LeftJoin((p, r, u) => p.UserId == u.Id) .Select((p, r, u) => new @@ -551,7 +552,9 @@ public class EventScoreService : BaseService, ITransient // 步骤2:批量预加载该赛事的所有人员数据(包含团队信息) var allPersonsWithTeam = await _personRepository.AsQueryable() .InnerJoin((p, r) => p.RegistrationId == r.Id) - .Where((p, r) => r.EventId == eventId) + .Where((p, r) => r.EventId == eventId + // 线上支付只显示已支付(1),线下支付显示待审核(0)和已支付(1) + && ((r.PaymentMethod == 2 && r.PaymentStatus == 1) || (r.PaymentMethod == 1 && (r.PaymentStatus == 0 || r.PaymentStatus == 1)))) .Select((p, r) => new { p.Id, p.RegistrationItemId,