Commit 003b9580 authored by 黄奎's avatar 黄奎

页面修改

parent a36b4184
......@@ -127,5 +127,10 @@ namespace Edu.Model.Entity.Exam
/// 题目分数
/// </summary>
public decimal Score { get; set; }
/// <summary>
/// 分组编号
/// </summary>
public int GId { get; set; }
}
}
using System;
using Edu.Common.Enum.Course;
using Edu.Common.Enum.Exam;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
......@@ -28,12 +30,12 @@ namespace Edu.Model.Entity.Exam
public string GroupName { get; set; }
/// <summary>
/// 问题类型编号
/// 问题类型编号【GroupType=1时使用】
/// </summary>
public int QuestionTypeId { get; set; }
/// <summary>
/// 问题类型Key
/// 问题类型Key【GroupType=1时使用】
/// </summary>
public string QuestionTypeKey { get; set; }
......@@ -46,5 +48,15 @@ namespace Edu.Model.Entity.Exam
/// 分数
/// </summary>
public decimal GScore { get; set; }
/// <summary>
/// 组卷类型
/// </summary>
public ExamGroupTypeEnum GroupType { get; set; }
/// <summary>
/// 题目分类编号【GroupType=2时使用】
/// </summary>
public QuestionCategoryEnum CategoryId { get; set; }
}
}
using Edu.Common.Enum.Question;
using Edu.Common.Enum.Exam;
using Edu.Common.Enum.Question;
using System;
using System.Collections.Generic;
using System.Text;
......@@ -102,5 +103,15 @@ namespace Edu.Model.Entity.Exam
/// 审核和备注
/// </summary>
public string ExamineRemark { get; set; }
/// <summary>
/// 组卷类型
/// </summary>
public ExamGroupTypeEnum GroupType { get; set; }
/// <summary>
/// 试卷总分数
/// </summary>
public decimal PaperScore { get; set; }
}
}
using Edu.Common.Enum;
using Edu.Common.Enum.Exam;
using Edu.Common.Enum.Question;
using System;
using System.Collections.Generic;
......@@ -73,5 +74,10 @@ namespace Edu.Model.Entity.Exam
/// 模板题库编号
/// </summary>
public string TemplateBankIds { get; set; }
/// <summary>
/// 组卷类型
/// </summary>
public ExamGroupTypeEnum GroupType { get; set; }
}
}
\ No newline at end of file
using Edu.Common.Enum.Course;
using Edu.Common.Enum.Exam;
using Edu.Common.Enum.Question;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Exam
{
......@@ -11,13 +10,14 @@ namespace Edu.Model.ViewModel.Exam
/// </summary>
public class ExamTemplate
{
/// <summary>
/// 问题类型编号
/// 问题类型编号【GroupType=1时使用】
/// </summary>
public int QuestionTypeId { get; set; }
/// <summary>
/// 问题类型Key
/// 问题类型Key【GroupType=1时使用】
/// </summary>
public string QuestionTypeKey { get; set; }
......@@ -51,10 +51,6 @@ namespace Edu.Model.ViewModel.Exam
/// </summary>
public List<DifficultyTypeItem> ChooseList { get; set; }
/// <summary>
/// 题目分类列表
/// </summary>
public List<CategoryItem> CategoryList { get; set; }
}
/// <summary>
......@@ -72,26 +68,4 @@ namespace Edu.Model.ViewModel.Exam
/// </summary>
public int ChooseNum { get; set; }
}
/// <summary>
/// 题型分类
/// </summary>
public class CategoryItem
{
/// <summary>
/// 题型分类
/// </summary>
public QuestionCategoryEnum Category { get; set; }
/// <summary>
/// 选择题目数
/// </summary>
public int ChooseNum { get; set; }
/// <summary>
/// 难易程度选题【ChooseType=2时使用】
/// </summary>
public List<DifficultyTypeItem> ChooseList { get; set; }
}
}
This diff is collapsed.
......@@ -143,7 +143,7 @@ namespace Edu.Module.Question
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<object> GetQuestionCategoryListModule(RB_Question_ViewModel query)
public List<object> GetQuestionTypeStaticListModule(RB_Question_ViewModel query)
{
List<object> list = new List<object>();
var dataList = questionRepository.GetQuestionStaticsListRepository(query);
......@@ -158,11 +158,12 @@ namespace Edu.Module.Question
{
var qType = questionTypeList?.Where(qitem => qitem.QId == item.QuestionTypeId)?.FirstOrDefault();
var diffTypeList = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId)
.GroupBy(qitem =>new { qitem.DifficultyType })
.Select(qitem => new
{
qitem.DifficultyType,
DifficultyTypeName = qitem.DifficultyType.ToName(),
DifficultyTypeCount = qitem.QuestionCount,
qitem.Key.DifficultyType,
DifficultyTypeName = qitem.Key.DifficultyType.ToName(),
DifficultyTypeCount = qitem.Sum(sItem=>sItem.QuestionCount),
ChooseNum = 0
});
......@@ -190,22 +191,21 @@ namespace Edu.Module.Question
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<object> GetQuestionCategoryList_V2Module(RB_Question_ViewModel query)
public List<object> GetQuestionCategoryStaticListModule(RB_Question_ViewModel query)
{
List<object> list = new List<object>();
var dataList = questionRepository.GetQuestionStaticsListRepository(query);
if (dataList != null && dataList.Count > 0)
{
var questionTypeList = GetQuestionTypeListModule(new RB_Question_Type_ViewModel());
var groupList = dataList.GroupBy(qitem => new { qitem.QuestionTypeId, }).Select(qitem => new
var groupList = dataList.GroupBy(qitem => new { qitem.Category, }).Select(qitem => new
{
qitem.Key.QuestionTypeId
qitem.Key.Category
});
foreach (var item in groupList)
{
var qType = questionTypeList?.Where(qitem => qitem.QId == item.QuestionTypeId)?.FirstOrDefault();
var diffTypeList = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId)
.GroupBy(qitem => new { qitem.QuestionTypeId,qitem.DifficultyType})
var diffTypeList = dataList.Where(qitem => qitem.Category == item.Category)
.GroupBy(qitem => new {qitem.DifficultyType})
.Select(qitem => new
{
qitem.Key.DifficultyType,
......@@ -213,41 +213,17 @@ namespace Edu.Module.Question
DifficultyTypeCount = qitem.Sum(c=>c.QuestionCount),
ChooseNum = 0
});
var categoryList = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId).GroupBy(qitem => new { qitem.Category }).Select(qitem => new { qitem.Key.Category });
List<object> resultCategoryList = new List<object>();
foreach (var subItem in categoryList)
{
var tempCategoryList = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId && qitem.Category == subItem.Category)?.ToList();
if (tempCategoryList != null && tempCategoryList.Count > 0)
{
var cObj = new
{
subItem.Category,
CategoryName = subItem.Category.ToName(),
QuestionTypeNum = tempCategoryList.Sum(qitem=>qitem.QuestionCount),
ChooseNum = 0,
ChooseList= tempCategoryList?.Select(qitem => new
{
qitem.DifficultyType,
DifficultyTypeName = qitem.DifficultyType.ToName(),
DifficultyTypeCount = qitem.QuestionCount,
ChooseNum = 0
})
};
resultCategoryList.Add(cObj);
}
}
var obj = new
{
item.QuestionTypeId,
QuestionTypeKey = qType?.Key,
QuestionTypeName = qType?.Name,
QuestionTypeId=item.Category,
QuestionTypeKey = "",
QuestionTypeName =item.Category.ToName(),
QuestionScore = 0,
QuestionDesc = "",
ChooseType = 1,
ChooseNum = 0,
QuestionTypeNum = dataList.Where(qitem => qitem.QuestionTypeId == item.QuestionTypeId).Sum(qitem => qitem.QuestionCount),
CategoryList= resultCategoryList,
QuestionTypeNum = dataList.Where(qitem => qitem.Category == item.Category).Sum(qitem => qitem.QuestionCount),
ChooseList = diffTypeList,
};
list.Add(obj);
......
......@@ -44,6 +44,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Question_ViewModel.QuestionTypeId), query.Q_QuestionTypeIds);
}
if (!string.IsNullOrEmpty(query.QCategoryId))
{
builder.AppendFormat(" AND {0} IN({1}) ", nameof(RB_Question_ViewModel.Category), query.QCategoryId);
}
return Get<RB_Question_ViewModel>(builder.ToString()).ToList();
}
}
......@@ -84,6 +88,7 @@ WHERE 1=1 AND `Status`=0
}
}
/// <summary>
/// 获取问题分页列表
/// </summary>
......
......@@ -241,13 +241,31 @@ namespace Edu.WebApi.Controllers.Course
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 根据题库编号获取题库题型列表【试卷组卷使用】
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetQuestionTypeStaticList()
{
var query = new RB_Question_ViewModel()
{
CourseId = base.ParmJObj.GetInt("CourseId"),
Title = base.ParmJObj.GetStringValue("Title"),
PointName = base.ParmJObj.GetStringValue("PointName"),
BankId = base.ParmJObj.GetInt("BankId"),
QBankIds = base.ParmJObj.GetStringValue("QBankIds"),
};
var data = questionModule.GetQuestionTypeStaticListModule(query);
return ApiResult.Success(data: data);
}
/// <summary>
/// 根据题库编号获取题库题型分类列表【试卷组卷使用】
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetQuestionCategoryList()
public ApiResult GetQuestionCategoryStaticList()
{
var query = new RB_Question_ViewModel()
{
......@@ -257,11 +275,10 @@ namespace Edu.WebApi.Controllers.Course
BankId = base.ParmJObj.GetInt("BankId"),
QBankIds = base.ParmJObj.GetStringValue("QBankIds"),
};
var data = questionModule.GetQuestionCategoryList_V2Module(query);
var data = questionModule.GetQuestionCategoryStaticListModule(query);
return ApiResult.Success(data: data);
}
/// <summary>
/// 获取问题难易列表
/// </summary>
......
......@@ -136,6 +136,8 @@ namespace Edu.WebApi.Controllers.Exam
PaperType = base.ParmJObj.GetInt("PaperType"),
ParentId = base.ParmJObj.GetInt("ParentId"),
IsOpen = base.ParmJObj.GetInt("IsOpen"),
GroupType=(ExamGroupTypeEnum)base.ParmJObj.GetInt("GroupType"),
PaperScore=base.ParmJObj.GetDecimal("PaperScore"),
};
if (string.IsNullOrEmpty(extModel.PaperName))
{
......@@ -157,12 +159,24 @@ namespace Edu.WebApi.Controllers.Exam
GId = jobj.GetInt("GId"),
PaperId = jobj.GetInt("PaperId"),
GroupName = jobj.GetStringValue("GroupName"),
QuestionTypeId = jobj.GetInt("QuestionTypeId"),
QuestionTypeKey = jobj.GetStringValue("QuestionTypeKey"),
GSortNum = gSortNum,
GScore = jobj.GetDecimal("GScore"),
DetailsList = new List<RB_Examination_Details_ViewModel>(),
GroupType=extModel.GroupType,
};
if (extModel.GroupType == ExamGroupTypeEnum.QuestionType)
{
gModel.QuestionTypeId = jobj.GetInt("QuestionTypeId");
gModel.QuestionTypeKey = jobj.GetStringValue("QuestionTypeKey");
gModel.CategoryId = 0;
}
else if (extModel.GroupType == ExamGroupTypeEnum.QuestionClassify)
{
gModel.QuestionTypeId = 0;
gModel.QuestionTypeKey = "";
gModel.CategoryId = (QuestionCategoryEnum)jobj.GetInt("QuestionTypeId");
}
gSortNum++;
string details = jobj.GetStringValue("DetailsList");
if (!string.IsNullOrEmpty(details))
......@@ -245,6 +259,7 @@ namespace Edu.WebApi.Controllers.Exam
IsSaveTemplate = base.ParmJObj.GetBoolValue("IsSaveTemplate"),
ParentId = base.ParmJObj.GetInt("ParentId"),
IsOpen = base.ParmJObj.GetInt("IsOpen"),
GroupType=(ExamGroupTypeEnum)base.ParmJObj.GetInt("GroupType"),
};
string TemplateData = base.ParmJObj.GetStringValue("TemplateData");
if (!string.IsNullOrEmpty(TemplateData))
......
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