|
|
@ -463,6 +463,15 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
await Db.Updateable(record).ExecuteCommandAsync(); |
|
|
|
await Db.Updateable(record).ExecuteCommandAsync(); |
|
|
|
await Db.Updateable(details).ExecuteCommandAsync(); |
|
|
|
await Db.Updateable(details).ExecuteCommandAsync(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var groupId = details.First()?.GroupId; |
|
|
|
|
|
|
|
var group = await Db.Queryable<Ghre_ExamRecordGroup>().Where(x => x.Id == groupId).FirstAsync(); |
|
|
|
|
|
|
|
if (group != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
group.Score = record.Score; |
|
|
|
|
|
|
|
await Db.Updateable(group).UpdateColumns(it => new { it.Score }, true) |
|
|
|
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ServiceResult.OprateSuccess("提交成功!"); |
|
|
|
return ServiceResult.OprateSuccess("提交成功!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -813,7 +822,7 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
extend.ExamEndDate = DateTimeHelper.ConvertToDayString(record.EndTime); |
|
|
|
extend.ExamEndDate = DateTimeHelper.ConvertToDayString(record.EndTime); |
|
|
|
} |
|
|
|
} |
|
|
|
extend.ExamStatus = record.Status; |
|
|
|
extend.ExamStatus = record.Status; |
|
|
|
extend.TotalScore = record.TotalScore; |
|
|
|
extend.TotalScore = details.Where(x => x.Score != null).Sum(x => x.Score); |
|
|
|
extend.Id = record.Id; |
|
|
|
extend.Id = record.Id; |
|
|
|
extend.CourseName = record.CourseName; |
|
|
|
extend.CourseName = record.CourseName; |
|
|
|
extend.CanRetake = true; |
|
|
|
extend.CanRetake = true; |
|
|
@ -882,15 +891,23 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion |
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
extend.Groups = await Db.Queryable<Ghre_ExamRecordGroup>() |
|
|
|
var Groups = await Db.Queryable<Ghre_ExamRecordGroup>() |
|
|
|
.OrderByDescending(x => x.ExamTime) |
|
|
|
.OrderByDescending(x => x.ExamTime) |
|
|
|
.Where(x => x.ExamRecordId == record.Id) |
|
|
|
.Where(x => x.ExamRecordId == record.Id) |
|
|
|
.Select(x => new ExamGroup() |
|
|
|
.Select(x => new |
|
|
|
{ |
|
|
|
{ |
|
|
|
GroupId = x.Id, |
|
|
|
GroupId = x.Id, |
|
|
|
ExamRecordId = x.ExamRecordId, |
|
|
|
x.ExamRecordId, |
|
|
|
ExamTime = x.ExamTime, |
|
|
|
x.ExamTime, |
|
|
|
|
|
|
|
x.Score |
|
|
|
}).ToListAsync(); |
|
|
|
}).ToListAsync(); |
|
|
|
|
|
|
|
extend.Groups = Groups |
|
|
|
|
|
|
|
.Select(x => new ExamGroup() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GroupId = x.GroupId, |
|
|
|
|
|
|
|
ExamRecordId = x.ExamRecordId, |
|
|
|
|
|
|
|
ExamTime = x.ExamTime.ObjToString() + (x.Score != null ? $"得分:{x.Score}" : ""), |
|
|
|
|
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
return ServiceResult<QueryExam>.OprateSuccess("查询成功!", extend); |
|
|
|
return ServiceResult<QueryExam>.OprateSuccess("查询成功!", extend); |
|
|
|
} |
|
|
|
} |
|
|
@ -1016,11 +1033,11 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
|
|
|
|
|
|
|
|
//多次考试成绩认定,Latest,最新分数; Highest,最高分数; Lowest,最低分数 |
|
|
|
//多次考试成绩认定,Latest,最新分数; Highest,最高分数; Lowest,最低分数 |
|
|
|
var ScoreRecognition = exam.ScoreRule ?? "Latest"; |
|
|
|
var ScoreRecognition = exam.ScoreRule ?? "Latest"; |
|
|
|
if (exampaper.ScoreMethod == DIC_EXAM_PAPER_SCORE_METHOD.SYSTEM && ScoreRecognition != "Latest") |
|
|
|
//if (exampaper.ScoreMethod == DIC_EXAM_PAPER_SCORE_METHOD.SYSTEM && ScoreRecognition != "Latest") |
|
|
|
{ |
|
|
|
//{ |
|
|
|
sql = $@"UPDATE Ghre_ExamRecordDetail SET IsEnable=2 WHERE ExamRecordId='{record.Id}';
|
|
|
|
// sql = $@"UPDATE Ghre_ExamRecordDetail SET IsEnable=2 WHERE ExamRecordId='{record.Id}'; |
|
|
|
UPDATE Ghre_ExamRecordAnswer SET IsEnable=2 WHERE ExamRecordId='{record.Id}';";
|
|
|
|
// UPDATE Ghre_ExamRecordAnswer SET IsEnable=2 WHERE ExamRecordId='{record.Id}';"; |
|
|
|
} |
|
|
|
//} |
|
|
|
await Db.Ado.ExecuteCommandAsync(sql); |
|
|
|
await Db.Ado.ExecuteCommandAsync(sql); |
|
|
|
|
|
|
|
|
|
|
|
var questionIds = answers.Select(x => x.QuestionId).ToList(); |
|
|
|
var questionIds = answers.Select(x => x.QuestionId).ToList(); |
|
|
@ -1158,20 +1175,24 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion |
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
group.Score = record.Score; |
|
|
|
|
|
|
|
await Db.Updateable(group).UpdateColumns(it => new { it.Score }, true) |
|
|
|
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
|
|
|
|
|
|
|
#region 多次考试成绩认定 |
|
|
|
#region 多次考试成绩认定 |
|
|
|
if (exampaper.ScoreMethod == DIC_EXAM_PAPER_SCORE_METHOD.SYSTEM && (ScoreRecognition == "Highest" || ScoreRecognition == "Lowest")) |
|
|
|
if (exampaper.ScoreMethod == DIC_EXAM_PAPER_SCORE_METHOD.SYSTEM && (ScoreRecognition == "Highest" || ScoreRecognition == "Lowest")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ((ScoreRecognition == "Highest" && record.Score < lastScore) || ScoreRecognition == "Lowest" && record.Score > lastScore) |
|
|
|
if ((ScoreRecognition == "Highest" && record.Score < lastScore) || ScoreRecognition == "Lowest" && record.Score > lastScore) |
|
|
|
{ |
|
|
|
{ |
|
|
|
record.Score = lastScore; |
|
|
|
record.Score = lastScore; |
|
|
|
sql = $@"UPDATE Ghre_ExamRecordDetail SET IsEnable=0 WHERE ExamRecordId='{record.Id}';
|
|
|
|
//sql = $@"UPDATE Ghre_ExamRecordDetail SET IsEnable=0 WHERE ExamRecordId='{record.Id}'; |
|
|
|
UPDATE Ghre_ExamRecordAnswer SET IsEnable=0 WHERE ExamRecordId='{record.Id}';";
|
|
|
|
// UPDATE Ghre_ExamRecordAnswer SET IsEnable=0 WHERE ExamRecordId='{record.Id}';"; |
|
|
|
|
|
|
|
|
|
|
|
await Db.Ado.ExecuteCommandAsync(sql); |
|
|
|
//await Db.Ado.ExecuteCommandAsync(sql); |
|
|
|
|
|
|
|
|
|
|
|
sql = $@"UPDATE Ghre_ExamRecordDetail SET IsEnable=1 WHERE IsEnable=2 AND ExamRecordId='{record.Id}';
|
|
|
|
//sql = $@"UPDATE Ghre_ExamRecordDetail SET IsEnable=1 WHERE IsEnable=2 AND ExamRecordId='{record.Id}'; |
|
|
|
UPDATE Ghre_ExamRecordAnswer SET IsEnable=1 WHERE IsEnable=2 AND ExamRecordId='{record.Id}';";
|
|
|
|
// UPDATE Ghre_ExamRecordAnswer SET IsEnable=1 WHERE IsEnable=2 AND ExamRecordId='{record.Id}';"; |
|
|
|
await Db.Ado.ExecuteCommandAsync(sql); |
|
|
|
//await Db.Ado.ExecuteCommandAsync(sql); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region 处理最终得分 |
|
|
|
#region 处理最终得分 |
|
|
@ -1655,4 +1676,31 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
return ServiceResult.OprateSuccess("发放成功!"); |
|
|
|
return ServiceResult.OprateSuccess("发放成功!"); |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion |
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 查询考试组 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<ServiceResult<List<ExamGroup>>> QueryGroups(long examRecordId) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var Groups = await Db.Queryable<Ghre_ExamRecordGroup>() |
|
|
|
|
|
|
|
.OrderByDescending(x => x.ExamTime) |
|
|
|
|
|
|
|
.Where(x => x.ExamRecordId == examRecordId) |
|
|
|
|
|
|
|
.Select(x => new |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GroupId = x.Id, |
|
|
|
|
|
|
|
x.ExamRecordId, |
|
|
|
|
|
|
|
x.ExamTime, |
|
|
|
|
|
|
|
x.Score |
|
|
|
|
|
|
|
}).ToListAsync(); |
|
|
|
|
|
|
|
var groups = Groups |
|
|
|
|
|
|
|
.Select(x => new ExamGroup() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
GroupId = x.GroupId, |
|
|
|
|
|
|
|
ExamRecordId = x.ExamRecordId, |
|
|
|
|
|
|
|
ExamTime = x.ExamTime.ObjToString() + (x.Score != null ? $"得分:{x.Score}" : ""), |
|
|
|
|
|
|
|
}).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ServiceResult<List<ExamGroup>>.OprateSuccess("成功!", groups); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion |
|
|
|
} |
|
|
|
} |