考试结束 积分发放新增场景积分发放

master
xiaochanghai 10 months ago
parent 790ef01edc
commit 1ac5bcaf05
  1. 28
      Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs

@ -907,9 +907,11 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
await Db.Updateable(record).UpdateColumns(it => new { it.IsPass }, true)//true表示追加AOP赋值列 await Db.Updateable(record).UpdateColumns(it => new { it.IsPass }, true)//true表示追加AOP赋值列
.ExecuteCommandAsync(); .ExecuteCommandAsync();
await Db.Deleteable<Ghre_CreditPoint>().Where(x => x.ExamId == studyRecord.ExamId).ExecuteCommandAsync();
if (record.IsPass == true) if (record.IsPass == true)
{ {
if (studyRecord.CourseSceneId.IsNull() && !await Db.Queryable<Ghre_CreditPoint>().AnyAsync(x => x.ExamId == studyRecord.ExamId)) if (studyRecord.CourseSceneId.IsNull())
{ {
var course = await Db.Queryable<Ghre_Course>().FirstAsync(x => x.Id == studyRecord.CourseId); var course = await Db.Queryable<Ghre_Course>().FirstAsync(x => x.Id == studyRecord.CourseId);
#region 学分发放 #region 学分发放
@ -930,6 +932,30 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
#endregion #endregion
} }
else
{
var courses = await Db.Queryable<Ghre_Course>().Where(x => x.CourseSceneId == studyRecord.CourseSceneId).ToListAsync();
for (int i = 0; i < courses.Count; i++)
{
var snap = await Db.Queryable<Ghre_CourseSnap>().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
}
}
} }

Loading…
Cancel
Save