Commit 8f07deee authored by 黄奎's avatar 黄奎

页面修改

parent 1257b2e8
using Edu.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Common.Enum.Exam
{
/// <summary>
/// 学员考试状态
/// </summary>
public enum ExamTestStatusEnum
{
/// <summary>
/// 已考试
/// </summary>
[EnumField("已考试")]
FinishTest = 1,
/// <summary>
/// 未考试
/// </summary>
[EnumField("未考试")]
NotFinishTest = 2,
}
}
using System; using Edu.Common.Enum.Exam;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using VT.FW.DB; using VT.FW.DB;
...@@ -75,7 +76,7 @@ namespace Edu.Model.Entity.Exam ...@@ -75,7 +76,7 @@ namespace Edu.Model.Entity.Exam
/// <summary> /// <summary>
/// 考试状态,0-没考,1-已考 /// 考试状态,0-没考,1-已考
/// </summary> /// </summary>
public int ExamStatus { get; set; } public ExamTestStatusEnum ExamStatus { get; set; }
/// <summary> /// <summary>
/// 考试结束时间 /// 考试结束时间
......
...@@ -17,6 +17,7 @@ using Edu.Common.Enum.EduTask; ...@@ -17,6 +17,7 @@ using Edu.Common.Enum.EduTask;
using Edu.Model.ViewModel.EduTask; using Edu.Model.ViewModel.EduTask;
using Edu.Common.Enum.Finance; using Edu.Common.Enum.Finance;
using Edu.Repository.EduTask; using Edu.Repository.EduTask;
using Edu.Common.Enum.Exam;
namespace Edu.Module.Exam namespace Edu.Module.Exam
{ {
...@@ -1273,7 +1274,7 @@ namespace Edu.Module.Exam ...@@ -1273,7 +1274,7 @@ namespace Edu.Module.Exam
questionList.Add(qObj); questionList.Add(qObj);
} }
} }
else if (gItem.DetailsList != null && gItem.DetailsList.Count > 0) else
{ {
var tempDetailsList = new List<RB_Examination_Details_ViewModel>(); var tempDetailsList = new List<RB_Examination_Details_ViewModel>();
//题目乱序 //题目乱序
...@@ -1323,6 +1324,7 @@ namespace Edu.Module.Exam ...@@ -1323,6 +1324,7 @@ namespace Edu.Module.Exam
extModel.PaperId, extModel.PaperId,
extModel.PaperName, extModel.PaperName,
GuestId, GuestId,
extModel.Group_Id,
PublishId = examPublish.Id, PublishId = examPublish.Id,
GroupList = paperTypeList, GroupList = paperTypeList,
}; };
...@@ -1361,12 +1363,11 @@ namespace Edu.Module.Exam ...@@ -1361,12 +1363,11 @@ namespace Edu.Module.Exam
/// <param name="model"></param> /// <param name="model"></param>
/// <returns></returns> /// <returns></returns>
[TransactionCallHandler] [TransactionCallHandler]
public virtual bool SetStuExamPaperDetailsModule(int PublishId, int GuestId,int PaperId,List<RB_Examination_Details_ViewModel> list) public virtual bool SetStuExamPaperDetailsModule(int PublishId, int GuestId,int PaperId,int UserGroupId,List<RB_Examination_Details_ViewModel> list)
{ {
bool flag = false; bool flag = false;
var modelPublish = GetExaminationPublishModule(PublishId); var modelPublish = GetExaminationPublishModule(PublishId);
var studentModel = modelPublish.StudentList.Where(x => x.GuestId == GuestId).FirstOrDefault(); List<RB_Examination_StudentDetails_ViewModel> stuList = new List<RB_Examination_StudentDetails_ViewModel>();
studentModel.ExamEndTime = System.DateTime.Now;
if (list != null && list.Any()) if (list != null && list.Any())
{ {
foreach (var item in list) foreach (var item in list)
...@@ -1398,16 +1399,34 @@ namespace Edu.Module.Exam ...@@ -1398,16 +1399,34 @@ namespace Edu.Module.Exam
} }
else else
{ {
flag = examination_StudentDetailsRepository.Insert(model) > 0; var newId = examination_StudentDetailsRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
} }
stuList.Add(model);
} }
if (flag)//试卷提交成功,更新考试最后时间 if (flag)//试卷提交成功,更新考试最后时间
{ {
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{nameof(RB_Examination_Student_ViewModel.ExamEndTime), studentModel.ExamEndTime} {nameof(RB_Examination_Student_ViewModel.ExamEndTime), DateTime.Now},
{nameof(RB_Examination_Student_ViewModel.ExamStatus ), ExamTestStatusEnum.FinishTest},
};
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Examination_Student_ViewModel.PaperId),PaperId),
new WhereHelper(nameof(RB_Examination_Student_ViewModel.PublishId),PublishId),
new WhereHelper(nameof(RB_Examination_Student_ViewModel.GuestId),GuestId),
}; };
flag = examination_StudentRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Student_ViewModel.Id), studentModel.Id)); flag = examination_StudentRepository.Update(fileds, wheres);
}
var config = GetExaminationConfigureModel(new RB_Examination_Configure_ViewModel() {
Group_Id= UserGroupId
});
//自动阅卷
if (config.IsOpenAutoMarking == 1)
{
AutoReviewPaperModule(modelPublish.IsHalfScore, list, stuList);
} }
} }
return flag; return flag;
......
...@@ -4,6 +4,7 @@ using System; ...@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using VT.FW.DB;
namespace Edu.Module.Exam namespace Edu.Module.Exam
{ {
...@@ -25,28 +26,15 @@ namespace Edu.Module.Exam ...@@ -25,28 +26,15 @@ namespace Edu.Module.Exam
/// <param name="PublishId">发布编号</param> /// <param name="PublishId">发布编号</param>
/// <param name="GuestId">学员编号</param> /// <param name="GuestId">学员编号</param>
/// <returns></returns> /// <returns></returns>
public bool AutoReviewPaperModule(int PaperId, int PublishId, int GuestId) public bool AutoReviewPaperModule(int IsHalfScore, List<RB_Examination_Details_ViewModel> questionList, List<RB_Examination_StudentDetails_ViewModel> stuList)
{ {
bool flag = false; bool flag = false;
var paperConfig = examination_PublishRepository.GetEntity(PublishId);
//多选题未选全是否给一半的分
var IsHalfScore = paperConfig?.IsHalfScore ?? 0;
List<RB_Examination_StudentDetails_ViewModel> answerList = new List<RB_Examination_StudentDetails_ViewModel>(); List<RB_Examination_StudentDetails_ViewModel> answerList = new List<RB_Examination_StudentDetails_ViewModel>();
if (questionList != null && questionList.Count > 0)
//试卷题目
var sourceQuestionList = examination_DetailsRepository.GetExaminationDetailsListRepository(new RB_Examination_Details_ViewModel() { PaperId = PaperId });
//学员提交答案列表
var stuQuesList = examination_StudentDetailsRepository.GetExaminationStudentListRepository(new RB_Examination_StudentDetails_ViewModel()
{
GuestId = GuestId,
PaperId = PaperId,
PublishId = PublishId,
});
if (sourceQuestionList != null && sourceQuestionList.Count > 0)
{ {
foreach (var sItem in sourceQuestionList) foreach (var sItem in questionList)
{ {
var answerModel = stuQuesList?.Where(qitem => qitem.DetailsId == sItem.Id)?.FirstOrDefault(); var answerModel = stuList?.Where(qitem => qitem.DetailsId == sItem.Id)?.FirstOrDefault();
if (answerModel != null && answerModel.Id > 0) if (answerModel != null && answerModel.Id > 0)
{ {
switch (sItem.QuestionTypeKey) switch (sItem.QuestionTypeKey)
...@@ -64,7 +52,14 @@ namespace Edu.Module.Exam ...@@ -64,7 +52,14 @@ namespace Edu.Module.Exam
break; break;
//多选题 //多选题
case "multiple": case "multiple":
if (sItem.Answer == answerModel.StundetAnswer)
{
answerList.Add(new RB_Examination_StudentDetails_ViewModel()
{
Id = answerModel.Id,
StundetScore = sItem.Score
});
}
break; break;
//填空题 //填空题
case "fill-in": case "fill-in":
...@@ -166,6 +161,18 @@ namespace Edu.Module.Exam ...@@ -166,6 +161,18 @@ namespace Edu.Module.Exam
} }
} }
} }
if (answerList != null && answerList.Count > 0)
{
foreach (var item in answerList)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Examination_StudentDetails_ViewModel.StundetScore),item.StundetScore },
{nameof(RB_Examination_StudentDetails_ViewModel.IsMarking),1 },
};
examination_StudentDetailsRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_StudentDetails_ViewModel.Id), item.Id));
}
}
return flag; return flag;
} }
} }
......
...@@ -24,8 +24,8 @@ namespace Edu.Repository.Exam ...@@ -24,8 +24,8 @@ namespace Edu.Repository.Exam
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT A.*,IFNULL(B.GuestName,'') AS GuestName SELECT A.*,IFNULL(B.GuestName,'') AS GuestName
FROM RB_Examination_StudentDetails AS A FROM RB_Examination_StudentDetails AS A
LEFT JOIN RB_Examination_Student AS c ON C.GuestId=a.GuestId INNER JOIN RB_Examination_Student AS c ON (C.GuestId=a.GuestId AND A.PaperId=C.PaperId AND A.PublishId=C.PublishId)
LEFT JOIN rb_order_guest AS B ON c.GuestId=B.Id INNER JOIN rb_order_guest AS B ON c.GuestId=B.Id
WHERE 1=1 WHERE 1=1
"); ");
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Examination_StudentDetails_ViewModel.Status), 0); builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Examination_StudentDetails_ViewModel.Status), 0);
......
...@@ -609,6 +609,7 @@ namespace Edu.WebApi.Controllers.Applet ...@@ -609,6 +609,7 @@ namespace Edu.WebApi.Controllers.Applet
LevelType = (LevelTypeEnum)sObj.GetInt("LevelType"), LevelType = (LevelTypeEnum)sObj.GetInt("LevelType"),
Answer=sObj.GetStringValue("Answer"), Answer=sObj.GetStringValue("Answer"),
StuPaperGroupId= jobj.GetInt("GId"), StuPaperGroupId= jobj.GetInt("GId"),
Score=sObj.GetDecimal("Score"),
}; };
paperDetailsList.Add(detailModel); paperDetailsList.Add(detailModel);
} }
...@@ -616,7 +617,12 @@ namespace Edu.WebApi.Controllers.Applet ...@@ -616,7 +617,12 @@ namespace Edu.WebApi.Controllers.Applet
} }
} }
} }
var result = paperModule.SetStuExamPaperDetailsModule(PublishId, GuestId,PaperId, paperDetailsList); int Group_Id = base.ParmJObj.GetInt("Group_Id");
if (Group_Id <= 0)
{
Group_Id = base.AppletUserInfo.Group_Id;
}
var result = paperModule.SetStuExamPaperDetailsModule(PublishId, GuestId,PaperId, Group_Id, paperDetailsList);
return result ? ApiResult.Success("提交试卷成功") : ApiResult.Failed("提交试卷失败"); return result ? ApiResult.Success("提交试卷成功") : ApiResult.Failed("提交试卷失败");
} }
#endregion #endregion
......
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