Commit 056a0cc8 authored by liudong1993's avatar liudong1993

1

parent 893902aa
...@@ -80,10 +80,11 @@ namespace EduSpider.Services ...@@ -80,10 +80,11 @@ namespace EduSpider.Services
public object GetExamStuScoreInfo(int examId, int stuId, int stuUId, out string msg) public object GetExamStuScoreInfo(int examId, int stuId, int stuUId, out string msg)
{ {
msg = ""; msg = "";
if (stuUId > 0) { // 因为可能涉及多个student 使用 stuUID 作为唯一标识
var accountModel = AccountRepository.GetAccountList(new rb_account_hk_Extend() { AccountId = stuUId, AccountType = Utility.Enum.AccountTypeEnum.Student }).FirstOrDefault(); if (stuUId <= 0)
if (accountModel == null) { msg = "账号不存在"; return ""; } {
stuId = accountModel.Id; stuUId = StudentRepository.GetEntity(stuId)?.StudentUid ?? 0;
if (stuUId <= 0) { msg = "未查到账号信息"; return ""; }
} }
var stuModel = StudentRepository.GetEntity(stuId); var stuModel = StudentRepository.GetEntity(stuId);
if (stuModel == null) { msg = "学生信息不存在"; return ""; } if (stuModel == null) { msg = "学生信息不存在"; return ""; }
...@@ -93,7 +94,7 @@ namespace EduSpider.Services ...@@ -93,7 +94,7 @@ namespace EduSpider.Services
//考试题目 //考试题目
var qlist = Exam_QuestionsRepository.GetList(new RB_Exam_Questions_Extend() { ExamId = examId }); var qlist = Exam_QuestionsRepository.GetList(new RB_Exam_Questions_Extend() { ExamId = examId });
//考试成绩 //考试成绩
var sExamModel = Exam_ScoreRepository.GetList(new RB_Exam_Score_Extend() { ExamId = examId, StuId = stuId }).FirstOrDefault(); var sExamModel = Exam_ScoreRepository.GetList(new RB_Exam_Score_Extend() { ExamId = examId, StuUId = stuUId }).FirstOrDefault();
if (sExamModel != null) { if (sExamModel != null) {
sExamModel.ScoreList = JsonHelper.Deserialize<List<ExamQScoreModel>>(sExamModel.Content); sExamModel.ScoreList = JsonHelper.Deserialize<List<ExamQScoreModel>>(sExamModel.Content);
foreach (var qitem in sExamModel.ScoreList) { foreach (var qitem in sExamModel.ScoreList) {
...@@ -141,8 +142,8 @@ namespace EduSpider.Services ...@@ -141,8 +142,8 @@ namespace EduSpider.Services
sExamModel?.ScoreList.Where(x => x.GroupName == groupName).ToList().ForEach(x => sExamModel?.ScoreList.Where(x => x.GroupName == groupName).ToList().ForEach(x =>
{ {
x.AScore = sExamList.Where(x => x.StuId == stuId).FirstOrDefault()?.AScore ?? 0; x.AScore = sExamList.Where(x => x.StuUId == stuUId).FirstOrDefault()?.AScore ?? 0;
x.ARank = sExamList.Where(x => x.StuId == stuId).FirstOrDefault()?.ARank ?? 0; x.ARank = sExamList.Where(x => x.StuUId == stuUId).FirstOrDefault()?.ARank ?? 0;
}); });
} }
...@@ -152,6 +153,7 @@ namespace EduSpider.Services ...@@ -152,6 +153,7 @@ namespace EduSpider.Services
return new return new
{ {
StuId = stuModel.StudId, StuId = stuModel.StudId,
StuUId = stuUId,
StuName = stuModel.StudentName, StuName = stuModel.StudentName,
examModel.ExamName, examModel.ExamName,
examModel.Type, examModel.Type,
...@@ -219,11 +221,11 @@ namespace EduSpider.Services ...@@ -219,11 +221,11 @@ namespace EduSpider.Services
/// <returns></returns> /// <returns></returns>
public object GetExamStuScoreInfo_Group(int examId, int stuId, int stuUId) public object GetExamStuScoreInfo_Group(int examId, int stuId, int stuUId)
{ {
if (stuUId > 0) // 因为可能涉及多个student 使用 stuUID 作为唯一标识
if (stuUId <= 0)
{ {
var accountModel = AccountRepository.GetAccountList(new rb_account_hk_Extend() { AccountId = stuUId, AccountType = Utility.Enum.AccountTypeEnum.Student }).FirstOrDefault(); stuUId = StudentRepository.GetEntity(stuId)?.StudentUid ?? 0;
if (accountModel == null) { return ""; } if (stuUId <= 0) { return ""; }
stuId = accountModel.Id;
} }
var stuModel = StudentRepository.GetEntity(stuId); var stuModel = StudentRepository.GetEntity(stuId);
if (stuModel == null) { return ""; } if (stuModel == null) { return ""; }
...@@ -232,7 +234,7 @@ namespace EduSpider.Services ...@@ -232,7 +234,7 @@ namespace EduSpider.Services
//考试题目 //考试题目
var qlist = Exam_QuestionsRepository.GetList(new RB_Exam_Questions_Extend() { ExamId = examId }); var qlist = Exam_QuestionsRepository.GetList(new RB_Exam_Questions_Extend() { ExamId = examId });
//考试成绩 //考试成绩
var sExamModel = Exam_ScoreRepository.GetList(new RB_Exam_Score_Extend() { ExamId = examId, StuId = stuId }).FirstOrDefault(); var sExamModel = Exam_ScoreRepository.GetList(new RB_Exam_Score_Extend() { ExamId = examId, StuUId = stuUId }).FirstOrDefault();
if (sExamModel != null) if (sExamModel != null)
{ {
sExamModel.ScoreList = JsonHelper.Deserialize<List<ExamQScoreModel>>(sExamModel.Content); sExamModel.ScoreList = JsonHelper.Deserialize<List<ExamQScoreModel>>(sExamModel.Content);
...@@ -250,6 +252,7 @@ namespace EduSpider.Services ...@@ -250,6 +252,7 @@ namespace EduSpider.Services
return new return new
{ {
StuId = stuModel.StudId, StuId = stuModel.StudId,
StuUId = stuUId,
StuName = stuModel.StudentName, StuName = stuModel.StudentName,
examModel.ExamName, examModel.ExamName,
sExamModel?.TScore, sExamModel?.TScore,
...@@ -781,12 +784,11 @@ namespace EduSpider.Services ...@@ -781,12 +784,11 @@ namespace EduSpider.Services
/// <returns></returns> /// <returns></returns>
public object GetExamStatAnalysisInfo(int examId, int stuId, int stuUId, out string msg) public object GetExamStatAnalysisInfo(int examId, int stuId, int stuUId, out string msg)
{ {
msg = ""; msg = "";
if (stuUId > 0) if (stuUId <= 0)
{ {
var accountModel = AccountRepository.GetAccountList(new rb_account_hk_Extend() { AccountId = stuUId, AccountType = Utility.Enum.AccountTypeEnum.Student }).FirstOrDefault(); stuUId = StudentRepository.GetEntity(stuId)?.StudentUid ?? 0;
if (accountModel == null) { msg = "账号不存在"; return ""; } if (stuUId <= 0) { msg = "账号不存在"; return ""; }
stuId = accountModel.Id;
} }
var stuModel = StudentRepository.GetEntity(stuId); var stuModel = StudentRepository.GetEntity(stuId);
if (stuModel == null) { msg = "学生信息不存在"; return ""; } if (stuModel == null) { msg = "学生信息不存在"; return ""; }
...@@ -794,7 +796,7 @@ namespace EduSpider.Services ...@@ -794,7 +796,7 @@ namespace EduSpider.Services
if (examModel == null) { msg = "考试信息不存在"; return ""; } if (examModel == null) { msg = "考试信息不存在"; return ""; }
if (examModel.Type != 3) { msg = "非统计分析请求"; return ""; } if (examModel.Type != 3) { msg = "非统计分析请求"; return ""; }
//考试成绩 //考试成绩
var sExamModel = Exam_ScoreRepository.GetList(new RB_Exam_Score_Extend() { ExamId = examId, StuId = stuId }).FirstOrDefault(); var sExamModel = Exam_ScoreRepository.GetList(new RB_Exam_Score_Extend() { ExamId = examId, StuUId = stuUId }).FirstOrDefault();
ExamStatModel statList = new ExamStatModel(); ExamStatModel statList = new ExamStatModel();
if (sExamModel != null) if (sExamModel != null)
{ {
...@@ -805,6 +807,7 @@ namespace EduSpider.Services ...@@ -805,6 +807,7 @@ namespace EduSpider.Services
return new return new
{ {
StuId = stuModel.StudId, StuId = stuModel.StudId,
StuUId = stuUId,
StuName = stuModel.StudentName, StuName = stuModel.StudentName,
examModel.ExamName, examModel.ExamName,
examModel.AnalysisType, examModel.AnalysisType,
......
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