diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs index e33db066..a4f530ad 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs @@ -80,6 +80,18 @@ public class Ghre_ExamRecordController : BaseController + /// 重新考试 + /// + /// + /// + [HttpPost("RetakeExam/{examRecordId}")] + public async Task RetakeExamAsync(long examRecordId) + { + return await _service.RetakeExamAsync(examRecordId); + } + + /// /// 答题 /// diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 82bd85b5..3211ef17 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -855,6 +855,13 @@ + + + 重新考试 + + + + 答题 diff --git a/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs index 2a128ba6..793d596a 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs @@ -22,6 +22,8 @@ namespace Tiobon.Core.IServices Task StartExamAsync(long examRecordId); + Task RetakeExamAsync(long examRecordId); + Task AnswerExamAsync(List answers, long studyRecordId); } } \ No newline at end of file diff --git a/Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs b/Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs index c5fdda0b..15fbc742 100644 --- a/Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs +++ b/Tiobon.Core.Model/View/Ghre/Ghre_ExamRecord.Dto.View.cs @@ -45,7 +45,8 @@ public class Ghre_ExamRecordDto : Ghre_ExamRecord public string StaffPhotoUrl { get; set; } public string ExamNo { get; set; } public string ExamName { get; set; } - + public string CourseName { get; set; } + public decimal? TotalScore { get; set; } = 0; diff --git a/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs b/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs index db92fd53..bdedb826 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs @@ -84,12 +84,12 @@ public class QueryExam : DefaultGhre_ExamPaperPageData /// /// 可重考 /// - public string CanRetake { get; set; } + public bool? CanRetake { get; set; } /// /// 出分中 /// - public string ScoreOut { get; set; } + public bool? ScoreOut { get; set; } /// /// 出分时间 diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs index c9cf073e..afcc8715 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs @@ -554,10 +554,23 @@ public class Ghre_ExamRecordServices : BaseServices.OprateSuccess("查询成功!", extend); } @@ -593,6 +606,25 @@ public class Ghre_ExamRecordServices : BaseServices RetakeExamAsync(long examRecordId) + { + var entity = await base.QuerySingle(examRecordId); + + if (entity is null) + return ServiceResult.OprateFailed("无效的考试ID!"); + + if (entity.Status == "ExamEnd") + entity.Status = "Examing"; + + entity.RetakeTimes = entity.RetakeTimes is null ? 1 : entity.RetakeTimes + 1; + + await Update(entity, new List() + { + "Status","RetakeTimes" + }); + + return ServiceResult.OprateSuccess("成功!"); + } public async Task AnswerExamAsync(List answers, long studyRecordId) { var record = await base.QuerySingle(x => x.Id == studyRecordId); @@ -690,8 +722,21 @@ public class Ghre_ExamRecordServices : BaseServices { "Status", "Score", "ActualEndTime" }, null, $"Id='{record.Id}'"); return ServiceResult.OprateSuccess("提交成功!"); } } \ No newline at end of file diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 82bd85b5..3211ef17 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -855,6 +855,13 @@ + + + 重新考试 + + + + 答题