Commit e5e6daac authored by liudong1993's avatar liudong1993

1

parent 5b87deca
...@@ -29,6 +29,11 @@ namespace EduSpider.Model.Entity ...@@ -29,6 +29,11 @@ namespace EduSpider.Model.Entity
/// </summary> /// </summary>
public int StuId { get; set; } public int StuId { get; set; }
/// <summary>
/// 学生账户ID
/// </summary>
public int StuUId { get; set; }
/// <summary> /// <summary>
/// 导入的姓名 /// 导入的姓名
/// </summary> /// </summary>
...@@ -53,5 +58,10 @@ namespace EduSpider.Model.Entity ...@@ -53,5 +58,10 @@ namespace EduSpider.Model.Entity
/// 百分比排名 /// 百分比排名
/// </summary> /// </summary>
public decimal RankRate { get; set; } public decimal RankRate { get; set; }
/// <summary>
/// 考试总分
/// </summary>
public decimal ExamScore { get; set; }
} }
} }
...@@ -94,7 +94,7 @@ namespace EduSpider.Services ...@@ -94,7 +94,7 @@ namespace EduSpider.Services
sExamModel?.TScore, sExamModel?.TScore,
sExamModel?.Rank, sExamModel?.Rank,
sExamModel?.RankRate, sExamModel?.RankRate,
ScoreRate = Math.Round((sExamModel?.TScore ?? 0) / qlist.Sum(x => x.Score), 2, MidpointRounding.AwayFromZero), ScoreRate = Math.Round((sExamModel?.TScore ?? 0) / (sExamModel?.ExamScore ?? 1), 2, MidpointRounding.AwayFromZero),
ScoreList = sExamModel?.ScoreList.Select(x => new ScoreList = sExamModel?.ScoreList.Select(x => new
{ {
x.Sort, x.Sort,
...@@ -176,6 +176,7 @@ namespace EduSpider.Services ...@@ -176,6 +176,7 @@ namespace EduSpider.Services
} }
exam_QuestionsRepository.BatchInsert(InsertEQ); exam_QuestionsRepository.BatchInsert(InsertEQ);
decimal ExamScore = InsertEQ.Sum(x => x.Score);
List<Model.Entity.RB_Exam_Score> InsertScore = new(); List<Model.Entity.RB_Exam_Score> InsertScore = new();
foreach (var Name in StuList.Select(x => x.Name).Distinct()) { foreach (var Name in StuList.Select(x => x.Name).Distinct()) {
var clist = StuList.Where(x => x.Name == Name).ToList(); var clist = StuList.Where(x => x.Name == Name).ToList();
...@@ -185,6 +186,7 @@ namespace EduSpider.Services ...@@ -185,6 +186,7 @@ namespace EduSpider.Services
Id = 0, Id = 0,
ExamId = ExamId, ExamId = ExamId,
StuId = stuModel?.StudId ?? 0,//匹配学生失败 可能要在后台给与提示, 重新导入 StuId = stuModel?.StudId ?? 0,//匹配学生失败 可能要在后台给与提示, 重新导入
StuUId = stuModel?.StudentUid ?? 0,
StuName = Name, StuName = Name,
Content = JsonHelper.Serialize(clist.Where(x => x.Id > 0).Select(x => new Content = JsonHelper.Serialize(clist.Where(x => x.Id > 0).Select(x => new
{ {
...@@ -195,6 +197,7 @@ namespace EduSpider.Services ...@@ -195,6 +197,7 @@ namespace EduSpider.Services
TScore = clist.Where(x => x.Id == -1).FirstOrDefault()?.Score ?? 0, TScore = clist.Where(x => x.Id == -1).FirstOrDefault()?.Score ?? 0,
Rank = Convert.ToInt32(clist.Where(x => x.Id == -2).FirstOrDefault()?.Score ?? 0), Rank = Convert.ToInt32(clist.Where(x => x.Id == -2).FirstOrDefault()?.Score ?? 0),
RankRate = clist.Where(x => x.Id == -3).FirstOrDefault()?.Score ?? 0, RankRate = clist.Where(x => x.Id == -3).FirstOrDefault()?.Score ?? 0,
ExamScore = ExamScore
}); });
} }
//InsertScore = InsertScore.Where(x => x.StuId > 0).ToList();//暂时只插入匹配到学生的 //InsertScore = InsertScore.Where(x => x.StuId > 0).ToList();//暂时只插入匹配到学生的
......
...@@ -46,6 +46,16 @@ namespace EduSpider.WebApi.Controllers ...@@ -46,6 +46,16 @@ namespace EduSpider.WebApi.Controllers
return ApiResult.Success("", pmodel); return ApiResult.Success("", pmodel);
} }
/// <summary>
/// 获取考试学生列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetExamStuList() {
return ApiResult.Success();
}
/// <summary> /// <summary>
/// 获取学生考试明细 /// 获取学生考试明细
/// </summary> /// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment