提交评语接口

master
xiaochanghai 12 months ago
parent 43d46a5bd9
commit a9f1ab07aa
  1. 12
      Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs
  2. 8
      Tiobon.Core.Api/Tiobon.Core.xml
  3. 2
      Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs
  4. 13
      Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamPaperInput.cs
  5. 19
      Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs
  6. 25
      Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs
  7. 8
      Tiobon.Core/Tiobon.Core.xml

@ -44,4 +44,16 @@ public class Ghre_ExamRecordController : BaseController<IGhre_ExamRecordServices
{
return await _service.ExtendAsync(examRecordId);
}
/// <summary>
/// 提交评语接口
/// </summary>
/// <param name="extend"></param>
/// <param name="examRecordId"></param>
/// <returns></returns>
[HttpPost("Comment/{examRecordId}")]
public async Task<ServiceResult> CommentAsync([FromBody] Ghre_ExamRecordExtend extend, long examRecordId)
{
return await _service.CommentAsync(extend, examRecordId);
}
}

@ -796,6 +796,14 @@
<param name="examRecordId"></param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_ExamRecordController.CommentAsync(Tiobon.Core.Model.Ghre_ExamRecordExtend,System.Int64)">
<summary>
获取考试记录明细扩展接口
</summary>
<param name="extend"></param>
<param name="examRecordId"></param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_ExamRecordDetailController">
<summary>
Ghre_ExamRecordDetail(Controller)

@ -15,5 +15,7 @@ namespace Tiobon.Core.IServices
Task<ServiceResult> ModifyAdjustScore(string examRecordId, EditGhre_ExamRecordInput edit);
Task<ServiceResult<Ghre_ExamRecordExtend>> ExtendAsync(long examRecordId);
Task<ServiceResult> CommentAsync(Ghre_ExamRecordExtend extend, long examRecordId);
}
}

@ -45,7 +45,6 @@ public class DefaultGhre_ExamPaperPageData
public List<DefaultGhre_ExamPaperPreview> previewList { get; set; } = new List<DefaultGhre_ExamPaperPreview> { };
public List<DefaultGhre_ExamPaperPreview> questionList { get; set; } = new List<DefaultGhre_ExamPaperPreview> { };
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; }

@ -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

@ -168,7 +168,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
.OrderBy(x => x.TaxisNo)
.Where(x => x.ExamRecordDetailId != null && detailIds.Contains(x.ExamRecordDetailId.Value))
.ToListAsync();
if (record.ScoreStatus == "NoScore")
await ExamHelper.SystemMarkAsync(Db, record, details, recordAnswers);
var exampaper = await Db.Queryable<Ghre_ExamPaper>().FirstAsync(x => x.Id == record.ExamPaperId);
@ -276,6 +276,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe
WHERE StaffID = {record.StaffId}";
extend.StaffInfo = await Db.Ado.SqlQuerySingleAsync<StaffInfo>(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<Ghre_ExamRecord, Ghre_ExamRe
return ServiceResult<Ghre_ExamRecordExtend>.OprateSuccess("查询成功!", extend);
}
public async Task<ServiceResult> 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<Ghre_ExamRecordDetail>().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("提交成功!");
}
}

@ -796,6 +796,14 @@
<param name="examRecordId"></param>
<returns></returns>
</member>
<member name="M:Tiobon.Core.Api.Controllers.Ghre_ExamRecordController.CommentAsync(Tiobon.Core.Model.Ghre_ExamRecordExtend,System.Int64)">
<summary>
获取考试记录明细扩展接口
</summary>
<param name="extend"></param>
<param name="examRecordId"></param>
<returns></returns>
</member>
<member name="T:Tiobon.Core.Api.Controllers.Ghre_ExamRecordDetailController">
<summary>
Ghre_ExamRecordDetail(Controller)

Loading…
Cancel
Save