From 030fdd1931a6d59f5bc77e1cea41547038ad821e Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Thu, 8 Aug 2024 14:27:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=80=83=E8=AF=95=E5=8F=91?= =?UTF-8?q?=E5=B8=83=EF=BC=8C=E6=A0=A1=E9=AA=8C=E6=89=B9=E9=87=8F=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=98=AF=E5=90=A6=E9=87=8D=E5=8F=A0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_ExamServices.cs | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs index 61f764d3..1eee64a7 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs @@ -18,6 +18,7 @@ using Tiobon.Core.Common.DB.Dapper; using Tiobon.Core.Common.Helper; using System.Data; using static Tiobon.Core.Model.Consts; +using Org.BouncyCastle.Crypto; namespace Tiobon.Core.Services; @@ -1186,10 +1187,10 @@ public class Ghre_ExamServices : BaseServices x.ExamId == id && x.Status == DIC_EXAM_RECORD_STATUS.EXAMING)) + if (entity.Status == DIC_EXAM_STATUS.RELEASED && status == DIC_EXAM_STATUS.DRAFT && await _ghre_ExamRecordServices.AnyAsync(x => x.ExamId == id && x.Status == DIC_EXAM_RECORD_STATUS.EXAMING)) return ServiceResult.OprateFailed("已有学员参与考试,不可取消发布!"); - if (entity.Status == Consts.DIC_EXAM_STATUS.DISABLED && status == Consts.DIC_EXAM_STATUS.RELEASED) + if (entity.Status == DIC_EXAM_STATUS.DISABLED && status == DIC_EXAM_STATUS.RELEASED) { if (entity.LinkType == "CourseId") { @@ -1207,21 +1208,23 @@ public class Ghre_ExamServices : BaseServices id != x).ToList(); + if (entity.LinkType == DIC_EXAM_LINK_TYPE_COURSE) { #region 校验同一个课程下 考试时间不允许重叠 - var exams = await base.Query(x => x.Status == Consts.DIC_EXAM_STATUS.RELEASED && x.CourseId == entity.CourseId && x.Id != id); + var exams = await base.Query(x => (x.Status == DIC_EXAM_STATUS.RELEASED && x.CourseId == entity.CourseId && x.Id != id) || ids1.Contains(x.Id)); if (exams.Any()) for (int i = 0; i < exams.Count; i++) { var exam = exams[i]; var course = await _ghre_CourseServices.QuerySingle(entity.CourseId); - if (exam.DateType != entity.DateType || exam.DateType == Consts.DicExamDateType.AFTER_HOW_LONG) + if (exam.DateType != entity.DateType || exam.DateType == DicExamDateType.AFTER_HOW_LONG) return ServiceResult.OprateFailed($"课程【{course.CourseName}】已存在有效的考试管理数据【{exam.ExamName}({exam.ExamNo})】!"); - else if (exam.DateType == Consts.DicExamDateType.EXAM_DATE) + else if (exam.DateType == DicExamDateType.EXAM_DATE) { if ((entity.BeginTime >= exam.BeginTime && entity.BeginTime <= exam.EndTime) || (entity.EndTime >= exam.BeginTime && entity.EndTime <= exam.EndTime) @@ -1235,16 +1238,16 @@ public class Ghre_ExamServices : BaseServices x.Status == Consts.DIC_EXAM_STATUS.RELEASED && x.CourseSceneId == entity.CourseSceneId && x.Id != id); + var exams = await base.Query(x => (x.Status == DIC_EXAM_STATUS.RELEASED && x.CourseSceneId == entity.CourseSceneId && x.Id != id) || ids1.Contains(x.Id)); if (exams.Any()) for (int i = 0; i < exams.Count; i++) { var exam = exams[i]; var course = await _ghre_CourseSceneServices.QuerySingle(entity.CourseSceneId); - if (exam.DateType != entity.DateType || exam.DateType == Consts.DicExamDateType.AFTER_HOW_LONG) + if (exam.DateType != entity.DateType || exam.DateType == DicExamDateType.AFTER_HOW_LONG) return ServiceResult.OprateFailed($"课程场景【{course.CourseName}】已存在有效的考试管理数据【{exam.ExamName}({exam.ExamNo})】!"); - else if (exam.DateType == Consts.DicExamDateType.EXAM_DATE) + else if (exam.DateType == DicExamDateType.EXAM_DATE) { if ((entity.BeginTime >= exam.BeginTime && entity.BeginTime <= exam.EndTime) || (entity.EndTime >= exam.BeginTime && entity.EndTime <= exam.EndTime)