diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs index 57249d58..3eb92945 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs @@ -2,7 +2,6 @@ using MongoDB.Driver.Linq; using System.Net; using System.Text.RegularExpressions; -using Tiobon.Core.Model.Models; using static Tiobon.Core.Model.Consts; namespace Tiobon.Core.Services; @@ -579,7 +578,7 @@ public class Ghre_ExamRecordServices : BaseServices= dt.Date) && + if (!(record.BeginTime.Value.Date <= dt.Date && record.EndTime.Value.Date >= dt.Date) && (record.Status == DIC_EXAM_RECORD_STATUS.WAIT || record.Status == DIC_EXAM_RECORD_STATUS.EXAMING)) { extend.IsAllowExam = false; @@ -811,6 +810,26 @@ public class Ghre_ExamRecordServices : BaseServices().Where(x => x.ConfigCode == "After_Exam_Allow_View_Result").AnyAsync() && + await Db.Queryable().Where(x => x.ConfigCode == "After_Exam_View_Result_Allow_Retake").AnyAsync()) + { + var allowViewResult = await Db.Queryable().Where(x => x.ConfigCode == "After_Exam_Allow_View_Result").Select(x => x.ConfigValue).FirstAsync(); + var allowRetake = await Db.Queryable().Where(x => x.ConfigCode == "After_Exam_View_Result_Allow_Retake").Select(x => x.ConfigValue).FirstAsync(); + + if (allowViewResult == "Y") + { + if (allowRetake == "Y" && (record.RetakeTimes ?? 0) < (exampaper.RetakeTimes ?? 0)) + extend.CanRetake = true; + else + extend.CanRetake = false; + } + else + extend.IsAllowView = false; + } + #endregion + return ServiceResult.OprateSuccess("查询成功!", extend); } @@ -897,10 +916,10 @@ public class Ghre_ExamRecordServices : BaseServices() .Where(x => x.Id == record.ExamId) - .FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED); + .FirstAsync(x => x.Status == DIC_EXAM_STATUS.RELEASED); var studyRecord = await Db.Queryable().FirstAsync(x => x.Id == record.StudyRecordId); - if (exam.DateType == Consts.DicExamDateType.AFTER_HOW_LONG) + if (exam.DateType == DicExamDateType.AFTER_HOW_LONG) { record.BeginTime = studyRecord?.EndTime; if (!record.BeginTime.IsNull()) @@ -1039,6 +1058,7 @@ public class Ghre_ExamRecordServices : BaseServices { "Status", "Score", "AdjustScore", "ActualEndTime", "ScoreStatus", "UpdateTime" }, null, $"Id='{record.Id}'"); + await Update(record, new List { "Status", "Score", "AdjustScore", "ActualEndTime", "ScoreStatus", "UpdateTime", "ExamDate" }, null, $"Id='{record.Id}'"); if (exampaper.ScoreMethod == DIC_EXAM_PAPER_SCORE_METHOD.SYSTEM) await Task.Factory.StartNew(async () => await DealPass(Db, studyRecordId));