Commit 056a0cc8 authored by liudong1993's avatar liudong1993

1

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