diff --git a/Tiobon.Core.Model/Consts.cs b/Tiobon.Core.Model/Consts.cs
index c4023e10..b8b27d31 100644
--- a/Tiobon.Core.Model/Consts.cs
+++ b/Tiobon.Core.Model/Consts.cs
@@ -160,6 +160,28 @@ public class Consts
}
#endregion
+ #region 考试管理-学习完成标准
+ ///
+ /// 考试管理-学习完成标准
+ ///
+ public static class DIC_EXAM_STUDY_FINISHED_RULE
+ {
+ ///
+ /// 学习完成+考试合格
+ ///
+ public const string EXAM_PASS = "ExamPass";
+ ///
+ /// 学习完成
+ ///
+ public const string STUDY_FINISHED = "StudyFinished";
+ ///
+ /// 不学习但考试合格
+ ///
+ public const string NO_STUDY_EXAM_PASS = "NoStudyExamPass";
+
+ }
+ #endregion
+
#endregion
#region 必选修规则
@@ -249,6 +271,25 @@ public class Consts
#endregion
+ #region 培训记录-学习状态
+ ///
+ /// 培训记录-学习状态
+ ///
+
+ public static class DIC_STUDY_RECORD_STUDY_COMPLETE_STATUS
+ {
+ ///
+ /// 已完成
+ ///
+ public const string FINISHED = "Finished";
+ ///
+ /// 未完成
+ ///
+ public const string NO_FINISH = "NoFinish";
+ }
+
+ #endregion
+
#region 考试记录
#region 考试记录-状态
diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs
index 3fea4edf..4b5d005f 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs
@@ -285,8 +285,9 @@ public class Ghre_StudyRecordServices : BaseServices x.StaffId == entity.StaffId))
throw new Exception("该用户存在相同学习记录!");
-
entity.StudyStatus = "HasFinish";
+ entity.CompleteStatus = DIC_STUDY_RECORD_STUDY_COMPLETE_STATUS.FINISHED;
+
var snap = await Db.Queryable().FirstAsync(x => x.CourseId == entity.CourseId);
entity.CourseSnapId = snap?.Id;
@@ -1372,6 +1373,7 @@ WHERE A.Status !='Temporary' AND ( EXISTS
//CourseType = rule.RuleType,
CourseStatus = DIC_STUDY_RECORD_COURSE_STATUS_IN,
StudyStatus = DIC_STUDY_RECORD_STUDY_STATUS.NO_JOIN,
+ CompleteStatus = DIC_STUDY_RECORD_STUDY_COMPLETE_STATUS.NO_FINISH,
OpenClassId = openClass.Id,
PlanId = openClass.PlanId
};
@@ -1679,6 +1681,7 @@ WHERE A.Id = '{id}'";
CourseType = "ManualElective",
CourseStatus = DIC_STUDY_RECORD_COURSE_STATUS_IN,
StudyStatus = DIC_STUDY_RECORD_STUDY_STATUS.NO_JOIN,
+ CompleteStatus = DIC_STUDY_RECORD_STUDY_COMPLETE_STATUS.NO_FINISH,
ExamId = exam?.Id
});
@@ -1801,18 +1804,60 @@ WHERE A.Id = '{id}'";
#endregion
var studyStatus = DIC_STUDY_RECORD_STUDY_STATUS.NO_FINISH;
+
+ var completeStatus = record.CompleteStatus ?? DIC_STUDY_RECORD_STUDY_COMPLETE_STATUS.NO_FINISH;
+
+ //处理学习记录完成状态
if (studyProgress == 100)
+ {
studyStatus = DIC_STUDY_RECORD_STUDY_STATUS.HAS_FINISH;
+ if (completeStatus == DIC_STUDY_RECORD_STUDY_COMPLETE_STATUS.NO_FINISH)
+
+ if (record.ExamId.IsNullOrEmpty())
+ {
+ if (record.CourseSceneId.IsNotEmptyOrNull() || (record.CourseId != null && await Db.Queryable().AnyAsync(x => x.Id == record.CourseId && x.ExamPaperId == null)))
+ completeStatus = DIC_STUDY_RECORD_STUDY_COMPLETE_STATUS.FINISHED;
+ }
+ else
+ {
+ if (await Db.Queryable().AnyAsync(x => x.Id == record.ExamId && x.StudyFinishedRule == DIC_EXAM_STUDY_FINISHED_RULE.STUDY_FINISHED))
+ completeStatus = DIC_STUDY_RECORD_STUDY_COMPLETE_STATUS.FINISHED;
+ }
+ }
+
+ var studyProgress1 = studyProgress.ObjToInt();
+ if (studyProgress > 0)
+ await Db.Updateable()
+ .SetColumns(it => new Ghre_StudyRecord()
+ {
+ StudyProgress = studyProgress1,
+ StudyStatus = studyStatus,
+ StandardDuration = mins,
+ CompleteStatus = completeStatus,
+ ReverseI1 = 1
+ })
+ .Where(it => it.Id == studyRecordId)
+ .ExecuteCommandAsync();
+
+ await Db.Updateable()
+ .SetColumns(it => new Ghre_StudyRecord()
+ {
+ BeginTime = DateTime.Now,
+ StudyStatus = studyStatus,
+ })
+ .Where(it => it.Id == studyRecordId && it.BeginTime == null)
+ .ExecuteCommandAsync();
- sql = $"UPDATE Ghre_StudyRecord SET StudyProgress = {studyProgress},StudyStatus='{studyStatus}',StandardDuration='{mins}' WHERE Id='{studyRecordId}'";
- if (studyProgress > 0) await Db.Ado.ExecuteCommandAsync(sql);
- sql = $"UPDATE Ghre_StudyRecord SET BeginTime=GETDATE(),StudyStatus='{studyStatus}' WHERE BeginTime IS NULL AND Id='{studyRecordId}'";
- await Db.Ado.ExecuteCommandAsync(sql);
if (studyProgress == 100)
{
- sql = $"UPDATE Ghre_StudyRecord SET EndTime=GETDATE() WHERE EndTime IS NULL AND Id='{studyRecordId}'";
- await Db.Ado.ExecuteCommandAsync(sql);
+ await Db.Updateable()
+ .SetColumns(it => new Ghre_StudyRecord()
+ {
+ EndTime = DateTime.Now,
+ })
+ .Where(it => it.Id == studyRecordId && it.EndTime == null)
+ .ExecuteCommandAsync();
}
return true;
}