20220424 清日志、清考勤定时器,考试生成试卷接口方法修改

This commit is contained in:
2022-04-24 18:29:54 +08:00
parent 54fc77e7c1
commit 93df6c189c
21 changed files with 412 additions and 73 deletions
+74 -30
View File
@@ -99,14 +99,32 @@ namespace BLL
if (item == null)
{
List<Model.Training_TestTrainingItem> getTestTrainingItemList = new List<Model.Training_TestTrainingItem>();
//// 计划考试中单选、多选、判断题总数
int sumTestType1Count =0;
int sumTestType2Count = 0;
int sumTestType3Count = 0;
var testPlanTrainings = from x in db.Training_TestPlanTraining
where x.TestPlanId == getTestPlan.TestPlanId
select x;
//// 计划考试中单选、多选、判断题总数
int sumTestType1Count = testPlanTrainings.Sum(x => x.TestType1Count) ?? 0;
int sumTestType2Count = testPlanTrainings.Sum(x => x.TestType2Count) ?? 0;
int sumTestType3Count = testPlanTrainings.Sum(x => x.TestType3Count) ?? 0;
if (testPlanTrainings.Count() > 0)
{
//// 计划考试中单选、多选、判断题总数
sumTestType1Count = testPlanTrainings.Sum(x => x.TestType1Count) ?? 0;
sumTestType2Count = testPlanTrainings.Sum(x => x.TestType2Count) ?? 0;
sumTestType3Count = testPlanTrainings.Sum(x => x.TestType3Count) ?? 0;
}
else
{
var getTestRule = db.Sys_TestRule.FirstOrDefault();
if (getTestRule != null)
{
sumTestType1Count = getTestRule.SCount;
sumTestType2Count = getTestRule.MCount;
sumTestType3Count = getTestRule.JCount;
}
}
////获取类型下适合岗位试题集合
var getTestTrainingItemALLs = from x in db.Training_TestTrainingItem
where x.TrainingId != null && (x.WorkPostIds == null || (x.WorkPostIds.Contains(person.WorkPostId) && person.WorkPostId != null))
@@ -331,38 +349,64 @@ namespace BLL
#region TestRecordId获取试卷题目列表
/// <summary>
/// 记录数
/// </summary>
public static int geTestRecordItemCount
{
get;
set;
}
/// <summary>
/// 根据TestRecordId获取试卷题目列表
/// </summary>
/// <param name="testPlanId"></param>
/// <returns>考试人员</returns>
public static List<Model.TestRecordItemItem> geTestRecordItemListByTestRecordId(string testRecordId)
public static List<Model.TestRecordItemItem> geTestRecordItemListByTestRecordId(string testRecordId, int pageIndex)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getDataLists = (from x in db.Training_TestRecordItem
where x.TestRecordId == testRecordId
orderby x.TestType, x.TrainingItemCode
select new Model.TestRecordItemItem
{
TestRecordItemId = x.TestRecordItemId,
TestRecordId = x.TestRecordId,
TrainingItemCode = x.TrainingItemCode,
TrainingItemName = x.TrainingItemName,
Abstracts = x.Abstracts,
AttachUrl = x.AttachUrl.Replace("\\", "/") ?? "",
TestType = x.TestType,
TestTypeName = x.TestType == "1" ? "单选题" : (x.TestType == "2" ? "多选题" : "判断题"),
AItem = x.AItem ?? "",
BItem = x.BItem ?? "",
CItem = x.CItem ?? "",
DItem = x.DItem ?? "",
EItem = x.EItem ?? "",
AnswerItems = x.AnswerItems ?? "",
Score = x.Score ?? 0,
SubjectScore = x.SubjectScore ?? 0,
SelectedItem = x.SelectedItem ?? "",
}).ToList();
return getDataLists;
var getDatas= from x in db.Training_TestRecordItem
where x.TestRecordId == testRecordId
select x;
geTestRecordItemCount = getDatas.Count();
if (geTestRecordItemCount == 0)
{
return null;
}
else
{
var getDataLists = from x in getDatas
orderby x.TestType, x.TrainingItemCode
select new Model.TestRecordItemItem
{
TestRecordItemId = x.TestRecordItemId,
TestRecordId = x.TestRecordId,
TrainingItemCode = x.TrainingItemCode,
TrainingItemName = x.TrainingItemName,
Abstracts = x.Abstracts,
AttachUrl = x.AttachUrl.Replace("\\", "/") ?? "",
TestType = x.TestType,
TestTypeName = x.TestType == "1" ? "单选题" : (x.TestType == "2" ? "多选题" : "判断题"),
AItem = x.AItem ?? "",
BItem = x.BItem ?? "",
CItem = x.CItem ?? "",
DItem = x.DItem ?? "",
EItem = x.EItem ?? "",
AnswerItems = x.AnswerItems ?? "",
Score = x.Score ?? 0,
SubjectScore = x.SubjectScore ?? 0,
SelectedItem = x.SelectedItem ?? "",
};
if (pageIndex > 0)
{
return getDataLists.Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList();
}
else
{
return getDataLists.ToList();
}
}
}
}
#endregion