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

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

@ -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
/// </summary>
[Display(Name = "CompleteStatus"), Description("完成状态"), MaxLength(32, ErrorMessage = "完成状态 不能超过 32 个字符")]
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
*
*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
/// </summary>
public long? CourseSnapId { get; set; }
/// <summary>
/// 考试ID
/// </summary>
public long? ExamId { get; set; }
/// <summary>
/// 获得日期
/// </summary>
@ -52,7 +47,8 @@ public class Ghre_CreditPoint : BasePoco
/// <summary>
/// 获得学分
/// </summary>
public int? CreditPoints { get; set; }
[Display(Name = "CreditPoints"), Description("获得学分"), Column(TypeName = "decimal(20,2)")]
public decimal? CreditPoints { get; set; }
/// <summary>
/// 备注
@ -135,6 +131,11 @@ public class Ghre_CreditPoint : BasePoco
/// </summary>
public int? ReverseI2 { get; set; }
/// <summary>
/// 考试ID
/// </summary>
public long? ExamId { get; set; }
/// <summary>
/// 学分规则ID
/// </summary>

@ -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
/// </summary>
[Display(Name = "CompleteStatus"), Description("完成状态"), MaxLength(32, ErrorMessage = "完成状态 不能超过 32 个字符")]
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())
{
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)
continue;
record.CreditPoints = 0;
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.ScoreRange,
@ -2328,16 +2331,16 @@ ORDER BY {filter.orderBy}";
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)
{
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("发放成功!");
}

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

Loading…
Cancel
Save