自动发放积分,新增回写至学习记录上

master
xiaochanghai 2 weeks ago
parent 8453823150
commit 48a77d5114
  1. BIN
      Lib/Tiobon.Core.dll
  2. 17
      Tiobon.Core.Model/Base/Ghre/Ghre_CreditPoint.Dto.Base.cs
  3. 8
      Tiobon.Core.Model/Base/Ghre/Ghre_StudyRecord.Dto.Base.cs
  4. 17
      Tiobon.Core.Model/Models/Ghre/Ghre_CreditPoint.cs
  5. 8
      Tiobon.Core.Model/Models/Ghre/Ghre_StudyRecord.cs
  6. 23
      Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs
  7. 30
      Tiobon.Core/Tiobon.Core.Model.xml

Binary file not shown.

@ -6,9 +6,9 @@
* *
* Ver * 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 * SimonHsiao
@ -38,11 +38,6 @@ public class Ghre_CreditPointBase
/// </summary> /// </summary>
public long? CourseSnapId { get; set; } public long? CourseSnapId { get; set; }
/// <summary>
/// 考试ID
/// </summary>
public long? ExamId { get; set; }
/// <summary> /// <summary>
/// 获得日期 /// 获得日期
/// </summary> /// </summary>
@ -51,7 +46,8 @@ public class Ghre_CreditPointBase
/// <summary> /// <summary>
/// 获得学分 /// 获得学分
/// </summary> /// </summary>
public int? CreditPoints { get; set; } [Display(Name = "CreditPoints"), Description("获得学分"), Column(TypeName = "decimal(20,2)")]
public decimal? CreditPoints { get; set; }
/// <summary> /// <summary>
/// 备注 /// 备注
@ -134,6 +130,11 @@ public class Ghre_CreditPointBase
/// </summary> /// </summary>
public int? ReverseI2 { get; set; } public int? ReverseI2 { get; set; }
/// <summary>
/// 考试ID
/// </summary>
public long? ExamId { get; set; }
/// <summary> /// <summary>
/// 学分规则ID /// 学分规则ID
/// </summary> /// </summary>

@ -6,7 +6,7 @@
* *
* Ver * 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. * Copyright(c) 2025 Tiobon Corporation. All Rights Reserved.
* *
@ -240,4 +240,10 @@ public class Ghre_StudyRecordBase
/// </summary> /// </summary>
[Display(Name = "CompleteStatus"), Description("完成状态"), MaxLength(32, ErrorMessage = "完成状态 不能超过 32 个字符")] [Display(Name = "CompleteStatus"), Description("完成状态"), MaxLength(32, ErrorMessage = "完成状态 不能超过 32 个字符")]
public string CompleteStatus { get; set; } public string CompleteStatus { get; set; }
/// <summary>
/// 学分
/// </summary>
[Display(Name = "CreditPoints"), Description("学分"), Column(TypeName = "decimal(20,2)")]
public decimal? CreditPoints { get; set; }
} }

@ -6,9 +6,9 @@
* *
* Ver * 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 * SimonHsiao
@ -39,11 +39,6 @@ public class Ghre_CreditPoint : BasePoco
/// </summary> /// </summary>
public long? CourseSnapId { get; set; } public long? CourseSnapId { get; set; }
/// <summary>
/// 考试ID
/// </summary>
public long? ExamId { get; set; }
/// <summary> /// <summary>
/// 获得日期 /// 获得日期
/// </summary> /// </summary>
@ -52,7 +47,8 @@ public class Ghre_CreditPoint : BasePoco
/// <summary> /// <summary>
/// 获得学分 /// 获得学分
/// </summary> /// </summary>
public int? CreditPoints { get; set; } [Display(Name = "CreditPoints"), Description("获得学分"), Column(TypeName = "decimal(20,2)")]
public decimal? CreditPoints { get; set; }
/// <summary> /// <summary>
/// 备注 /// 备注
@ -135,6 +131,11 @@ public class Ghre_CreditPoint : BasePoco
/// </summary> /// </summary>
public int? ReverseI2 { get; set; } public int? ReverseI2 { get; set; }
/// <summary>
/// 考试ID
/// </summary>
public long? ExamId { get; set; }
/// <summary> /// <summary>
/// 学分规则ID /// 学分规则ID
/// </summary> /// </summary>

@ -6,7 +6,7 @@
* *
* Ver * 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. * Copyright(c) 2025 Tiobon Corporation. All Rights Reserved.
* *
@ -241,4 +241,10 @@ public class Ghre_StudyRecord : BasePoco
/// </summary> /// </summary>
[Display(Name = "CompleteStatus"), Description("完成状态"), MaxLength(32, ErrorMessage = "完成状态 不能超过 32 个字符")] [Display(Name = "CompleteStatus"), Description("完成状态"), MaxLength(32, ErrorMessage = "完成状态 不能超过 32 个字符")]
public string CompleteStatus { get; set; } public string CompleteStatus { get; set; }
/// <summary>
/// 学分
/// </summary>
[Display(Name = "CreditPoints"), Description("学分"), Column(TypeName = "decimal(20,2)")]
public decimal? CreditPoints { get; set; }
} }

