From 9ecf34048bc59335319bddaa1fef6a6335c2040e Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Fri, 7 Mar 2025 14:37:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E8=80=83=E8=AF=95=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=EF=BC=8C=E6=96=B0=E5=A2=9E=E9=A4=90=E5=AE=BF=E5=88=A4?= =?UTF-8?q?=E6=96=AD,=E8=80=83=E5=AE=8C=EF=BC=8C=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E6=9F=A5=E7=9C=8B=E7=AD=94=E6=A1=88=E5=92=8C?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E3=80=81=E8=80=83=E5=AE=8C=EF=BC=8C=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E7=AD=94=E6=A1=88=E5=92=8C=E8=A7=A3=E6=9E=90=E5=90=8E?= =?UTF-8?q?=EF=BC=8C=E6=98=AF=E5=90=A6=E5=85=81=E8=AE=B8=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E8=80=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_ExamRecordServices.cs | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) 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));