Commit 3af710a4 authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents f91611c6 032c14de
...@@ -1907,10 +1907,21 @@ namespace Edu.Module.Course ...@@ -1907,10 +1907,21 @@ namespace Edu.Module.Course
dmodel.Age = Common.ConvertHelper.GetAgeByBirthdate(dmodel.BirthDate); dmodel.Age = Common.ConvertHelper.GetAgeByBirthdate(dmodel.BirthDate);
} }
message = ""; message = "";
//订单实体
var ordermodel = orderRepository.GetEntity(dmodel.OrderId);
if (ordermodel == null)
{
message = "订单不存在";
return flag;
}
//班级实体
var classmodel = classRepository.GetEntity(ordermodel.ClassId);
string LogContent = "";
//修改学员信息
if (dmodel.Id > 0) if (dmodel.Id > 0)
{ {
var gModel = order_GuestRepository.GetEntity(dmodel.Id); var gModel = order_GuestRepository.GetEntity(dmodel.Id);
string LogContent = "修改学生名单【" + dmodel.Id + "】"; LogContent = "修改学生名单【" + dmodel.Id + "】";
if (gModel.Age != dmodel.Age) if (gModel.Age != dmodel.Age)
{ {
LogContent += ",年龄由【" + gModel.Age + "】修改为【" + dmodel.Age + "】"; LogContent += ",年龄由【" + gModel.Age + "】修改为【" + dmodel.Age + "】";
...@@ -2040,50 +2051,17 @@ namespace Edu.Module.Course ...@@ -2040,50 +2051,17 @@ namespace Edu.Module.Course
LogContent += ",学生头像由【" + gModel.StuIcon + "】修改为【" + dmodel.StuIcon + "】"; LogContent += ",学生头像由【" + gModel.StuIcon + "】修改为【" + dmodel.StuIcon + "】";
} }
gModel.StuIcon = dmodel.StuIcon; gModel.StuIcon = dmodel.StuIcon;
gModel.TotalHours = dmodel.TotalHours; gModel.TotalHours = dmodel.TotalHours;
gModel.GuestContractNo = dmodel.GuestContractNo; gModel.GuestContractNo = dmodel.GuestContractNo;
gModel.ContractType = dmodel.ContractType; gModel.ContractType = dmodel.ContractType;
gModel.ContractUrl = dmodel.ContractUrl; gModel.ContractUrl = dmodel.ContractUrl;
gModel.UpdateTime = dmodel.UpdateTime; gModel.UpdateTime = dmodel.UpdateTime;
flag = order_GuestRepository.Update(gModel); flag = order_GuestRepository.Update(gModel);
if (flag)
{
//记录日志
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{
Id = 0,
Type = 2,
CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now,
Group_Id = dmodel.Group_Id,
LogContent = LogContent,
School_Id = dmodel.School_Id,
SourceId = gModel.OrderId
});
if (!string.IsNullOrWhiteSpace(dmodel.StuIcon))//更新学生表中的头像
{
var orderGuestModel = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel { ClassId = gModel.ClassId, OrderId = gModel.OrderId, GuestId = gModel.Id }).FirstOrDefault();
if (orderGuestModel != null && orderGuestModel.Student_Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Student_ViewModel.StuIcon),dmodel.StuIcon},
};
studentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), orderGuestModel.Student_Id));
}
}
}
} }
//新增学员信息
else else
{ {
var ordermodel = orderRepository.GetEntity(dmodel.OrderId);
if (ordermodel == null)
{
message = "订单不存在";
return flag;
}
dmodel.ClassId = ordermodel.ClassId; dmodel.ClassId = ordermodel.ClassId;
dmodel.SourceId = ordermodel.SourceId; dmodel.SourceId = ordermodel.SourceId;
int GuestNum = order_GuestRepository.GetOrderGuestNumRepository(new RB_Order_Guest_ViewModel() { OrderId = dmodel.OrderId, GuestState = GuestStateEnum.Normal }); int GuestNum = order_GuestRepository.GetOrderGuestNumRepository(new RB_Order_Guest_ViewModel() { OrderId = dmodel.OrderId, GuestState = GuestStateEnum.Normal });
...@@ -2095,16 +2073,43 @@ namespace Edu.Module.Course ...@@ -2095,16 +2073,43 @@ namespace Edu.Module.Course
int Id = order_GuestRepository.Insert(dmodel); int Id = order_GuestRepository.Insert(dmodel);
dmodel.Id = Id; dmodel.Id = Id;
flag = Id > 0; flag = Id > 0;
}
#region 新增修改学员账号
if (flag) if (flag)
{ {
var classmodel = classRepository.GetEntity(ordermodel.ClassId); //检查【学员表(rb_order_guest)和学生表(rb_student)】关联信息
//验证账号是否存在 var stuOrderGuestModel = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel { ClassId = ordermodel.ClassId, OrderId = ordermodel.OrderId, GuestId = dmodel.Id }).FirstOrDefault();
//学员账号信息
var accmodel = accountRepository.GetAccountListRepository(new RB_Account_ViewModel() { Group_Id = dmodel.Group_Id, AccountType = Common.Enum.User.AccountTypeEnum.Student, Account = dmodel.Mobile }).FirstOrDefault(); var accmodel = accountRepository.GetAccountListRepository(new RB_Account_ViewModel() { Group_Id = dmodel.Group_Id, AccountType = Common.Enum.User.AccountTypeEnum.Student, Account = dmodel.Mobile }).FirstOrDefault();
string LogContent = "新增学生名单【" + Id + "】"; //【学员表、学生表、账号表】关联表和账号信息都存在
if (dmodel.ClassId > 0) if (stuOrderGuestModel != null && accmodel != null)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Student_ViewModel.StuIcon),dmodel.StuIcon},
{nameof(RB_Student_ViewModel.StuTel),dmodel.Mobile},
{nameof(RB_Student_ViewModel.StuName),dmodel.GuestName},
{nameof(RB_Student_ViewModel.StuSex), dmodel.Sex - 1},
{nameof(RB_Student_ViewModel.StuBirth),dmodel.BirthDate},
};
studentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), stuOrderGuestModel.Student_Id));
}
//有【学员表、学生表、账号表】关联信息,没有账号信息【需要修改账号表中的账号】
else if (stuOrderGuestModel != null && accmodel == null)
{ {
if (accmodel != null) Dictionary<string, object> accountFileds = new Dictionary<string, object>()
{ {
{nameof(RB_Account_ViewModel.Account),dmodel.Mobile }
};
accountRepository.Update(accountFileds, new WhereHelper(nameof(RB_Account_ViewModel.Id), stuOrderGuestModel.Account_Id));
}
//有【账号】信息,没有关联信息
else if (stuOrderGuestModel == null && accmodel != null)
{
//创建学员表、学生表、账号表关联信息
student_OrderGuestRepository.Insert(new Model.Entity.User.RB_Student_OrderGuest() student_OrderGuestRepository.Insert(new Model.Entity.User.RB_Student_OrderGuest()
{ {
Id = 0, Id = 0,
...@@ -2112,16 +2117,17 @@ namespace Edu.Module.Course ...@@ -2112,16 +2117,17 @@ namespace Edu.Module.Course
ClassId = ordermodel.ClassId, ClassId = ordermodel.ClassId,
CreateBy = dmodel.CreateBy, CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
GuestId = Id, GuestId = dmodel.Id,
OrderId = dmodel.OrderId, OrderId = dmodel.OrderId,
Status = DateStateEnum.Normal, Status = DateStateEnum.Normal,
Student_Id = accmodel.AccountId Student_Id = accmodel.AccountId
}); });
LogContent += ",添加学生账号关联【" + accmodel.Id + "】"; LogContent += ",添加学生账号关联【" + accmodel.Id + "】";
} }
//关联信息和账号都不存在
else else
{ {
//创建学生账号 //创建学生表信息
int StudentId = studentRepository.Insert(new Model.Entity.User.RB_Student() int StudentId = studentRepository.Insert(new Model.Entity.User.RB_Student()
{ {
StuId = 0, StuId = 0,
...@@ -2141,8 +2147,8 @@ namespace Edu.Module.Course ...@@ -2141,8 +2147,8 @@ namespace Edu.Module.Course
StuTel = dmodel.Mobile, StuTel = dmodel.Mobile,
UpdateBy = dmodel.CreateBy, UpdateBy = dmodel.CreateBy,
UpdateTime = DateTime.Now, UpdateTime = DateTime.Now,
}); });
//创建学生账号
int AccountId = accountRepository.Insert(new Model.Entity.User.RB_Account() int AccountId = accountRepository.Insert(new Model.Entity.User.RB_Account()
{ {
Id = 0, Id = 0,
...@@ -2159,6 +2165,7 @@ namespace Edu.Module.Course ...@@ -2159,6 +2165,7 @@ namespace Edu.Module.Course
UpdateTime = DateTime.Now, UpdateTime = DateTime.Now,
Password = Common.DES.Encrypt(Common.Config.DefaultPwd) Password = Common.DES.Encrypt(Common.Config.DefaultPwd)
}); });
//创建【学员表、学生表、账号表】关联信息
student_OrderGuestRepository.Insert(new Model.Entity.User.RB_Student_OrderGuest() student_OrderGuestRepository.Insert(new Model.Entity.User.RB_Student_OrderGuest()
{ {
Id = 0, Id = 0,
...@@ -2166,7 +2173,7 @@ namespace Edu.Module.Course ...@@ -2166,7 +2173,7 @@ namespace Edu.Module.Course
ClassId = ordermodel.ClassId, ClassId = ordermodel.ClassId,
CreateBy = dmodel.CreateBy, CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now, CreateTime = DateTime.Now,
GuestId = Id, GuestId = dmodel.Id,
OrderId = dmodel.OrderId, OrderId = dmodel.OrderId,
Status = DateStateEnum.Normal, Status = DateStateEnum.Normal,
Student_Id = StudentId Student_Id = StudentId
...@@ -2174,6 +2181,13 @@ namespace Edu.Module.Course ...@@ -2174,6 +2181,13 @@ namespace Edu.Module.Course
LogContent += ",自动创建学生账号【" + AccountId + "】"; LogContent += ",自动创建学生账号【" + AccountId + "】";
} }
} }
#endregion
#region 添加日志
if (flag && !string.IsNullOrEmpty(LogContent))
{
//记录日志
changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog() changeLogRepository.Insert(new Model.Entity.Log.RB_User_ChangeLog()
{ {
Id = 0, Id = 0,
...@@ -2183,10 +2197,11 @@ namespace Edu.Module.Course ...@@ -2183,10 +2197,11 @@ namespace Edu.Module.Course
Group_Id = dmodel.Group_Id, Group_Id = dmodel.Group_Id,
LogContent = LogContent, LogContent = LogContent,
School_Id = dmodel.School_Id, School_Id = dmodel.School_Id,
SourceId = dmodel.OrderId, SourceId = dmodel.OrderId
}); });
} }
} #endregion
return flag; return flag;
} }
......
...@@ -636,6 +636,7 @@ namespace Edu.Module.Exam ...@@ -636,6 +636,7 @@ namespace Edu.Module.Exam
return flag; return flag;
} }
/// <summary> /// <summary>
/// 根据试卷编号获取试卷实体 /// 根据试卷编号获取试卷实体
/// </summary> /// </summary>
...@@ -1253,10 +1254,33 @@ namespace Edu.Module.Exam ...@@ -1253,10 +1254,33 @@ namespace Edu.Module.Exam
foreach (var sItem in stuTempList) foreach (var sItem in stuTempList)
{ {
var questionModel = gItem.DetailsList.Where(qitem => qitem.Id == sItem.DetailsId)?.FirstOrDefault(); var questionModel = gItem.DetailsList.Where(qitem => qitem.Id == sItem.DetailsId)?.FirstOrDefault();
var QuestionContentObj = analysisQuestion.ParsingQuestion(questionModel.QuestionTypeKey, sItem.StudentContent,isEdit:true);
var QuestionContentObj = new object();
if (isShowAnswer)
{
QuestionContentObj = analysisQuestion.ParsingQuestion(questionModel.QuestionTypeKey, questionModel.QuestionContent, isEdit: true);
}
else
{
QuestionContentObj = analysisQuestion.ParsingQuestion(questionModel.QuestionTypeKey, sItem.StudentContent, isEdit: true);
}
List<object> answerList = new List<object>();
//填空题、分录题、资料题
if (questionModel.QuestionTypeKey == "fill-in" || questionModel.QuestionTypeKey == "entry-problem" || questionModel.QuestionTypeKey == "data-question")
{
var tempList = sItem.StundetAnswer.Split('★');
if (tempList != null && tempList.Count() > 0)
{
foreach (var tItem in tempList)
{
answerList.Add(tItem);
}
}
}
var qObj = new var qObj = new
{ {
PaperDetailsId= sItem.DetailsId,//试卷问题编号 PaperDetailsId = sItem.DetailsId,//试卷问题编号
StundetDetailsId = sItem.Id,//考生答题编号 StundetDetailsId = sItem.Id,//考生答题编号
sItem.PaperId, sItem.PaperId,
questionModel.Title, questionModel.Title,
...@@ -1266,10 +1290,12 @@ namespace Edu.Module.Exam ...@@ -1266,10 +1290,12 @@ namespace Edu.Module.Exam
questionModel.QuestionTypeKey, questionModel.QuestionTypeKey,
questionModel.DifficultyType, questionModel.DifficultyType,
questionModel.Score, questionModel.Score,
Answer =sItem.StundetAnswer, Answer = isShowAnswer ? questionModel.Answer : sItem.StundetAnswer,
sItem.StundetAnswer, sItem.StundetAnswer,
AnswerParse = "", AnswerList = isShowAnswer ? answerList : new List<object> (),
StundetScore = 0, AnswerParse = questionModel.AnswerParse,
StundetScore = sItem.StundetScore,
sItem.IsMarking
}; };
questionList.Add(qObj); questionList.Add(qObj);
} }
...@@ -1306,6 +1332,7 @@ namespace Edu.Module.Exam ...@@ -1306,6 +1332,7 @@ namespace Edu.Module.Exam
StundetAnswer = "", StundetAnswer = "",
AnswerParse = "", AnswerParse = "",
StundetScore = 0, StundetScore = 0,
IsMarking=0,
}; };
questionList.Add(qObj); questionList.Add(qObj);
} }
...@@ -1313,6 +1340,8 @@ namespace Edu.Module.Exam ...@@ -1313,6 +1340,8 @@ namespace Edu.Module.Exam
paperTypeList.Add(new paperTypeList.Add(new
{ {
gItem.GId, gItem.GId,
gItem.QuestionTypeKey,
gItem.QuestionTypeId,
gItem.GroupName, gItem.GroupName,
gItem.GScore, gItem.GScore,
DetailsList = questionList DetailsList = questionList
......
...@@ -412,13 +412,18 @@ namespace Edu.Module.Question ...@@ -412,13 +412,18 @@ namespace Edu.Module.Question
{ {
var optionItems = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(QuestionContent); var optionItems = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(QuestionContent);
message = CheckChoose(optionItems); message = CheckChoose(optionItems);
if (!string.IsNullOrEmpty(message)) var tempList = optionItems.Where(qitem => qitem.IsAnswer == true);
if (tempList != null && tempList.Count() > 0)
{ {
return message; AnalysisAnswer = string.Join(",", tempList.Select(qitem => qitem.Name));
} }
else else
{ {
AnalysisAnswer = string.Join(",", optionItems.Where(qitem => qitem.IsAnswer == true).Select(qitem => qitem.Name)); AnalysisAnswer = "";
}
if (!string.IsNullOrEmpty(message))
{
return message;
} }
} }
//判断题 //判断题
...@@ -426,13 +431,18 @@ namespace Edu.Module.Question ...@@ -426,13 +431,18 @@ namespace Edu.Module.Question
{ {
var optionItems = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(QuestionContent); var optionItems = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(QuestionContent);
message = CheckChoose(optionItems); message = CheckChoose(optionItems);
if (!string.IsNullOrEmpty(message)) var judgeModel = optionItems.Where(qitem => qitem.IsAnswer == true)?.FirstOrDefault();
if (judgeModel != null )
{ {
return message; AnalysisAnswer = string.Join(",", judgeModel?.Name);
} }
else else
{ {
AnalysisAnswer = optionItems.Where(qitem => qitem.IsAnswer == true)?.FirstOrDefault()?.Name; AnalysisAnswer = "";
}
if (!string.IsNullOrEmpty(message))
{
return message;
} }
} }
//填空题 //填空题
...@@ -440,66 +450,51 @@ namespace Edu.Module.Question ...@@ -440,66 +450,51 @@ namespace Edu.Module.Question
{ {
var fillInList = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(QuestionContent); var fillInList = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(QuestionContent);
message = CheckFillIn(fillInList); message = CheckFillIn(fillInList);
AnalysisAnswer = string.Join("★", fillInList.Select(qitem => Common.Plugin.StringHelper.AppHtmlFilterr(qitem.Content)));
if (!string.IsNullOrEmpty(message)) if (!string.IsNullOrEmpty(message))
{ {
return message; return message;
} }
else
{
AnalysisAnswer = string.Join("★", fillInList.Select(qitem => Common.Plugin.StringHelper.AppHtmlFilterr(qitem.Content)));
}
} }
//简答题 //简答题
else if (QuestionTypeKey == "short-answer") else if (QuestionTypeKey == "short-answer")
{ {
message = CheckShortAnswer(Answer); message = CheckShortAnswer(Answer);
AnalysisAnswer = Common.Plugin.StringHelper.AppHtmlFilterr(Answer);
if (!string.IsNullOrEmpty(message)) if (!string.IsNullOrEmpty(message))
{ {
return message; return message;
} }
else
{
AnalysisAnswer = Common.Plugin.StringHelper.AppHtmlFilterr(Answer);
}
} }
//名词解释 //名词解释
else if (QuestionTypeKey == "noun-explanation") else if (QuestionTypeKey == "noun-explanation")
{ {
AnalysisAnswer = Common.Plugin.StringHelper.AppHtmlFilterr(Answer);
if (string.IsNullOrEmpty(Answer)) if (string.IsNullOrEmpty(Answer))
{ {
message = "请填写名词解释答案"; message = "请填写名词解释答案";
return message; return message;
} }
else
{
AnalysisAnswer = Common.Plugin.StringHelper.AppHtmlFilterr(Answer);
}
} }
//论述题 //论述题
else if (QuestionTypeKey == "essay-question") else if (QuestionTypeKey == "essay-question")
{ {
AnalysisAnswer = Common.Plugin.StringHelper.AppHtmlFilterr(Answer);
if (string.IsNullOrEmpty(Answer)) if (string.IsNullOrEmpty(Answer))
{ {
message = "请填写论述题答案"; message = "请填写论述题答案";
return message; return message;
} }
else
{
AnalysisAnswer = Common.Plugin.StringHelper.AppHtmlFilterr(Answer);
}
} }
//计算题 //计算题
else if (QuestionTypeKey == "calculation") else if (QuestionTypeKey == "calculation")
{ {
AnalysisAnswer = Common.Plugin.StringHelper.AppHtmlFilterr(Answer);
if (string.IsNullOrEmpty(Answer)) if (string.IsNullOrEmpty(Answer))
{ {
message = "请填写计算题答案"; message = "请填写计算题答案";
return message; return message;
} }
else
{
AnalysisAnswer = Common.Plugin.StringHelper.AppHtmlFilterr(Answer);
}
} }
//分录题、资料题 //分录题、资料题
else if (QuestionTypeKey == "entry-problem" || QuestionTypeKey == "data-question") else if (QuestionTypeKey == "entry-problem" || QuestionTypeKey == "data-question")
...@@ -507,15 +502,12 @@ namespace Edu.Module.Question ...@@ -507,15 +502,12 @@ namespace Edu.Module.Question
var entryList = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(QuestionContent); var entryList = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(QuestionContent);
if (entryList != null && entryList.Count > 0) if (entryList != null && entryList.Count > 0)
{ {
AnalysisAnswer = string.Join("★", entryList.Select(qitem => Common.Plugin.StringHelper.AppHtmlFilterr(qitem.Content)));
if (entryList.Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0) if (entryList.Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0)
{ {
message = "请输入答案"; message = "请输入答案";
return message; return message;
} }
else
{
AnalysisAnswer = string.Join("★", entryList.Select(qitem => Common.Plugin.StringHelper.AppHtmlFilterr(qitem.Content)));
}
} }
else else
{ {
...@@ -529,15 +521,15 @@ namespace Edu.Module.Question ...@@ -529,15 +521,15 @@ namespace Edu.Module.Question
var sortList = Common.Plugin.JsonHelper.DeserializeObject<List<List<matchingItem>>>(QuestionContent); var sortList = Common.Plugin.JsonHelper.DeserializeObject<List<List<matchingItem>>>(QuestionContent);
if (sortList != null && sortList.Count > 0) if (sortList != null && sortList.Count > 0)
{ {
if (sortList.Count > 1)
{
AnalysisAnswer = string.Join(",", sortList[1].Select(qitem => qitem.Name));
}
if (sortList[0].Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0) if (sortList[0].Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0)
{ {
message = "请输入选项内容"; message = "请输入选项内容";
return message; return message;
} }
if (sortList.Count > 1)
{
AnalysisAnswer = string.Join(",", sortList[1].Select(qitem => qitem.Name));
}
} }
else else
{ {
...@@ -579,15 +571,12 @@ namespace Edu.Module.Question ...@@ -579,15 +571,12 @@ namespace Edu.Module.Question
} }
if (matchList.Count > 2) if (matchList.Count > 2)
{ {
AnalysisAnswer = Common.Plugin.JsonHelper.Serialize(matchList[2]);
if (matchList[2].Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0) if (matchList[2].Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0)
{ {
message = "请设置答案"; message = "请设置答案";
return message; return message;
} }
else
{
AnalysisAnswer = Common.Plugin.JsonHelper.Serialize(matchList[2]);
}
} }
} }
else else
...@@ -606,6 +595,8 @@ namespace Edu.Module.Question ...@@ -606,6 +595,8 @@ namespace Edu.Module.Question
string clozeAnswer = ""; string clozeAnswer = "";
foreach (var subList in clozeList) foreach (var subList in clozeList)
{ {
var tempModel = subList.Where(qitem => qitem.IsAnswer == true)?.FirstOrDefault();
clozeAnswer += "," + tempModel?.Name ?? "";
if (subList.Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0) if (subList.Where(qitem => string.IsNullOrEmpty(qitem.Content)).Count() > 0)
{ {
message = string.Format("第{0}小题选项内容不能为空!", index); message = string.Format("第{0}小题选项内容不能为空!", index);
...@@ -616,7 +607,6 @@ namespace Edu.Module.Question ...@@ -616,7 +607,6 @@ namespace Edu.Module.Question
message = string.Format("请设置第{0}小题选项的正确答案!", index); message = string.Format("请设置第{0}小题选项的正确答案!", index);
return message; return message;
} }
clozeAnswer += "," + subList.Where(qitem => qitem.IsAnswer == true)?.FirstOrDefault()?.Name;
index++; index++;
} }
AnalysisAnswer = clozeAnswer.TrimStart(','); AnalysisAnswer = clozeAnswer.TrimStart(',');
...@@ -630,28 +620,22 @@ namespace Edu.Module.Question ...@@ -630,28 +620,22 @@ namespace Edu.Module.Question
//口语题 //口语题
else if (QuestionTypeKey == "spoken") else if (QuestionTypeKey == "spoken")
{ {
AnalysisAnswer = Common.Plugin.StringHelper.AppHtmlFilterr(Answer);
if (string.IsNullOrEmpty(Answer)) if (string.IsNullOrEmpty(Answer))
{ {
message = "请填写口语题答案!"; message = "请填写口语题答案!";
return message; return message;
} }
else
{
AnalysisAnswer = Common.Plugin.StringHelper.AppHtmlFilterr(Answer);
}
} }
//其它题 //其它题
else if (QuestionTypeKey == "other") else if (QuestionTypeKey == "other")
{ {
AnalysisAnswer = Common.Plugin.StringHelper.AppHtmlFilterr(Answer);
if (string.IsNullOrEmpty(Answer)) if (string.IsNullOrEmpty(Answer))
{ {
message = "请填写其它题答案!"; message = "请填写其它题答案!";
return message; return message;
} }
else
{
AnalysisAnswer = Common.Plugin.StringHelper.AppHtmlFilterr(Answer);
}
} }
//阅读理解和听力题 //阅读理解和听力题
else if (QuestionTypeKey == "reading-comprehensio" || QuestionTypeKey == "listening") else if (QuestionTypeKey == "reading-comprehensio" || QuestionTypeKey == "listening")
...@@ -674,51 +658,43 @@ namespace Edu.Module.Question ...@@ -674,51 +658,43 @@ namespace Edu.Module.Question
case "single": case "single":
var singleAnwser = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(item.SubAnwser.ToString()); var singleAnwser = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(item.SubAnwser.ToString());
string singleMessage = CheckChoose(singleAnwser); string singleMessage = CheckChoose(singleAnwser);
if (!string.IsNullOrEmpty(singleMessage))
{
return singleMessage;
}
else
{
resultList.Add(new matchingItem resultList.Add(new matchingItem
{ {
Name = Index.ToString(), Name = Index.ToString(),
Content = singleAnwser.Where(qitem => qitem.IsAnswer == true)?.FirstOrDefault()?.Name Content = singleAnwser.Where(qitem => qitem.IsAnswer == true)?.FirstOrDefault()?.Name??""
}); });
if (!string.IsNullOrEmpty(singleMessage))
{
return singleMessage;
} }
break; break;
//多选题 //多选题
case "multiple": case "multiple":
var multipleAnwser = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(item.SubAnwser.ToString()); var multipleAnwser = Common.Plugin.JsonHelper.DeserializeObject<List<optionItem>>(item.SubAnwser.ToString());
string multipleMessage = CheckChoose(multipleAnwser); string multipleMessage = CheckChoose(multipleAnwser);
if (!string.IsNullOrEmpty(multipleMessage))
{
return multipleMessage;
}
else
{
resultList.Add(new matchingItem resultList.Add(new matchingItem
{ {
Name = Index.ToString(), Name = Index.ToString(),
Content = string.Join(",", multipleAnwser.Where(qitem => qitem.IsAnswer == true).Select(qitem => qitem.Name)) Content = string.Join(",", multipleAnwser.Where(qitem => qitem.IsAnswer == true).Select(qitem => qitem.Name))
}); });
if (!string.IsNullOrEmpty(multipleMessage))
{
return multipleMessage;
} }
break; break;
//填空题 //填空题
case "fill-in": case "fill-in":
var r_fillInList = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(item.SubAnwser.ToString()); var r_fillInList = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(item.SubAnwser.ToString());
string r_fillMessage = CheckFillIn(r_fillInList); string r_fillMessage = CheckFillIn(r_fillInList);
if (!string.IsNullOrEmpty(r_fillMessage))
{
return r_fillMessage;
}
else
{
resultList.Add(new matchingItem resultList.Add(new matchingItem
{ {
Name = Index.ToString(), Name = Index.ToString(),
Content = string.Join(",", r_fillInList.Select(qitem => Common.Plugin.StringHelper.AppHtmlFilterr(qitem.Content))) Content = string.Join(",", r_fillInList.Select(qitem => Common.Plugin.StringHelper.AppHtmlFilterr(qitem.Content)))
}); });
if (!string.IsNullOrEmpty(r_fillMessage))
{
return r_fillMessage;
} }
break; break;
//判断题 //判断题
...@@ -727,24 +703,21 @@ namespace Edu.Module.Question ...@@ -727,24 +703,21 @@ namespace Edu.Module.Question
resultList.Add(new matchingItem resultList.Add(new matchingItem
{ {
Name = Index.ToString(), Name = Index.ToString(),
Content = judgeList.Where(qitem=>qitem.IsAnswer==true)?.FirstOrDefault()?.Name Content = judgeList.Where(qitem=>qitem.IsAnswer==true)?.FirstOrDefault()?.Name??""
}); });
break; break;
//简答题 //简答题
case "short-answer": case "short-answer":
var shortAnswer = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(item.SubAnwser.ToString()); var shortAnswer = Common.Plugin.JsonHelper.DeserializeObject<List<fillInItem>>(item.SubAnwser.ToString());
string r_shortMessage = CheckShortAnswer(shortAnswer[0].Content); string r_shortMessage = CheckShortAnswer(shortAnswer[0].Content);
if (!string.IsNullOrEmpty(r_shortMessage))
{
return r_shortMessage;
}
else
{
resultList.Add(new matchingItem resultList.Add(new matchingItem
{ {
Name = Index.ToString(), Name = Index.ToString(),
Content = Common.Plugin.StringHelper.AppHtmlFilterr(shortAnswer[0].Content) Content = Common.Plugin.StringHelper.AppHtmlFilterr(shortAnswer[0].Content)
}); });
if (!string.IsNullOrEmpty(r_shortMessage))
{
return r_shortMessage;
} }
break; break;
} }
...@@ -790,16 +763,14 @@ namespace Edu.Module.Question ...@@ -790,16 +763,14 @@ namespace Edu.Module.Question
message = string.Format("题干不能相同!"); message = string.Format("题干不能相同!");
return message; return message;
} }
AnalysisAnswer = string.Join(",", shareList[1].Select(qitem => qitem.Name));
//判断题干是否设置正确选项 //判断题干是否设置正确选项
if (shareList[1].Where(qitem => string.IsNullOrEmpty(qitem.Name)).Count() > 0) if (shareList[1].Where(qitem => string.IsNullOrEmpty(qitem.Name)).Count() > 0)
{ {
message = string.Format("请设置题干的正确选项!"); message = string.Format("请设置题干的正确选项!");
return message; return message;
} }
else
{
AnalysisAnswer = string.Join(",", shareList[1].Select(qitem => qitem.Name));
}
} }
else else
{ {
......
...@@ -160,7 +160,7 @@ namespace Edu.Module.Question ...@@ -160,7 +160,7 @@ namespace Edu.Module.Question
var diffTypeList = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId) var diffTypeList = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId)
.Select(qitem => new .Select(qitem => new
{ {
DifficultyType = qitem.DifficultyType, qitem.DifficultyType,
DifficultyTypeName = qitem.DifficultyType.ToName(), DifficultyTypeName = qitem.DifficultyType.ToName(),
DifficultyTypeCount = qitem.QuestionCount, DifficultyTypeCount = qitem.QuestionCount,
ChooseNum = 0 ChooseNum = 0
......
...@@ -60,14 +60,6 @@ WHERE 1=1 ...@@ -60,14 +60,6 @@ WHERE 1=1
{ {
builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Student_ViewModel.AreaId), query.AreaId); builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Student_ViewModel.AreaId), query.AreaId);
} }
//if (query.StuStatus > 0)
//{
// builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Student_ViewModel.StuStatus), query.StuStatus);
//}
//else
//{
// builder.AppendFormat(" AND t.{0} in({1}) ", nameof(RB_Student_ViewModel.StuStatus), "1,2");
//}
} }
return Get<RB_Student_ViewModel>(builder.ToString(),parameters).ToList(); return Get<RB_Student_ViewModel>(builder.ToString(),parameters).ToList();
} }
...@@ -142,7 +134,9 @@ WHERE 1=1 ...@@ -142,7 +134,9 @@ WHERE 1=1
{ {
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat($@"SELECT c.*,rbc.ClassName from rb_student as c builder.AppendFormat($@"
SELECT c.*,rbc.ClassName
FROM rb_student as c
LEFT JOIN rb_student_orderguest as sog on sog.Student_Id=c.StuId LEFT JOIN rb_student_orderguest as sog on sog.Student_Id=c.StuId
LEFT JOIN rb_class as rbc on rbc.ClassId=sog.ClassId LEFT JOIN rb_class as rbc on rbc.ClassId=sog.ClassId
where sog.ClassId in(SELECT a.ClassId from rb_student_orderguest as a LEFT JOIN rb_class as b on a.ClassId=b.ClassId where sog.ClassId in(SELECT a.ClassId from rb_student_orderguest as a LEFT JOIN rb_class as b on a.ClassId=b.ClassId
...@@ -164,14 +158,16 @@ where b.`Status`=0 and b.ClassStatus in(1,2) and a.status=0 and a.Account_Id={ ...@@ -164,14 +158,16 @@ where b.`Status`=0 and b.ClassStatus in(1,2) and a.status=0 and a.Account_Id={
{ {
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat($@"SELECT s.*,sog.GuestId,o.OrderState,cou.CourseName,cou.CourseId,c.ClassName,c.ClassId,c.ClassStatus,sch.SName,sch.SId,t.TeacherName,o.EnterID,(og.TotalHours-og.CompleteHours) as SurplusHours from rb_student as s LEFT JOIN rb_student_orderguest as sog on s.StuId=sog.Student_Id builder.AppendFormat($@"
LEFT JOIN rb_order_guest as og on og.Id=sog.GuestId SELECT s.*,sog.GuestId,o.OrderState,cou.CourseName,cou.CourseId,c.ClassName,c.ClassId,c.ClassStatus,sch.SName,sch.SId,t.TeacherName,o.EnterID,(og.TotalHours-og.CompleteHours) as SurplusHours
LEFT JOIN rb_order as o on og.OrderId=o.OrderId FROM rb_student as s LEFT JOIN rb_student_orderguest as sog on s.StuId=sog.Student_Id
LEFT JOIN rb_course as cou on o.CourseId=cou.CourseId LEFT JOIN rb_order_guest as og on og.Id=sog.GuestId
LEFT JOIN rb_class as c on c.ClassId=o.ClassId LEFT JOIN rb_order as o on og.OrderId=o.OrderId
LEFT JOIN rb_school as sch on sch.SId=c.School_Id LEFT JOIN rb_course as cou on o.CourseId=cou.CourseId
LEFT JOIN rb_teacher as t on t.TId=c.Teacher_Id LEFT JOIN rb_class as c on c.ClassId=o.ClassId
where o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 and cou.`Status`=0 and c.`Status`=0 and s.`Status`=0 and s.StuId={Student_Id} and s.Group_Id={Group_Id}"); LEFT JOIN rb_school as sch on sch.SId=c.School_Id
LEFT JOIN rb_teacher as t on t.TId=c.Teacher_Id
WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 and cou.`Status`=0 and c.`Status`=0 and s.`Status`=0 and s.StuId={Student_Id} and s.Group_Id={Group_Id}");
return Get<RB_Student_ViewModel>(builder.ToString(), parameters).ToList(); return Get<RB_Student_ViewModel>(builder.ToString(), parameters).ToList();
} }
} }
......
...@@ -554,7 +554,16 @@ namespace Edu.WebApi.Controllers.Applet ...@@ -554,7 +554,16 @@ namespace Edu.WebApi.Controllers.Applet
var PaperId = base.ParmJObj.GetInt("PaperId"); var PaperId = base.ParmJObj.GetInt("PaperId");
var Id = base.ParmJObj.GetInt("Id"); var Id = base.ParmJObj.GetInt("Id");
var GuestId = base.ParmJObj.GetInt("GuestId", 0); var GuestId = base.ParmJObj.GetInt("GuestId", 0);
var data = paperModule.AppGetExamPaperInfoModule(PaperId, isShowAnswer: false, GuestId: GuestId, PublishId: Id); var isShowAnswer = base.ParmJObj.GetBoolValue("isShowAnswer");
if (Id <= 0)
{
return ApiResult.ParamIsNull(message: "请传递考试编号!");
}
if (GuestId <= 0)
{
return ApiResult.ParamIsNull(message: "请传递学员编号!");
}
var data = paperModule.AppGetExamPaperInfoModule(PaperId, isShowAnswer: isShowAnswer, GuestId: GuestId, PublishId: Id);
return ApiResult.Success(data: data); return ApiResult.Success(data: data);
} }
......
...@@ -87,7 +87,7 @@ namespace Edu.WebApi.Controllers.Course ...@@ -87,7 +87,7 @@ namespace Edu.WebApi.Controllers.Course
x.ClassStyle, x.ClassStyle,
ClassStyleName = x.ClassStyle.ToName(), ClassStyleName = x.ClassStyle.ToName(),
OpenTime = x.OpenTime.ToString("yyyy年MM月dd日"), OpenTime = x.OpenTime.ToString("yyyy年MM月dd日"),
EndOrderTime = x.EndOrderTime.HasValue ? x.EndOrderTime.Value.ToString("yyyy年MM月dd日") : "", EndOrderTime =Common.ConvertHelper.FormatDate2(x.EndOrderTime),
IsCanApply = x.EndOrderTime >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")) && x.ClassPersion > x.OrderStudentCount ? 1 : 0, IsCanApply = x.EndOrderTime >= Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")) && x.ClassPersion > x.OrderStudentCount ? 1 : 0,
OriginalPrice = x.CourseOriginalPrice, OriginalPrice = x.CourseOriginalPrice,
SellPrice = x.CourseSellPrice, SellPrice = x.CourseSellPrice,
......
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