diff --git a/Lib/Tiobon.Core.dll b/Lib/Tiobon.Core.dll index 5f6f8fd6..f4984eff 100644 Binary files a/Lib/Tiobon.Core.dll and b/Lib/Tiobon.Core.dll differ diff --git a/Tiobon.Core.Model/Base/Ghre/Ghre_CreditPoint.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghre/Ghre_CreditPoint.Dto.Base.cs index 9bbc2c8b..56c2801c 100644 --- a/Tiobon.Core.Model/Base/Ghre/Ghre_CreditPoint.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghre/Ghre_CreditPoint.Dto.Base.cs @@ -6,9 +6,9 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -*V0.01 2024/7/15 18:11:50 SimonHsiao 初版 +*V0.01 2025/6/11 16:37:02 SimonHsiao 初版 * -* Copyright(c) 2024 Tiobon Corporation. All Rights Reserved. +* Copyright(c) 2025 Tiobon Corporation. All Rights Reserved. *┌──────────────────────────────────┐ *│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │ *│ 作者:SimonHsiao │ @@ -38,11 +38,6 @@ public class Ghre_CreditPointBase /// public long? CourseSnapId { get; set; } - /// - /// 考试ID - /// - public long? ExamId { get; set; } - /// /// 获得日期 /// @@ -51,7 +46,8 @@ public class Ghre_CreditPointBase /// /// 获得学分 /// - public int? CreditPoints { get; set; } + [Display(Name = "CreditPoints"), Description("获得学分"), Column(TypeName = "decimal(20,2)")] + public decimal? CreditPoints { get; set; } /// /// 备注 @@ -134,6 +130,11 @@ public class Ghre_CreditPointBase /// public int? ReverseI2 { get; set; } + /// + /// 考试ID + /// + public long? ExamId { get; set; } + /// /// 学分规则ID /// diff --git a/Tiobon.Core.Model/Base/Ghre/Ghre_StudyRecord.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghre/Ghre_StudyRecord.Dto.Base.cs index f25881c3..ea6e5143 100644 --- a/Tiobon.Core.Model/Base/Ghre/Ghre_StudyRecord.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghre/Ghre_StudyRecord.Dto.Base.cs @@ -6,7 +6,7 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -*V0.01 2025/4/29 11:11:35 SimonHsiao 初版 +*V0.01 2025/6/11 16:37:25 SimonHsiao 初版 * * Copyright(c) 2025 Tiobon Corporation. All Rights Reserved. *┌──────────────────────────────────┐ @@ -240,4 +240,10 @@ public class Ghre_StudyRecordBase /// [Display(Name = "CompleteStatus"), Description("完成状态"), MaxLength(32, ErrorMessage = "完成状态 不能超过 32 个字符")] public string CompleteStatus { get; set; } + + /// + /// 学分 + /// + [Display(Name = "CreditPoints"), Description("学分"), Column(TypeName = "decimal(20,2)")] + public decimal? CreditPoints { get; set; } } diff --git a/Tiobon.Core.Model/Models/Ghre/Ghre_CreditPoint.cs b/Tiobon.Core.Model/Models/Ghre/Ghre_CreditPoint.cs index dabce178..a6f72267 100644 --- a/Tiobon.Core.Model/Models/Ghre/Ghre_CreditPoint.cs +++ b/Tiobon.Core.Model/Models/Ghre/Ghre_CreditPoint.cs @@ -6,9 +6,9 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -*V0.01 2024/7/15 18:11:50 SimonHsiao 初版 +*V0.01 2025/6/11 16:37:02 SimonHsiao 初版 * -* Copyright(c) 2024 Tiobon Corporation. All Rights Reserved. +* Copyright(c) 2025 Tiobon Corporation. All Rights Reserved. *┌──────────────────────────────────┐ *│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │ *│ 作者:SimonHsiao │ @@ -39,11 +39,6 @@ public class Ghre_CreditPoint : BasePoco /// public long? CourseSnapId { get; set; } - /// - /// 考试ID - /// - public long? ExamId { get; set; } - /// /// 获得日期 /// @@ -52,7 +47,8 @@ public class Ghre_CreditPoint : BasePoco /// /// 获得学分 /// - public int? CreditPoints { get; set; } + [Display(Name = "CreditPoints"), Description("获得学分"), Column(TypeName = "decimal(20,2)")] + public decimal? CreditPoints { get; set; } /// /// 备注 @@ -135,6 +131,11 @@ public class Ghre_CreditPoint : BasePoco /// public int? ReverseI2 { get; set; } + /// + /// 考试ID + /// + public long? ExamId { get; set; } + /// /// 学分规则ID /// diff --git a/Tiobon.Core.Model/Models/Ghre/Ghre_StudyRecord.cs b/Tiobon.Core.Model/Models/Ghre/Ghre_StudyRecord.cs index b6d92f58..3a126447 100644 --- a/Tiobon.Core.Model/Models/Ghre/Ghre_StudyRecord.cs +++ b/Tiobon.Core.Model/Models/Ghre/Ghre_StudyRecord.cs @@ -6,7 +6,7 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -*V0.01 2025/4/29 11:11:35 SimonHsiao 初版 +*V0.01 2025/6/11 16:37:25 SimonHsiao 初版 * * Copyright(c) 2025 Tiobon Corporation. All Rights Reserved. *┌──────────────────────────────────┐ @@ -241,4 +241,10 @@ public class Ghre_StudyRecord : BasePoco /// [Display(Name = "CompleteStatus"), Description("完成状态"), MaxLength(32, ErrorMessage = "完成状态 不能超过 32 个字符")] public string CompleteStatus { get; set; } + + /// + /// 学分 + /// + [Display(Name = "CreditPoints"), Description("学分"), Column(TypeName = "decimal(20,2)")] + public decimal? CreditPoints { get; set; } } diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs index 661dc0a3..2dcae4c9 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs @@ -243,7 +243,7 @@ public class Ghre_StudyRecordServices : BaseServices() .OrderByDescending(x => x.ExamTime) .Where(x => x.ExamRecordId == entity.ExamRecordId) @@ -2277,15 +2277,18 @@ ORDER BY {filter.orderBy}"; } else if (record.CourseSceneId.IsNotEmptyOrNull()) { - creditRuleId = await Db.Queryable().Where(x => x.Id == record.CourseId).Select(x => x.CreditRuleId).FirstAsync(); - + creditRuleId = await Db.Queryable().Where(x => x.Id == record.CourseId) + .Select(x => x.CreditRuleId).FirstAsync(); + courseCreditPoints = await Db.Queryable().Where(x => x.CourseSceneIds.Contains(record.CourseSceneId.ObjToString())) + .SumAsync(x => x.CreditPoints); } if (courseCreditPoints <= 0) continue; + record.CreditPoints = 0; if (creditRuleId != null) { - var creditRule = await Db.Queryable().Where(x => x.Id == record.CourseId).Select(x => new + var creditRule = await Db.Queryable().Where(x => x.Id == creditRuleId).Select(x => new { x.RuleType, x.ScoreRange, @@ -2328,16 +2331,16 @@ ORDER BY {filter.orderBy}"; if (exam != null) { - var examPaper = await Db.Queryable().Where(x => x.Id == examRecord.ExamId).FirstAsync(); + var examPaper = await Db.Queryable().Where(x => x.Id == exam.ExamPaperId).FirstAsync(); if (examPaper != null) { var percent = (examRecord.Score / examPaper.TotalScore) * 100; - percent = scoreRanges.Where(x => x.StartScore > percent && x.EndScore <= percent).Select(x => x.Credit).FirstOrDefault(); + percent = scoreRanges.Where(x => x.StartScore < percent && x.EndScore >= percent).Select(x => x.Credit).FirstOrDefault(); if (percent != null) - creditPoint.CreditPoints = ((courseCreditPoints * percent) / 100).ObjToInt(); + creditPoint.CreditPoints = ((courseCreditPoints * percent) / 100).ObjToDecimal(); } } @@ -2346,16 +2349,18 @@ ORDER BY {filter.orderBy}"; } if (creditPoint.CreditPoints > 0) + { + record.CreditPoints = creditPoint.CreditPoints; creditPoints.Add(creditPoint); + } } } - - //record.cre + record.IsIssueCredit = true; } await Db.Insertable(creditPoints).ExecuteReturnSnowflakeIdListAsync(); await Db.Updateable(records) - .UpdateColumns(it => new { it.IsIssueCredit }, true) + .UpdateColumns(it => new { it.IsIssueCredit, it.CreditPoints }, true) .ExecuteCommandAsync(); return ServiceResult.OprateSuccess("发放成功!"); } diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml index 6e59100b..d19e0309 100644 --- a/Tiobon.Core/Tiobon.Core.Model.xml +++ b/Tiobon.Core/Tiobon.Core.Model.xml @@ -4370,11 +4370,6 @@ 课程快照ID - - - 考试ID - - 获得日期 @@ -4455,6 +4450,11 @@ 预留字段12 + + + 考试ID + + 学分规则ID @@ -8910,6 +8910,11 @@ 完成状态 + + + 学分 + + 培训记录明细 (Dto.Base) @@ -24477,11 +24482,6 @@ 课程快照ID - - - 考试ID - - 获得日期 @@ -24562,6 +24562,11 @@ 预留字段12 + + + 考试ID + + 学分规则ID @@ -28912,6 +28917,11 @@ 完成状态 + + + 学分 + + 培训记录明细 (Model)