diff --git a/YD_Event.Application/Arrangement/EventArrangementService.cs b/YD_Event.Application/Arrangement/EventArrangementService.cs index 9c12a5c..461abdb 100644 --- a/YD_Event.Application/Arrangement/EventArrangementService.cs +++ b/YD_Event.Application/Arrangement/EventArrangementService.cs @@ -10,21 +10,24 @@ namespace YD_Event.Application.Arrangement; /// public class EventArrangementService : ITransient { - private readonly ISqlSugarRepository _projectRepository; - private readonly ISqlSugarRepository _groupRepository; + private readonly ISqlSugarRepository _projectRepository; + private readonly ISqlSugarRepository _groupRepository; private readonly ISqlSugarRepository _personRepository; private readonly ISqlSugarRepository _registrationRepository; + private readonly ISqlSugarRepository _projectTypeRepository; public EventArrangementService( - ISqlSugarRepository projectRepository, - ISqlSugarRepository groupRepository, + ISqlSugarRepository projectRepository, + ISqlSugarRepository groupRepository, ISqlSugarRepository personRepository, - ISqlSugarRepository registrationRepository) + ISqlSugarRepository registrationRepository, + ISqlSugarRepository projectTypeRepository) { _projectRepository = projectRepository; _groupRepository = groupRepository; _personRepository = personRepository; _registrationRepository = registrationRepository; + _projectTypeRepository = projectTypeRepository; } /// @@ -38,6 +41,10 @@ public class EventArrangementService : ITransient var groups = await _groupRepository.GetListAsync(x => projects.Select(p => p.Id).Contains(x.ProjectId)); + // 获取项目类型信息 + var typeIds = projects.Select(x => x.ProjectTypeId).Distinct().ToList(); + var types = await _projectTypeRepository.GetListAsync(x => typeIds.Contains(x.Id)); + // 统计各组别报名人数(仅统计已支付或审核通过的) var counts = await _personRepository.AsQueryable() .InnerJoin((p, r) => p.RegistrationId == r.Id) @@ -49,11 +56,13 @@ public class EventArrangementService : ITransient var result = new List(); foreach (var proj in projects) { + var type = types.FirstOrDefault(x => x.Id == proj.ProjectTypeId); + var dto = new ArrangementProjectListOutput { ProjectId = proj.Id, - ProjectName = proj.ProjectName, - ProjectType = $"{proj.ProjectMainType}-{proj.ProjectSubType}", + ProjectName = proj.Name, + ProjectType = type?.Name ?? "未知类型", DurationSeconds = proj.DurationSeconds, VenueCount = proj.VenueCount, SortIndex = proj.SortIndex, @@ -91,7 +100,7 @@ public class EventArrangementService : ITransient { foreach (var setting in input.Settings) { - await _projectRepository.UpdateAsync(x => new EventProject + await _projectRepository.UpdateAsync(x => new YD_Event.Core.Entities.Project { VenueCount = setting.VenueCount, SortIndex = setting.SortIndex @@ -108,7 +117,7 @@ public class EventArrangementService : ITransient // 1. 获取项目(按顺序) var projects = await _projectRepository.GetListAsync(x => x.EventId == eventId); projects = projects.OrderBy(x => x.SortIndex).ToList(); - + var result = new List(); // 2. 生成排期 @@ -139,7 +148,7 @@ public class EventArrangementService : ITransient result.Add(new ArrangementPreviewOutput { TimeRange = $"{proj.DurationSeconds}''", - ProjectName = proj.ProjectName, + ProjectName = proj.Name, GroupName = person.GroupName, TeamName = person.TeamName, AthleteName = person.Name, diff --git a/YD_Event.Core/YD_Event.Core.xml b/YD_Event.Core/YD_Event.Core.xml index de7311f..f7f46bc 100644 --- a/YD_Event.Core/YD_Event.Core.xml +++ b/YD_Event.Core/YD_Event.Core.xml @@ -4,110 +4,44 @@ YD_Event.Core - - - 证书模板配置 (用于 Certificate.ConfigJson) - - - - - 字段列表 - - - - - 证书字段定义 - - - - - 字段标识 (Name, Project, Rank, Date, CustomText, QrCode) - - - - - X坐标 (mm) - - - - - Y坐标 (mm) - - - - - 宽度 (mm) - - - - - 高度 (mm) - - - - - 字体大小 - - - - - 字体 (SimSun, SimHei, SourceHanSansCN) - - - - - 颜色 (Hex: #000000) - - - - - 对齐方式 (Left, Center, Right) - - - - - 文本内容 (用于静态文本或格式化字符串,如 "第{0}名") - - - - - 是否粗体 - - - - - 证书发放规则配置 (用于 EventCertificateConfig.RuleJson) - - - - - 发放对象类型 (Athlete, Coach, Volunteer, Referee) - - - - - 排名起始 (仅针对运动员) - - - - - 排名结束 (仅针对运动员) - - - - - 限制项目ID列表 (为空则不限制) - - - - - 获奖等级 (如:一等奖) - - - 通用证书PDF文档生成类 + 结业证书PDF文档生成类 + + 实现IDocument接口,用于生成A4大小的结业证书PDF文档 + 包含证书标题、学员信息、课程名称、证书编号和发证日期等内容 + + + + + 证书数据模型 + + + + + 构造函数 + + 证书数据模型,包含生成证书所需的所有信息 + + + + 获取文档元数据 + + 返回默认的文档元数据 + + + + 组合文档内容 + + 文档容器,用于构建PDF文档结构 + + 构建A4大小的证书页面,包含以下内容: + 1. 证书标题 "结 业 证 书" + 2. 学员姓名和课程完成信息 + 3. 证书编号 + 4. 发证日期 + @@ -115,29 +49,28 @@ 用于存储和传输证书相关的核心信息 + + + 用户名/学员姓名 + 对应获取证书的用户真实姓名 + + + + + 课程名称 + 用户完成的课程全称 + + 证书编号 + 证书的唯一标识编号,用于验证和查询 颁发日期 - - - - - 基础数据 (Name, Project, Rank, etc.) - - - - - 背景图数据 (二进制) - - - - - 二维码数据 (二进制) + 证书的正式签发日期 @@ -491,82 +424,82 @@ 更新时间 - + - 证书模板表 (certificate_templates) + 证书实体类 - + - 模板名称 (如:通用奖状模板) + 证书名称 - + - 默认标题 (如:荣誉证书) + 证书标题 - + - 默认颁发机构 + 发放规则 - + + + 颁发机构 + + + + + 有效期(天) + + + 备注 - + - 背景图URL + 证书模板内容 (图片URL) - + - 模板宽度 (mm) + 二维码地址 - - - 模板高度 (mm) - - - - - 动态内容默认配置 (JSON格式) - - - + 可用状态 - + - 排序值 + 排序值(值越小越靠前) - + 标记删除 - + - 创建人 + 创建人ID - + 创建时间 - + 更新人 - + 更新时间 @@ -761,72 +694,107 @@ 更新时间 - + - 赛事证书规则关联表 (event_certificates) + 赛事证书表 - + - 关联的赛事ID + 关联的成绩ID - + - 关联的证书模板ID + 关联的参赛记录ID - + - 规则名称 (如:冠军证书规则) + 关联的报名ID - + - 证书标题 (覆盖模板默认值) + 赛事ID - + - 颁发机构 (覆盖模板默认值) + 赛事项目ID - + - 发放规则 (JSON格式) + 参赛选手姓名 - + - 动态内容配置 (覆盖模板默认值, JSON格式) + 参赛组别 - + - 是否启用 + 获奖等级:1-特等奖,2-一等奖,3-二等奖,4-三等奖,5-优秀奖 - + + + 证书类型:1-冠军证书,2-亚军证书,3-季军证书,4-优胜证书,5-参与证书 + + + + + 证书编号 + + + + + 证书URL + + + + + 证书状态:0-未生成,1-已生成,2-已发放,3-已撤销 + + + + + 生成时间 + + + + + 发放时间 + + + + + 备注 + + + 标记删除 - + 创建人 - + 创建时间 - + 更新人 - + 更新时间 @@ -3312,96 +3280,6 @@ 更新时间 - - - 用户证书记录表 (user_certificates) - - - - - 关联的赛事ID - - - - - 关联的规则ID - - - - - 关联的成绩ID (可选) - - - - - 关联的项目ID (可选) - - - - - 持有人姓名 - - - - - 组别名称 - - - - - 证书编号 - - - - - 证书文件URL - - - - - 证书状态:0-未生成,1-已生成,2-已发放,3-已撤销 - - - - - 生成时间 - - - - - 发放时间 - - - - - 备注 - - - - - 标记删除 - - - - - 创建人 - - - - - 创建时间 - - - - - 更新人 - - - - - 更新时间 - - 用户优惠券领取记录