@ -2277,15 +2277,18 @@ ORDER BY {filter.orderBy}";
} }
else if (record.CourseSceneId.IsNotEmptyOrNull()) else if (record.CourseSceneId.IsNotEmptyOrNull())
{ {
creditRuleId = await Db.Queryable<Ghre_CourseScene>().Where(x => x.Id == record.CourseId).Select(x => x.CreditRuleId).FirstAsync(); creditRuleId = await Db.Queryable<Ghre_CourseScene>().Where(x => x.Id == record.CourseId)
.Select(x => x.CreditRuleId).FirstAsync();
courseCreditPoints = await Db.Queryable<Ghre_Course>().Where(x => x.CourseSceneIds.Contains(record.CourseSceneId.ObjToString()))
.SumAsync(x => x.CreditPoints);
} }
if (courseCreditPoints <= 0) if (courseCreditPoints <= 0)
continue; continue;
record.CreditPoints = 0;
if (creditRuleId != null) if (creditRuleId != null)
{ {
var creditRule = await Db.Queryable<Ghre_CreditRule>().Where(x => x.Id == record.CourseId).Select(x => new var creditRule = await Db.Queryable<Ghre_CreditRule>().Where(x => x.Id == creditRuleId).Select(x => new
{ {
x.RuleType, x.RuleType,
x.ScoreRange, x.ScoreRange,
@ -2328,16 +2331,16 @@ ORDER BY {filter.orderBy}";
if (exam != null) if (exam != null)
{ {
var examPaper = await Db.Queryable<Ghre_ExamPaper>().Where(x => x.Id == examRecord.ExamId).FirstAsync(); var examPaper = await Db.Queryable<Ghre_ExamPaper>().Where(x => x.Id == exam.ExamPaperId).FirstAsync();
if (examPaper != null) if (examPaper != null)
{ {
var percent = (examRecord.Score / examPaper.TotalScore) * 100; 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) 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) if (creditPoint.CreditPoints > 0)
{
record.CreditPoints = creditPoint.CreditPoints;
creditPoints.Add(creditPoint); creditPoints.Add(creditPoint);
}
} }
} }
record.IsIssueCredit = true;
//record.cre
} }
await Db.Insertable(creditPoints).ExecuteReturnSnowflakeIdListAsync(); await Db.Insertable(creditPoints).ExecuteReturnSnowflakeIdListAsync();
await Db.Updateable(records) await Db.Updateable(records)
.UpdateColumns(it => new { it.IsIssueCredit }, true) .UpdateColumns(it => new { it.IsIssueCredit, it.CreditPoints }, true)
.ExecuteCommandAsync(); .ExecuteCommandAsync();
return ServiceResult.OprateSuccess("发放成功!"); return ServiceResult.OprateSuccess("发放成功!");
} }

@ -4370,11 +4370,6 @@
课程快照ID 课程快照ID
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CreditPointBase.ExamId">
<summary>
考试ID
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CreditPointBase.Date"> <member name="P:Tiobon.Core.Model.Models.Ghre_CreditPointBase.Date">
<summary> <summary>
获得日期 获得日期
@ -4455,6 +4450,11 @@
预留字段12 预留字段12
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CreditPointBase.ExamId">
<summary>
考试ID
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CreditPointBase.CreditRuleId"> <member name="P:Tiobon.Core.Model.Models.Ghre_CreditPointBase.CreditRuleId">
<summary> <summary>
学分规则ID 学分规则ID
@ -8910,6 +8910,11 @@
完成状态 完成状态
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRecordBase.CreditPoints">
<summary>
学分
</summary>
</member>
<member name="T:Tiobon.Core.Model.Models.Ghre_StudyRecordDetailBase"> <member name="T:Tiobon.Core.Model.Models.Ghre_StudyRecordDetailBase">
<summary> <summary>
培训记录明细 (Dto.Base) 培训记录明细 (Dto.Base)
@ -24477,11 +24482,6 @@
课程快照ID 课程快照ID
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CreditPoint.ExamId">
<summary>
考试ID
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CreditPoint.Date"> <member name="P:Tiobon.Core.Model.Models.Ghre_CreditPoint.Date">
<summary> <summary>
获得日期 获得日期
@ -24562,6 +24562,11 @@
预留字段12 预留字段12
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CreditPoint.ExamId">
<summary>
考试ID
</summary>
</member>
<member name="P:Tiobon.Core.Model.Models.Ghre_CreditPoint.CreditRuleId"> <member name="P:Tiobon.Core.Model.Models.Ghre_CreditPoint.CreditRuleId">
<summary> <summary>
学分规则ID 学分规则ID
@ -28912,6 +28917,11 @@
完成状态 完成状态
</summary> </summary>
</member> </member>
<member name="P:Tiobon.Core.Model.Models.Ghre_StudyRecord.CreditPoints">
<summary>
学分
</summary>
</member>
<member name="T:Tiobon.Core.Model.Models.Ghre_StudyRecordDetail"> <member name="T:Tiobon.Core.Model.Models.Ghre_StudyRecordDetail">
<summary> <summary>
培训记录明细 (Model) 培训记录明细 (Model)

Loading…
Cancel
Save