Commit 69f88bcc authored by liudong1993's avatar liudong1993

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

parents 83ca6d43 42c7bad8
using Edu.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Common.Enum.Exam
{
/// <summary>
/// 题库类型
/// </summary>
public enum BankTypeEnum
{
/// <summary>
/// N5
/// </summary>
[EnumField("N5")]
N5 = 1,
/// <summary>
/// N4
/// </summary>
[EnumField("N4")]
N4 = 2,
/// <summary>
/// N3
/// </summary>
[EnumField("N3")]
N3 = 3,
/// <summary>
/// N2
/// </summary>
[EnumField("N2")]
N2 = 4,
/// <summary>
/// N1
/// </summary>
[EnumField("N1")]
N1 = 5,
/// <summary>
/// 高考
/// </summary>
[EnumField("高考")]
CollegeEntranceExamination =6,
}
}
using Edu.Common.Enum;
using Edu.Common.Enum.Exam;
using Edu.Common.Enum.Question;
using System;
using VT.FW.DB;
......@@ -66,7 +67,7 @@ namespace Edu.Model.Entity.Question
/// <summary>
/// 题库类型(见枚举)
/// </summary>
public BankTypeEnum BankType { get; set; }
public LevelTypeEnum BankType { get; set; }
}
}
using Edu.Common;
using Edu.Common.Enum.Exam;
using Edu.Common.Enum.Question;
using Edu.Common.Plugin;
using System.Collections.Generic;
......@@ -127,6 +128,6 @@ namespace Edu.Model.ViewModel.Question
/// <summary>
/// 题库类型(见枚举)
/// </summary>
public BankTypeEnum BankType { get; set; }
public LevelTypeEnum BankType { get; set; }
}
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ using VT.FW.DB;
using Edu.Repository.Question;
using Edu.Module.Question;
using Edu.Common.Plugin;
using Edu.Common.Enum.Question;
namespace Edu.Module.Exam
{
......@@ -59,6 +60,11 @@ namespace Edu.Module.Exam
/// </summary>
private readonly RB_Question_BankRepository question_BankRepository = new RB_Question_BankRepository();
/// <summary>
/// 学员练习仓储层对象
/// </summary>
private readonly RB_Student_PracticeRepository student_PracticeRepository = new RB_Student_PracticeRepository();
#region 单词测试和复习
/// <summary>
/// 生成课程复习和预习单词
......@@ -662,26 +668,46 @@ namespace Edu.Module.Exam
/// 题型数量统计
/// </summary>
/// <param name="query"></param>
public object GetAppQuestionStaticModule(RB_Question_ViewModel query)
public object GetAppQuestionStaticModule(RB_Question_ViewModel query,int StudentId)
{
object obj = new object();
int readingCount = 0;
int listeningCount = 0;
int grammarCount = 0;
int wordsCount = 0;
int readingTotalCount = 0;
int readingFinishCount = 0;
int listeningTotalCount = 0;
int listeningFinishCount = 0;
int grammarTotalCount = 0;
int grammarFinishCount = 0;
int wordsTotalCount = 0;
int wordsFinishCount = 0;
var sQuery = new RB_Student_Practice_Extend()
{
StudentId = StudentId,
};
sQuery.LevelType = query?.BankType ?? 0;
var finishList = student_PracticeRepository.GetStudentPracticeListRepository(sQuery);
if (finishList != null && finishList.Count > 0)
{
readingFinishCount = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ReadingChoose)?.Count() ?? 0;
listeningFinishCount = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.Listening)?.Count() ?? 0;
grammarFinishCount = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseGrammarUse)?.Count() ?? 0;
}
var list = questionRepository.GetQuestionCategoryListRepository(query);
if (list != null && list.Count > 0)
{
readingCount = list?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ReadingChoose)?.Sum(qitem => qitem.QuestionCount) ?? 0;
listeningCount= list?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.Listening)?.Sum(qitem => qitem.QuestionCount) ?? 0;
grammarCount = list?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseGrammarUse)?.Sum(qitem => qitem.QuestionCount) ?? 0;
readingTotalCount = list?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ReadingChoose)?.Sum(qitem => qitem.QuestionCount) ?? 0;
listeningTotalCount = list?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.Listening)?.Sum(qitem => qitem.QuestionCount) ?? 0;
grammarTotalCount = list?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseGrammarUse)?.Sum(qitem => qitem.QuestionCount) ?? 0;
}
obj = new
{
readingCount,
listeningCount,
grammarCount,
wordsCount
readingFinishCount,
readingTotalCount,
listeningFinishCount,
listeningTotalCount,
grammarTotalCount,
grammarFinishCount,
wordsTotalCount,
wordsFinishCount
};
return obj;
}
......@@ -884,6 +910,32 @@ namespace Edu.Module.Exam
}
return result;
}
/// <summary>
/// 新增修改学员练习
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetStudentPracticeModule(RB_Student_Practice_Extend model)
{
bool flag = false;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Student_Practice_Extend.IsAnswer),model.IsAnswer },
{nameof(RB_Student_Practice_Extend.IsWrong),model.IsWrong },
};
flag = student_PracticeRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Practice_Extend.Id), model.Id));
}
else
{
var newId = student_PracticeRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
#endregion
}
}
......@@ -100,7 +100,7 @@ namespace Edu.WebApi.Controllers.Course
BankId=base.ParmJObj.GetInt("BankId"),
BankNo=base.ParmJObj.GetStringValue("BankNo"),
BankName=base.ParmJObj.GetStringValue("BankName"),
BankType=(BankTypeEnum)base.ParmJObj.GetInt("BankType"),
BankType=(LevelTypeEnum)base.ParmJObj.GetInt("BankType"),
};
extModel.CreateTime = DateTime.Now;
extModel.CreateBy = base.UserInfo.Id;
......@@ -120,7 +120,7 @@ namespace Edu.WebApi.Controllers.Course
[HttpPost]
public ApiResult GetBankTypeList()
{
var list = Common.Plugin.EnumHelper.EnumToList(typeof(BankTypeEnum));
var list = Common.Plugin.EnumHelper.EnumToList(typeof(LevelTypeEnum));
return ApiResult.Success(data:list);
}
......
......@@ -972,9 +972,10 @@ namespace Edu.WebApi.Controllers.Exam
{
var query = new RB_Question_ViewModel()
{
BankType = (BankTypeEnum)base.ParmJObj.GetInt("BankType"),
BankType = (LevelTypeEnum)base.ParmJObj.GetInt("BankType"),
};
var obj = courseExamModule.GetAppQuestionStaticModule(query);
int StudentId = base.ParmJObj.GetInt("StudentId");
var obj = courseExamModule.GetAppQuestionStaticModule(query, StudentId);
return ApiResult.Success(data: obj);
}
......@@ -988,7 +989,7 @@ namespace Edu.WebApi.Controllers.Exam
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Question_ViewModel()
{
BankType = (BankTypeEnum)base.ParmJObj.GetInt("BankType"),
BankType = (LevelTypeEnum)base.ParmJObj.GetInt("BankType"),
QCategoryId = base.ParmJObj.GetStringValue("QCategoryId"),
};
var list = courseExamModule.GetAppQuestionCategoryListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
......@@ -1007,7 +1008,7 @@ namespace Edu.WebApi.Controllers.Exam
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Question_ViewModel()
{
BankType = (BankTypeEnum)base.ParmJObj.GetInt("BankType"),
BankType = (LevelTypeEnum)base.ParmJObj.GetInt("BankType"),
QCategoryId = string.Format("{0}", (int)QuestionCategoryEnum.ChooseGrammarUse),
};
var list = courseExamModule.GetAppQuestionCategoryListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
......@@ -1026,7 +1027,7 @@ namespace Edu.WebApi.Controllers.Exam
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Question_ViewModel()
{
BankType = (BankTypeEnum)base.ParmJObj.GetInt("BankType"),
BankType = (LevelTypeEnum)base.ParmJObj.GetInt("BankType"),
QCategoryId = string.Format("{0}", (int)QuestionCategoryEnum.Listening),
};
var list = courseExamModule.GetAppQuestionCategoryListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
......@@ -1045,7 +1046,7 @@ namespace Edu.WebApi.Controllers.Exam
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Question_ViewModel()
{
BankType = (BankTypeEnum)base.ParmJObj.GetInt("BankType"),
BankType = (LevelTypeEnum)base.ParmJObj.GetInt("BankType"),
QCategoryId = string.Format("{0}", (int)QuestionCategoryEnum.ReadingChoose),
};
var list = courseExamModule.GetAppQuestionCategoryListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
......@@ -1064,7 +1065,7 @@ namespace Edu.WebApi.Controllers.Exam
var pageModel = JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Question_Bank_ViewModel()
{
BankType = (BankTypeEnum)base.ParmJObj.GetInt("BankType"),
BankType = (LevelTypeEnum)base.ParmJObj.GetInt("BankType"),
};
var list = courseExamModule.GetAppBankPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.Count = rowsCount;
......
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