diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_OpenClassController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_OpenClassController.cs index 995233b0..bc20d34b 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_OpenClassController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_OpenClassController.cs @@ -133,10 +133,10 @@ public class Ghre_OpenClassController : BaseController TransferOpening(long Id) => await _service.UpdateStatus([Id], "Opening"); + public async Task TransferOpening(long Id) => await _service.UpdateStatus([Id], "Opening", "TransferOpening"); [HttpPost, Route("TransferOpening")] - public async Task TransferOpening([FromBody] List Ids) => await _service.UpdateStatus(Ids, "Opening"); + public async Task TransferOpening([FromBody] List Ids) => await _service.UpdateStatus(Ids, "Opening", "TransferOpening"); #endregion #region 取消开课 diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index 989b50fc..356d673a 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -3670,14 +3670,14 @@ 关联类型 - + - 课程场景ID + 课程ID - + - 课程ID + 课程快照ID @@ -3725,6 +3725,11 @@ 考试形式 + + + 线下考试地点 + + 是否关联开班 @@ -3740,11 +3745,6 @@ 状态 - - - 线下考试地点 - - 备注 @@ -3825,6 +3825,11 @@ 默认封面图Name + + + 来源,手动维护、开班 + + 考试通知记录 (Dto.Base) @@ -4955,6 +4960,11 @@ 结案状态 + + + 考试ID + + 状态 @@ -18476,14 +18486,14 @@ 关联类型 - + - 课程场景ID + 课程ID - + - 课程ID + 课程快照ID @@ -18531,6 +18541,11 @@ 考试形式 + + + 线下考试地点 + + 是否关联开班 @@ -18546,11 +18561,6 @@ 状态 - - - 线下考试地点 - - 备注 @@ -18631,6 +18641,11 @@ 默认封面图Name + + + 来源,手动维护、开班 + + 考试通知记录 (Model) @@ -19761,6 +19776,11 @@ 结案状态 + + + 考试ID + + 状态 diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 9fc6f950..cd868e55 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -995,7 +995,13 @@ 条件 - + + + 获取考试记录明细扩展接口 + + + + 提交评语接口 diff --git a/Tiobon.Core.IServices/Ghre/IGhre_OpenClassServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_OpenClassServices.cs index 27e604b1..3db52dc1 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_OpenClassServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_OpenClassServices.cs @@ -24,5 +24,5 @@ public interface IGhre_OpenClassServices : IBaseServices InsertSummary(long Id, InsertGhre_OpenClassInput entity); - Task UpdateStatus(List ids, string status); + Task UpdateStatus(List ids, string status, string source = null); } \ No newline at end of file diff --git a/Tiobon.Core.Model/Base/Ghre/Ghre_Exam.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghre/Ghre_Exam.Dto.Base.cs index 1be0cefc..50488b56 100644 --- a/Tiobon.Core.Model/Base/Ghre/Ghre_Exam.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghre/Ghre_Exam.Dto.Base.cs @@ -6,9 +6,9 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -*V0.01 2024/5/28 18:09:05 SimonHsiao 初版 +*V0.01 2025/2/14 9:57:56 SimonHsiao 初版 * -* Copyright(c) 2024 Tiobon Corporation. All Rights Reserved. +* Copyright(c) 2025 Tiobon Corporation. All Rights Reserved. *┌──────────────────────────────────┐ *│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │ *│ 作者:SimonHsiao │ @@ -30,14 +30,14 @@ public class Ghre_ExamBase public string LinkType { get; set; } /// - /// 课程场景ID + /// 课程ID /// - public long? CourseSceneId { get; set; } + public long? CourseId { get; set; } /// - /// 课程ID + /// 课程快照ID /// - public long? CourseId { get; set; } + public long? CourseSceneId { get; set; } /// /// 试卷ID @@ -89,6 +89,12 @@ public class Ghre_ExamBase [Display(Name = "ExamMode"), Description("考试形式"), MaxLength(32, ErrorMessage = "考试形式 不能超过 32 个字符")] public string ExamMode { get; set; } + /// + /// 线下考试地点 + /// + [Display(Name = "ExamPlace"), Description("线下考试地点"), MaxLength(64, ErrorMessage = "线下考试地点 不能超过 64 个字符")] + public string ExamPlace { get; set; } + /// /// 是否关联开班 /// @@ -105,12 +111,6 @@ public class Ghre_ExamBase [Display(Name = "Status"), Description("状态"), MaxLength(32, ErrorMessage = "状态 不能超过 32 个字符")] public string Status { get; set; } - /// - /// 线下考试地点 - /// - [Display(Name = "ExamPlace"), Description("线下考试地点"), MaxLength(64, ErrorMessage = "线下考试地点 不能超过 64 个字符")] - public string ExamPlace { get; set; } - /// /// 备注 /// @@ -202,4 +202,10 @@ public class Ghre_ExamBase /// [Display(Name = "DefaultCoverImageName"), Description("默认封面图Name"), MaxLength(32, ErrorMessage = "默认封面图Name 不能超过 32 个字符")] public string DefaultCoverImageName { get; set; } + + /// + /// 来源,手动维护、开班 + /// + [Display(Name = "Source"), Description("来源,手动维护、开班"), MaxLength(32, ErrorMessage = "来源,手动维护、开班 不能超过 32 个字符")] + public string Source { get; set; } } diff --git a/Tiobon.Core.Model/Base/Ghre/Ghre_OpenClass.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghre/Ghre_OpenClass.Dto.Base.cs index b052f20f..374d8bdc 100644 --- a/Tiobon.Core.Model/Base/Ghre/Ghre_OpenClass.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghre/Ghre_OpenClass.Dto.Base.cs @@ -194,6 +194,11 @@ public class Ghre_OpenClassBase /// public int? CloseStatus { get; set; } + /// + /// 考试ID + /// + public long? ExamId { get; set; } + /// /// 状态 /// diff --git a/Tiobon.Core.Model/Models/Ghre/Ghre_Exam.cs b/Tiobon.Core.Model/Models/Ghre/Ghre_Exam.cs index 8710cf51..cfbfa880 100644 --- a/Tiobon.Core.Model/Models/Ghre/Ghre_Exam.cs +++ b/Tiobon.Core.Model/Models/Ghre/Ghre_Exam.cs @@ -6,9 +6,9 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -*V0.01 2024/5/28 18:09:05 SimonHsiao 初版 +*V0.01 2025/2/14 9:57:56 SimonHsiao 初版 * -* Copyright(c) 2024 Tiobon Corporation. All Rights Reserved. +* Copyright(c) 2025 Tiobon Corporation. All Rights Reserved. *┌──────────────────────────────────┐ *│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │ *│ 作者:SimonHsiao │ @@ -31,14 +31,14 @@ public class Ghre_Exam : BasePoco public string LinkType { get; set; } /// - /// 课程场景ID + /// 课程ID /// - public long? CourseSceneId { get; set; } + public long? CourseId { get; set; } /// - /// 课程ID + /// 课程快照ID /// - public long? CourseId { get; set; } + public long? CourseSceneId { get; set; } /// /// 试卷ID @@ -90,6 +90,12 @@ public class Ghre_Exam : BasePoco [Display(Name = "ExamMode"), Description("考试形式"), MaxLength(32, ErrorMessage = "考试形式 不能超过 32 个字符")] public string ExamMode { get; set; } + /// + /// 线下考试地点 + /// + [Display(Name = "ExamPlace"), Description("线下考试地点"), MaxLength(64, ErrorMessage = "线下考试地点 不能超过 64 个字符")] + public string ExamPlace { get; set; } + /// /// 是否关联开班 /// @@ -106,12 +112,6 @@ public class Ghre_Exam : BasePoco [Display(Name = "Status"), Description("状态"), MaxLength(32, ErrorMessage = "状态 不能超过 32 个字符")] public string Status { get; set; } - /// - /// 线下考试地点 - /// - [Display(Name = "ExamPlace"), Description("线下考试地点"), MaxLength(64, ErrorMessage = "线下考试地点 不能超过 64 个字符")] - public string ExamPlace { get; set; } - /// /// 备注 /// @@ -203,4 +203,10 @@ public class Ghre_Exam : BasePoco /// [Display(Name = "DefaultCoverImageName"), Description("默认封面图Name"), MaxLength(32, ErrorMessage = "默认封面图Name 不能超过 32 个字符")] public string DefaultCoverImageName { get; set; } + + /// + /// 来源,手动维护、开班 + /// + [Display(Name = "Source"), Description("来源,手动维护、开班"), MaxLength(32, ErrorMessage = "来源,手动维护、开班 不能超过 32 个字符")] + public string Source { get; set; } } diff --git a/Tiobon.Core.Model/Models/Ghre/Ghre_OpenClass.cs b/Tiobon.Core.Model/Models/Ghre/Ghre_OpenClass.cs index dea14606..e910b3f8 100644 --- a/Tiobon.Core.Model/Models/Ghre/Ghre_OpenClass.cs +++ b/Tiobon.Core.Model/Models/Ghre/Ghre_OpenClass.cs @@ -195,6 +195,11 @@ public class Ghre_OpenClass : BasePoco /// public int? CloseStatus { get; set; } + /// + /// 考试ID + /// + public long? ExamId { get; set; } + /// /// 状态 /// diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs index 52f60255..f45f96a6 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs @@ -1244,7 +1244,7 @@ public class Ghre_ExamServices : BaseServices (x.Status == DIC_EXAM_STATUS.RELEASED && x.CourseId == entity.CourseId && x.Id != id) || ids1.Contains(x.Id)); + var exams = await base.Query(x => (x.Source == null && 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++) { @@ -1268,7 +1268,7 @@ public class Ghre_ExamServices : BaseServices (x.Status == DIC_EXAM_STATUS.RELEASED && x.CourseSceneId == entity.CourseSceneId && x.Id != id) || ids1.Contains(x.Id)); + var exams = await base.Query(x => (x.Source == null && 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++) { diff --git a/Tiobon.Core.Services/Ghre/Ghre_OpenClassServices.cs b/Tiobon.Core.Services/Ghre/Ghre_OpenClassServices.cs index 035d7049..6ec20902 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_OpenClassServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_OpenClassServices.cs @@ -1,7 +1,4 @@ -using MathNet.Numerics.Distributions; -using Microsoft.EntityFrameworkCore.Metadata.Internal; - -namespace Tiobon.Core.Services; +namespace Tiobon.Core.Services; /// /// 开班管理 (服务) @@ -311,12 +308,81 @@ public class Ghre_OpenClassServices : BaseServices UpdateStatus(List ids, string status) + [UseTran] + public async Task UpdateStatus(List ids, string status, string source = null) { - await Db.Updateable() - .SetColumns(it => new Ghre_OpenClass() { Status = status }) + + switch (source) + { + case "TransferOpening": + + #region 转入开课,开班自动产生考试数据 + var list = await Query(x => ids.Contains(x.Id)); + for (int i = 0; i < list.Count; i++) + { + var entity = list[i]; + + if (entity.ExamId.IsNullOrEmpty()) + { + var exam = new Ghre_Exam() + { + ExamNo = entity.OpenClassNo, + ExamName = entity.OpenClassName, + UseDefaultCoverImage = true, + DateType = "ExamDate", + BeginTime = entity.ExamStartTime, + EndTime = entity.ExamEndTime, + ExamMode = "Online", + IsLinkOpenClass = true, + Status = "Released", + LinkType = entity.LinkType == "Course" ? "CourseId" : "CourseSceneId", + CourseId = entity.LinkType == "Course" ? entity.LinkId : null, + CourseSceneId = entity.LinkType == "CourseScene" ? entity.LinkId : null, + ExamPaperId = entity.ExamPaperId, + Source = "OpenClass" + }; + var examId = await Db.Insertable(exam).ExecuteReturnSnowflakeIdAsync(); + + await Db.Updateable() + .SetColumns(it => new Ghre_OpenClass() { Status = status, ExamId = examId }) + .Where(it => it.Id == entity.Id) + .ExecuteCommandAsync(); + } + else + { + await Db.Updateable() + .SetColumns(it => new Ghre_Exam() + { + ExamNo = entity.OpenClassNo, + ExamName = entity.OpenClassName, + BeginTime = entity.ExamStartTime, + EndTime = entity.ExamEndTime, + LinkType = entity.LinkType == "Course" ? "CourseId" : "CourseSceneId", + CourseId = entity.LinkType == "Course" ? entity.LinkId : null, + CourseSceneId = entity.LinkType == "CourseScene" ? entity.LinkId : null, + ExamPaperId = entity.ExamPaperId + }) + .Where(it => it.Id == entity.ExamId) + .ExecuteCommandAsync(); + + await Db.Updateable() + .SetColumns(it => new Ghre_OpenClass() { Status = status }) + .Where(it => it.Id == entity.Id) + .ExecuteCommandAsync(); + } + } + #endregion + + break; + default: + await Db.Updateable() + .SetColumns(it => new Ghre_OpenClass() { Status = status }) .Where(it => ids.Contains(it.Id)) .ExecuteCommandAsync(); + break; + } + + return ServiceResult.OprateSuccess(); } #endregion