From a3cec717c7313dc353c09dbad6359422b8782704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Fri, 20 Mar 2026 02:00:34 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E7=B1=BB=E5=9E=8B=E7=BB=9F?= =?UTF-8?q?=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppUser/AppUserService.cs | 12 +- .../AppUser/Dtos/AppUserDtos.cs | 18 +- .../Client/EventClientController.cs | 2 +- .../Client/OAuthController.cs | 2 +- YD_Event.Application/Event/Dtos/ScoreDtos.cs | 2 +- .../Event/EventScoreService.cs | 5 +- .../Event/UserCompetitionService.cs | 8 +- YD_Event.Application/YD_Event.Application.xml | 272 +++++------------- YD_Event.Core/Entities/AppUser.cs | 4 +- .../Entities/EventRegistrationPerson.cs | 4 +- YD_Event.Core/Enum/PersonType.cs | 33 +++ YD_Event.Core/Enum/TeamRole.cs | 3 +- YD_Event.Core/YD_Event.Core.xml | 31 +- 13 files changed, 166 insertions(+), 230 deletions(-) create mode 100644 YD_Event.Core/Enum/PersonType.cs diff --git a/YD_Event.Application/AppUser/AppUserService.cs b/YD_Event.Application/AppUser/AppUserService.cs index f3bb3fc..8ee5dc2 100644 --- a/YD_Event.Application/AppUser/AppUserService.cs +++ b/YD_Event.Application/AppUser/AppUserService.cs @@ -39,7 +39,7 @@ public class AppUserService : BaseService, ITransient public async Task> Page([FromQuery] AppUserPageInput input) { var query = _appUserRep.AsQueryable() - .Where(u => u.PersonType == 0) // 仅查询普通用户 + .Where(u => u.PersonType == PersonType.User) // 仅查询普通用户 .WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name)) .WhereIF(input.Gender.HasValue, u => u.Gender == input.Gender) .WhereIF(!string.IsNullOrWhiteSpace(input.Mobile), u => u.Mobile.Contains(input.Mobile)) @@ -107,8 +107,8 @@ public class AppUserService : BaseService, ITransient .WhereIF(input.Gender.HasValue, x => x.Gender == input.Gender) .WhereIF(!string.IsNullOrWhiteSpace(input.Phone), x => x.Mobile.Contains(input.Phone)) .WhereIF(!string.IsNullOrWhiteSpace(input.IdCardNumber), u => u.IdCardNumber.Contains(input.IdCardNumber)) - .WhereIF(input.PersonType == 2 && !string.IsNullOrWhiteSpace(input.SkillLevel), x => x.SkillLevel == input.SkillLevel) - .WhereIF(input.PersonType == 2 && input.CertificationStatus.HasValue, x => x.CertificationStatus == input.CertificationStatus) + .WhereIF(input.PersonType == PersonType.Coach && !string.IsNullOrWhiteSpace(input.SkillLevel), x => x.SkillLevel == input.SkillLevel) + .WhereIF(input.PersonType == PersonType.Coach && input.CertificationStatus.HasValue, x => x.CertificationStatus == input.CertificationStatus) .WhereIF(input.StartTime.HasValue, u => u.CreatedTime >= input.StartTime) .WhereIF(input.EndTime.HasValue, u => u.CreatedTime <= input.EndTime) .OrderByDescending(x => x.CreatedTime); @@ -165,12 +165,12 @@ public class AppUserService : BaseService, ITransient } // 只有领队和教练强校验手机号 - if (input.PersonType == 1 || input.PersonType == 2) + if (input.PersonType == PersonType.Leader || input.PersonType == PersonType.Coach) { if (await queryPhone.AnyAsync()) throw Oops.Bah($"该手机号的成员已存在"); } // 运动员强校验身份证 - if (input.PersonType == 3) + if (input.PersonType == PersonType.Athlete) { if (await queryIdCard.AnyAsync()) throw Oops.Bah($"该身份证号的成员已存在"); } @@ -221,7 +221,7 @@ public class AppUserService : BaseService, ITransient entity.Age = input.Age; } - if (input.PersonType == 2) + if (input.PersonType == PersonType.Coach) { entity.SkillLevel = input.SkillLevel; entity.CertificationStatus = input.CertificationStatus; diff --git a/YD_Event.Application/AppUser/Dtos/AppUserDtos.cs b/YD_Event.Application/AppUser/Dtos/AppUserDtos.cs index 416a182..aadd730 100644 --- a/YD_Event.Application/AppUser/Dtos/AppUserDtos.cs +++ b/YD_Event.Application/AppUser/Dtos/AppUserDtos.cs @@ -45,10 +45,11 @@ public class AppUserPageInput : Pagination public class MemberQueryInput : Pagination { /// - /// 人员类型:1-领队,2-教练,3-运动员 + /// 人员类型:1-运动员,2-教练,3-领队 /// [Required(ErrorMessage = "人员类型不能为空")] - public int PersonType { get; set; } + [EnumDataType(typeof(PersonType), ErrorMessage = "不支持的人员类型")] + public PersonType PersonType { get; set; } /// /// 姓名 @@ -97,9 +98,9 @@ public class MemberQueryInput : Pagination public class MemberOutput : AppUserOutput { /// - /// 人员类型:1-领队,2-教练,3-运动员 + /// 人员类型:1-运动员,2-教练,3-领队 /// - public int PersonType { get; set; } + public PersonType PersonType { get; set; } /// /// 年龄 @@ -123,10 +124,11 @@ public class MemberOutput : AppUserOutput public class CreateOrUpdateMemberInput { /// - /// 人员类型:1-领队,2-教练,3-运动员 + /// 人员类型:1-运动员,2-教练,3-领队 /// [Required(ErrorMessage = "人员类型不能为空")] - public int PersonType { get; set; } + [EnumDataType(typeof(PersonType), ErrorMessage = "不支持的人员类型")] + public PersonType PersonType { get; set; } /// /// ID (更新时必填) @@ -153,8 +155,8 @@ public class CreateOrUpdateMemberInput /// /// 身份证号 /// - [Required(ErrorMessage = "身份证号不能为空")] - [RegularExpression(@"(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)", ErrorMessage = "身份证号格式不正确")] + //[Required(ErrorMessage = "身份证号不能为空")] + //[RegularExpression(@"(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)", ErrorMessage = "身份证号格式不正确")] public string IdCard { get; set; } /// diff --git a/YD_Event.Application/Client/EventClientController.cs b/YD_Event.Application/Client/EventClientController.cs index f0b9b54..7fe5516 100644 --- a/YD_Event.Application/Client/EventClientController.cs +++ b/YD_Event.Application/Client/EventClientController.cs @@ -356,7 +356,7 @@ public class EventClientController : IDynamicApiController RegistrationId = registrationId, RegistrationItemId = regItemId, ProjectId = item.ProjectId, - PersonType = 1, // 运动员 + PersonType = PersonType.Athlete, // 运动员 Name = pInput.Name, Gender = pInput.Gender, IdCard = pInput.IdCard, diff --git a/YD_Event.Application/Client/OAuthController.cs b/YD_Event.Application/Client/OAuthController.cs index e3feec1..3fefb1b 100644 --- a/YD_Event.Application/Client/OAuthController.cs +++ b/YD_Event.Application/Client/OAuthController.cs @@ -165,7 +165,7 @@ public class OAuthController : IDynamicApiController NickName = wxUser.NickName, Avatar = wxUser.AvatarUrl, Gender = (Gender)wxUser.Gender, - PersonType = 0, // 普通用户 + PersonType = PersonType.User, // 普通用户 Status = AvailabilityStatus.Enable, AuditStatus = AuditStatus.Pass, CreatedTime = DateTime.Now, diff --git a/YD_Event.Application/Event/Dtos/ScoreDtos.cs b/YD_Event.Application/Event/Dtos/ScoreDtos.cs index 39971c8..b6f3b0d 100644 --- a/YD_Event.Application/Event/Dtos/ScoreDtos.cs +++ b/YD_Event.Application/Event/Dtos/ScoreDtos.cs @@ -94,7 +94,7 @@ public class CoachLeaderQueryInput : Pagination /// /// 人员类型 (2-教练, 3-领队) /// - public int PersonType { get; set; } + public PersonType PersonType { get; set; } /// /// 姓名 diff --git a/YD_Event.Application/Event/EventScoreService.cs b/YD_Event.Application/Event/EventScoreService.cs index c5185f0..6a9b92c 100644 --- a/YD_Event.Application/Event/EventScoreService.cs +++ b/YD_Event.Application/Event/EventScoreService.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using YD_Event.Application.Event.Dtos; using YD_Event.Core.Entities; +using YD_Event.Core.Enum; using MiniExcelLibs; using SqlSugar; @@ -42,7 +43,7 @@ public class EventScoreService : BaseService, ITransient .LeftJoin((p, r) => p.RegistrationId == r.Id) .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 && (p.PersonType == 1 || p.PersonType == 0)) + .Where((p, r, res, c) => r.EventId == input.EventId && (p.PersonType == PersonType.Athlete || p.PersonType == PersonType.User)) .WhereIF(input.ProjectId.HasValue, p => p.ProjectId == input.ProjectId) .WhereIF(!string.IsNullOrWhiteSpace(input.GroupName), p => p.GroupName == input.GroupName) .WhereIF(!string.IsNullOrWhiteSpace(input.Name), p => p.Name.Contains(input.Name)) @@ -143,7 +144,7 @@ public class EventScoreService : BaseService, ITransient var person = await _personRepository.GetByIdAsync(personId); if (person == null) continue; - if (person.PersonType == 1 || person.PersonType == 0) + if (person.PersonType == PersonType.Athlete || person.PersonType == PersonType.User) { var result = await _resultRepository.GetFirstAsync(x => x.RegistrationPersonId == person.Id); if (result == null) continue; diff --git a/YD_Event.Application/Event/UserCompetitionService.cs b/YD_Event.Application/Event/UserCompetitionService.cs index 73f0af3..cda9e24 100644 --- a/YD_Event.Application/Event/UserCompetitionService.cs +++ b/YD_Event.Application/Event/UserCompetitionService.cs @@ -333,7 +333,7 @@ public class UserCompetitionService : IDynamicApiController, ITransient Phone = member.Mobile, Age = member.Age, BirthDate = member.BirthDate ?? DateTime.MinValue, - PersonType = 1, + PersonType = PersonType.Athlete, CreatedUserId = userId, CreatedTime = DateTime.Now }; @@ -697,7 +697,7 @@ public class UserCompetitionService : IDynamicApiController, ITransient RealName = p.Name, Phone = p.Phone, Email = "", // 暂无 - Role = p.PersonType == 3 ? "队长" : "队员", // 假设 + Role = p.PersonType == PersonType.Leader ? "队长" : "队员", // 假设 InviteStatus = "已加入", JoinTime = p.CreatedTime }).ToList(); @@ -720,8 +720,8 @@ public class UserCompetitionService : IDynamicApiController, ITransient var person = await _registrationPersonRepository.GetFirstAsync(x => x.RegistrationId == registrationId && x.Id == userId); if (person == null) throw Oops.Bah("队员不存在"); - // 被替换人 role ≠ 队长 (假设 PersonType=3 是队长) - if (person.PersonType == 3) throw Oops.Bah("不能替换队长"); + // 被替换人 role ≠ 队长 (假设 PersonType=Leader 是队长) + if (person.PersonType == PersonType.Leader) throw Oops.Bah("不能替换队长"); // 检查新队员 var newUser = await _userRepository.GetByIdAsync(input.NewUserId); diff --git a/YD_Event.Application/YD_Event.Application.xml b/YD_Event.Application/YD_Event.Application.xml index 0a104fc..767d37b 100644 --- a/YD_Event.Application/YD_Event.Application.xml +++ b/YD_Event.Application/YD_Event.Application.xml @@ -72,46 +72,16 @@ - + - 领队/教练列表查询 - - - 1-领队,2-教练 - - - - - 领队列表查询 + 统一分页查询成员 - + - 教练列表查询 - - - - - - - 新增/更新成员 - - - 1-领队,2-教练 - - - - - 新增/编辑领队 - - - - - - - 新增/编辑教练 + 统一新增/编辑成员 @@ -123,6 +93,13 @@ + + + 批量删除成员 + + + + 变更成员状态 @@ -130,27 +107,6 @@ - - - 分页查询运动员 - - - - - - - 新增运动员 - - - - - - - 修改运动员 - - - - 识别身份证信息 @@ -158,13 +114,6 @@ - - - 批量删除运动员 - - - - 普通用户分页查询输入 @@ -200,41 +149,91 @@ 结束时间 - + - 领队/教练查询输入 + 成员统一查询输入(合并领队、教练、运动员) - + + + 人员类型:1-运动员,2-教练,3-领队 + + + 姓名 - + 性别 - + 联系电话 - + + + 身份证号 (运动员常用) + + + 技能等级(仅教练) - + 认证状态(仅教练) + + + 开始注册时间 + + + + + 结束注册时间 + + + + + 统一成员输出 + + + + + 人员类型:1-运动员,2-教练,3-领队 + + + + + 年龄 + + + + + 技能等级(教练) + + + + + 认证状态(教练) + + 创建/更新成员输入 + + + 人员类型:1-运动员,2-教练,3-领队 + + ID (更新时必填) @@ -265,6 +264,11 @@ 身份证图片URL + + + 出生日期 (运动员等) + + 联系电话 @@ -375,136 +379,6 @@ 审核备注 - - - 运动员查询输入 - - - - - 姓名 - - - - - 身份证号 - - - - - 开始注册时间 - - - - - 结束注册时间 - - - - - 新增运动员输入 - - - - - 姓名 - - - - - 性别 - - - - - 出生日期 - - - - - 身份证号 - - - - - 身份证图片URL - - - - - 联系电话 - - - - - 修改运动员输入 - - - - - 主键Id - - - - - 运动员信息输出 - - - - - 主键Id - - - - - 姓名 - - - - - 性别 - - - - - 性别描述 - - - - - 年龄 - - - - - 出生日期 - - - - - 身份证号 - - - - - 身份证图片URL - - - - - 联系电话 - - - - - 状态 - - - - - 注册时间 - - OCR识别输入 diff --git a/YD_Event.Core/Entities/AppUser.cs b/YD_Event.Core/Entities/AppUser.cs index 778a681..22412e3 100644 --- a/YD_Event.Core/Entities/AppUser.cs +++ b/YD_Event.Core/Entities/AppUser.cs @@ -21,9 +21,9 @@ public class AppUser : Entity, ISoftDelete, ICreatedUserId, ICreatedTime, public long? MerchantId { get; set; } /// - /// 人员类型:0-普通用户,1-领队,2-教练,3-运动员 + /// 人员类型:0-普通用户,1-运动员,2-教练,3-领队 /// - public int PersonType { get; set; } + public PersonType PersonType { get; set; } /// /// 技能等级(教练特有) diff --git a/YD_Event.Core/Entities/EventRegistrationPerson.cs b/YD_Event.Core/Entities/EventRegistrationPerson.cs index 6378562..36efaab 100644 --- a/YD_Event.Core/Entities/EventRegistrationPerson.cs +++ b/YD_Event.Core/Entities/EventRegistrationPerson.cs @@ -24,9 +24,9 @@ public class EventRegistrationPerson : Entity, ISoftDelete, ICreatedUserId public long ProjectId { get; set; } /// - /// 人员类型:1-运动员,2-教练员,3-领队 + /// 人员类型:1-运动员,2-教练,3-领队 /// - public int PersonType { get; set; } + public PersonType PersonType { get; set; } /// /// 姓名 diff --git a/YD_Event.Core/Enum/PersonType.cs b/YD_Event.Core/Enum/PersonType.cs new file mode 100644 index 0000000..7f1c86a --- /dev/null +++ b/YD_Event.Core/Enum/PersonType.cs @@ -0,0 +1,33 @@ +using System.ComponentModel; + +namespace YD_Event.Core.Enum; + +/// +/// 人员角色类型 +/// +public enum PersonType +{ + /// + /// 普通用户 + /// + [Description("普通用户")] + User = 0, + + /// + /// 运动员 + /// + [Description("运动员")] + Athlete = 1, + + /// + /// 教练 + /// + [Description("教练")] + Coach = 2, + + /// + /// 领队 + /// + [Description("领队")] + Leader = 3 +} diff --git a/YD_Event.Core/Enum/TeamRole.cs b/YD_Event.Core/Enum/TeamRole.cs index 4fd975a..bf31940 100644 --- a/YD_Event.Core/Enum/TeamRole.cs +++ b/YD_Event.Core/Enum/TeamRole.cs @@ -1,9 +1,10 @@ +using System; using System.ComponentModel; namespace YD_Event.Core.Enum; /// -/// 团队角色 +/// 团队角色 (请统一使用 PersonType: 1=运动员, 2=教练, 3=领队) /// public enum TeamRole { diff --git a/YD_Event.Core/YD_Event.Core.xml b/YD_Event.Core/YD_Event.Core.xml index 49d5389..13fb424 100644 --- a/YD_Event.Core/YD_Event.Core.xml +++ b/YD_Event.Core/YD_Event.Core.xml @@ -461,7 +461,7 @@ - 人员类型:0-普通用户,1-领队,2-教练,3-运动员 + 人员类型:0-普通用户,1-运动员,2-教练,3-领队 @@ -1981,7 +1981,7 @@ - 人员类型:1-运动员,2-教练员,3-领队 + 人员类型:1-运动员,2-教练,3-领队 @@ -4225,6 +4225,31 @@ 已完成 + + + 人员角色类型 + + + + + 普通用户 + + + + + 运动员 + + + + + 教练 + + + + + 领队 + + 积分操作类型 @@ -4292,7 +4317,7 @@ - 团队角色 + 团队角色 (请统一使用 PersonType: 1=运动员, 2=教练, 3=领队)