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

页面修改

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