|
|
|
@ -285,8 +285,9 @@ public class Ghre_StudyRecordServices : BaseServices<Ghre_StudyRecord, Ghre_Stud |
|
|
|
|
.AnyAsync(x => x.StaffId == entity.StaffId)) |
|
|
|
|
throw new Exception("该用户存在相同学习记录!"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
entity.StudyStatus = "HasFinish"; |
|
|
|
|
entity.CompleteStatus = DIC_STUDY_RECORD_STUDY_COMPLETE_STATUS.FINISHED; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var snap = await Db.Queryable<Ghre_CourseSnap>().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<Ghre_Course>().AnyAsync(x => x.Id == record.CourseId && x.ExamPaperId == null))) |
|
|
|
|
completeStatus = DIC_STUDY_RECORD_STUDY_COMPLETE_STATUS.FINISHED; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
if (await Db.Queryable<Ghre_Exam>().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<Ghre_StudyRecord>() |
|
|
|
|
.SetColumns(it => new Ghre_StudyRecord() |
|
|
|
|
{ |
|
|
|
|
StudyProgress = studyProgress1, |
|
|
|
|
StudyStatus = studyStatus, |
|
|
|
|
StandardDuration = mins, |
|
|
|
|
CompleteStatus = completeStatus, |
|
|
|
|
ReverseI1 = 1 |
|
|
|
|
}) |
|
|
|
|
.Where(it => it.Id == studyRecordId) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
|
|
|
|
|
await Db.Updateable<Ghre_StudyRecord>() |
|
|
|
|
.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<Ghre_StudyRecord>() |
|
|
|
|
.SetColumns(it => new Ghre_StudyRecord() |
|
|
|
|
{ |
|
|
|
|
EndTime = DateTime.Now, |
|
|
|
|
}) |
|
|
|
|
.Where(it => it.Id == studyRecordId && it.EndTime == null) |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|