From 1ac5bcaf0571a2681bf5036b2383de31a9f269d9 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Tue, 13 Aug 2024 16:04:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E8=AF=95=E7=BB=93=E6=9D=9F=20?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E5=8F=91=E6=94=BE=E6=96=B0=E5=A2=9E=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E7=A7=AF=E5=88=86=E5=8F=91=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_ExamRecordServices.cs | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs index b54802df..7da62d68 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs @@ -907,9 +907,11 @@ public class Ghre_ExamRecordServices : BaseServices new { it.IsPass }, true)//true表示追加AOP赋值列 .ExecuteCommandAsync(); + await Db.Deleteable().Where(x => x.ExamId == studyRecord.ExamId).ExecuteCommandAsync(); + if (record.IsPass == true) { - if (studyRecord.CourseSceneId.IsNull() && !await Db.Queryable().AnyAsync(x => x.ExamId == studyRecord.ExamId)) + if (studyRecord.CourseSceneId.IsNull()) { var course = await Db.Queryable().FirstAsync(x => x.Id == studyRecord.CourseId); #region 学分发放 @@ -930,6 +932,30 @@ public class Ghre_ExamRecordServices : BaseServices().Where(x => x.CourseSceneId == studyRecord.CourseSceneId).ToListAsync(); + + for (int i = 0; i < courses.Count; i++) + { + var snap = await Db.Queryable().FirstAsync(x => x.CourseId == courses[i].Id); + + #region 学分发放 + var creditPoint = new Ghre_CreditPoint() + { + CourseId = courses[i].Id, + CourseSnapId = snap?.Id, + StaffId = studyRecord.StaffId, + ExamId = studyRecord.ExamId, + Date = DateTime.Now.Date, + CreditPoints = courses[i].CreditPoints + }; + + await Db.Insertable(creditPoint).ExecuteReturnSnowflakeIdListAsync(); + #endregion + } + + } }