From 2e615d43c611b38d93ae5faf2a9b336eba04a516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Tue, 12 May 2026 10:51:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=9B=E4=BA=8B=E7=BB=9F=E4=B8=80=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=A7=84=E5=88=99=20-=20=E7=BA=BF=E4=B8=8A=E6=94=AF?= =?UTF-8?q?=E4=BB=98=20(PaymentMethod=20=3D=3D=202)=20=EF=BC=9A=E5=8F=AA?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=B7=B2=E6=94=AF=E4=BB=98=20(PaymentStatus?= =?UTF-8?q?=20=3D=3D=201)=20=E7=9A=84=E8=AE=B0=E5=BD=95=20-=20=E7=BA=BF?= =?UTF-8?q?=E4=B8=8B=E6=94=AF=E4=BB=98=20(PaymentMethod=20=3D=3D=201)=20?= =?UTF-8?q?=EF=BC=9A=E6=98=BE=E7=A4=BA=E5=BE=85=E5=AE=A1=E6=A0=B8=20(Payme?= =?UTF-8?q?ntStatus=20=3D=3D=200)=20=E5=92=8C=E5=B7=B2=E6=94=AF=E4=BB=98?= =?UTF-8?q?=20(PaymentStatus=20=3D=3D=201)=20=E7=9A=84=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Client/EventClientController.cs | 8 +++++--- YD_Event.Application/Client/MyController.cs | 3 ++- .../Event/EventArrangementService.cs | 20 +++++++++---------- .../Event/EventRecordService.cs | 3 ++- .../Event/EventRegistrationService.cs | 6 ++++-- .../Event/EventScoreService.cs | 19 ++++++++++-------- 6 files changed, 34 insertions(+), 25 deletions(-) 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,