diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs index ece7124a..0cdaa8d7 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs @@ -44,4 +44,16 @@ public class Ghre_ExamRecordController : BaseController + /// 提交评语接口 + /// + /// + /// + /// + [HttpPost("Comment/{examRecordId}")] + public async Task CommentAsync([FromBody] Ghre_ExamRecordExtend extend, long examRecordId) + { + return await _service.CommentAsync(extend, examRecordId); + } } \ No newline at end of file diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 52cef6eb..6d7a55f4 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -796,6 +796,14 @@ + + + 获取考试记录明细扩展接口 + + + + + Ghre_ExamRecordDetail(Controller) diff --git a/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs index 37d08c5c..0bacdfe9 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs @@ -15,5 +15,7 @@ namespace Tiobon.Core.IServices Task ModifyAdjustScore(string examRecordId, EditGhre_ExamRecordInput edit); Task> ExtendAsync(long examRecordId); + + Task CommentAsync(Ghre_ExamRecordExtend extend, long examRecordId); } } \ No newline at end of file diff --git a/Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamPaperInput.cs b/Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamPaperInput.cs index d137373b..aa9cf6b7 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamPaperInput.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamPaperInput.cs @@ -44,8 +44,7 @@ public class DefaultGhre_ExamPaperPageData public List examPaperSetData { get; set; } = new List { }; public List previewList { get; set; } = new List { }; public List questionList { get; set; } = new List { }; - - public CommentData CommentData { get; set; } + } public class DefaultGhre_ExamPaperBaseData : Ghre_ExamPaperBase @@ -53,18 +52,6 @@ public class DefaultGhre_ExamPaperBaseData : Ghre_ExamPaperBase public long? CourseId { get; set; } public long? CourseSceneId { get; set; } } - -public class CommentData -{ - public string Comment { get; set; } - public string StaffNo { get; set; } - public string StaffName { get; set; } - public string DeptNo { get; set; } - public string DepteName { get; set; } - public string PhotoUrl { get; set; } - public string TitleName { get; set; } - public bool? IsFirstTime { get; set; } = false; -} public class DefaultGhre_ExamPaperStyleInfo { public string coverImage { get; set; } diff --git a/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs b/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs index b31083fa..f80c7861 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs @@ -3,7 +3,7 @@ public class Ghre_ExamRecordExtend : DefaultGhre_ExamPaperPageData { - public Ghre_ExamRecordExtendComment commentData { get; set; } + public CommentData CommentData { get; set; } public StaffInfo StaffInfo { get; set; } public long? PreviousRecordId { get; set; } @@ -12,15 +12,16 @@ public class Ghre_ExamRecordExtend : DefaultGhre_ExamPaperPageData } -public class Ghre_ExamRecordExtendComment +public class CommentData { - public string commentText { get; set; } - public string commentStaffName { get; set; } - public string commentStaffNo { get; set; } - public string commentStaffPhoto { get; set; } - public string commentDeptName { get; set; } - public string commentTitleName { get; set; } - public bool? isFirstTime { get; set; } + public string Comment { get; set; } + public string StaffNo { get; set; } + public string StaffName { get; set; } + public string DeptNo { get; set; } + public string DepteName { get; set; } + public string PhotoUrl { get; set; } + public string TitleName { get; set; } + public bool? IsFirstTime { get; set; } = false; } public class StaffInfo diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs index ebd2c877..27f97611 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs @@ -168,8 +168,8 @@ public class Ghre_ExamRecordServices : BaseServices x.TaxisNo) .Where(x => x.ExamRecordDetailId != null && detailIds.Contains(x.ExamRecordDetailId.Value)) .ToListAsync(); - - await ExamHelper.SystemMarkAsync(Db, record, details, recordAnswers); + if (record.ScoreStatus == "NoScore") + await ExamHelper.SystemMarkAsync(Db, record, details, recordAnswers); var exampaper = await Db.Queryable().FirstAsync(x => x.Id == record.ExamPaperId); var baseData = new DefaultGhre_ExamPaperBaseData(); @@ -276,6 +276,7 @@ public class Ghre_ExamRecordServices : BaseServices(sql); + extend.StaffInfo.StaffScore = record.Score != null ? record.Score.Value : 0; sql = @$"SELECT A.StaffNo, A.StaffName, @@ -309,4 +310,26 @@ public class Ghre_ExamRecordServices : BaseServices.OprateSuccess("查询成功!", extend); } + + public async Task CommentAsync(Ghre_ExamRecordExtend extend, long examRecordId) + { + + var record = await QuerySingle(x => x.Id == examRecordId); + record.Score = extend.StaffInfo.StaffScore; + record.ScoreStatus = "HasScore"; + record.Comment = extend.CommentData.Comment; + var details = await Db.Queryable().Where(x => x.ExamRecordId == record.Id).ToListAsync(); + + extend.questionList.ForEach(x => + { + var recordDetail = details.FirstOrDefault(m => m.ExamPaperQuestionId == x.Id); + recordDetail.Score = x.Score; + recordDetail.IsCorrect = x.Score == x.RealScore ? true : false; + }); + + await Db.Updateable(record).ExecuteCommandAsync(); + await Db.Updateable(details).ExecuteCommandAsync(); + + return ServiceResult.OprateSuccess("提交成功!"); + } } \ No newline at end of file diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 52cef6eb..6d7a55f4 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -796,6 +796,14 @@ + + + 获取考试记录明细扩展接口 + + + + + Ghre_ExamRecordDetail(Controller)