Commit f6814fb3 authored by 黄奎's avatar 黄奎

页面修改

parent 40a5745b
...@@ -134,5 +134,10 @@ namespace Edu.Model.ViewModel.Question ...@@ -134,5 +134,10 @@ namespace Edu.Model.ViewModel.Question
/// 开始问题编号 /// 开始问题编号
/// </summary> /// </summary>
public int StartId { get; set; } public int StartId { get; set; }
/// <summary>
/// 排序类型(1-问题编号)
/// </summary>
public int OrderByType { get; set; }
} }
} }
\ No newline at end of file
...@@ -678,7 +678,7 @@ namespace Edu.Module.Exam ...@@ -678,7 +678,7 @@ namespace Edu.Module.Exam
/// 题型数量统计 /// 题型数量统计
/// </summary> /// </summary>
/// <param name="query"></param> /// <param name="query"></param>
public object GetAppQuestionStaticModule(RB_Question_ViewModel query,int StudentId) public object GetAppQuestionStaticModule(RB_Question_ViewModel query, int StudentId)
{ {
object obj = new object(); object obj = new object();
int readingTotalCount = 0; int readingTotalCount = 0;
...@@ -707,7 +707,7 @@ namespace Edu.Module.Exam ...@@ -707,7 +707,7 @@ namespace Edu.Module.Exam
var tempListeningList = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.Listening)?.ToList(); var tempListeningList = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.Listening)?.ToList();
listeningFinishCount = tempListeningList?.Count() ?? 0; listeningFinishCount = tempListeningList?.Count() ?? 0;
listeningStartId = tempListeningList != null && tempListeningList.Count>0?( tempListeningList?.Max(qitem=>qitem.QuestionId) ?? 0):0; listeningStartId = tempListeningList != null && tempListeningList.Count > 0 ? (tempListeningList?.Max(qitem => qitem.QuestionId) ?? 0) : 0;
var tempGrammarList = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseGrammarUse)?.ToList(); var tempGrammarList = finishList?.Where(qitem => qitem.Category == Common.Enum.Course.QuestionCategoryEnum.ChooseGrammarUse)?.ToList();
grammarFinishCount = tempGrammarList?.Count() ?? 0; grammarFinishCount = tempGrammarList?.Count() ?? 0;
...@@ -762,6 +762,7 @@ namespace Edu.Module.Exam ...@@ -762,6 +762,7 @@ namespace Edu.Module.Exam
public List<object> GetAppQuestionCategoryListModule(int pageIndex, int pageSize, out long rowsCount, RB_Question_ViewModel query) public List<object> GetAppQuestionCategoryListModule(int pageIndex, int pageSize, out long rowsCount, RB_Question_ViewModel query)
{ {
List<object> list = new List<object>(); List<object> list = new List<object>();
query.OrderByType = 1;
var dataList = questionRepository.GetQuestionPageListRepository(pageIndex, pageSize, out rowsCount, query); var dataList = questionRepository.GetQuestionPageListRepository(pageIndex, pageSize, out rowsCount, query);
if (dataList != null && dataList.Count > 0) if (dataList != null && dataList.Count > 0)
{ {
...@@ -769,77 +770,40 @@ namespace Edu.Module.Exam ...@@ -769,77 +770,40 @@ namespace Edu.Module.Exam
{ {
var QuestionContentObj = analysisQuestion.ParsingQuestion(item.QuestionTypeKey, item.QuestionContent); var QuestionContentObj = analysisQuestion.ParsingQuestion(item.QuestionTypeKey, item.QuestionContent);
List<object> quesAnswerList = new List<object>(); List<object> quesAnswerList = new List<object>();
//填空题、分录题、资料题 if (!string.IsNullOrEmpty(item.Answer.ToString()))
if (item.QuestionTypeKey == "fill-in" || item.QuestionTypeKey == "entry-problem" || item.QuestionTypeKey == "data-question")
{ {
var tempList = item.Answer.Split('★'); try
if (tempList != null && tempList.Count() > 0)
{ {
foreach (var tItem in tempList) var tempList = Common.ConvertHelper.StringToFileList(item.Answer);
if (tempList != null && tempList.Count > 0)
{ {
quesAnswerList.Add(tItem); foreach (var tItem in tempList)
}
}
}
//完型填空
else if (item.QuestionTypeKey == "cloze")
{
if (!string.IsNullOrEmpty(item.Answer.ToString()))
{
try
{
var qAnsList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(item.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0)
{ {
foreach (var tItem in qAnsList) quesAnswerList.Add(tItem);
{
quesAnswerList.Add(tItem);
}
} }
} }
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetAppQuestionCategoryListModule_Cloze:" + Common.Plugin.JsonHelper.Serialize(item));
}
} }
catch (Exception ex)
}
else
{
if (!string.IsNullOrEmpty(item.Answer.ToString()))
{ {
try Common.Plugin.LogHelper.Write(ex, "GetAppQuestionCategoryListModule_Answer:" + Common.Plugin.JsonHelper.Serialize(item));
{
var tempList = Common.ConvertHelper.StringToFileList(item.Answer);
if (tempList != null && tempList.Count > 0)
{
foreach (var tItem in tempList)
{
quesAnswerList.Add(tItem);
}
}
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetAppQuestionCategoryListModule_:" + Common.Plugin.JsonHelper.Serialize(item));
}
} }
} }
var obj = new var obj = new
{ {
item.QuestionId, item.QuestionId,
item.QuestionTypeId, item.QuestionTypeId,
item.QuestionTypeKey, item.QuestionTypeKey,
item.Category, item.Category,
LevelType=item.BankType, LevelType = item.BankType,
item.Title, item.Title,
item.DifficultyType, item.DifficultyType,
item.DifficultyTypeStr, item.DifficultyTypeStr,
item.AnswerParse, item.AnswerParse,
item.Answer,
QuestionContentObj, QuestionContentObj,
QuestionAnswerList = quesAnswerList, QuestionAnswerList = quesAnswerList,
StundetAnswer=new List<string>(), StundetAnswer = new List<string>(),
}; };
list.Add(obj); list.Add(obj);
} }
...@@ -865,7 +829,7 @@ namespace Edu.Module.Exam ...@@ -865,7 +829,7 @@ namespace Edu.Module.Exam
List<RB_Student_Exam_Extend> stuExamList = new List<RB_Student_Exam_Extend>(); List<RB_Student_Exam_Extend> stuExamList = new List<RB_Student_Exam_Extend>();
if (!string.IsNullOrEmpty(bankIds)) if (!string.IsNullOrEmpty(bankIds))
{ {
stuExamList= student_ExamRepository.GetStudentExamListRepository(new RB_Student_Exam_Extend() stuExamList = student_ExamRepository.GetStudentExamListRepository(new RB_Student_Exam_Extend()
{ {
GroupId = query.Group_Id, GroupId = query.Group_Id,
QBankIds = bankIds QBankIds = bankIds
...@@ -873,18 +837,18 @@ namespace Edu.Module.Exam ...@@ -873,18 +837,18 @@ namespace Edu.Module.Exam
} }
foreach (var item in bankList) foreach (var item in bankList)
{ {
var tempList = stuExamList?.Where(qitem => qitem.BankId == item.BankId)?.OrderByDescending(qitem=>qitem.Score)?.ToList(); var tempList = stuExamList?.Where(qitem => qitem.BankId == item.BankId)?.OrderByDescending(qitem => qitem.Score)?.ToList();
string LeastTime = "";//最短时间 string LeastTime = "";//最短时间
decimal HighestScore = 0;//最高分 decimal HighestScore = 0;//最高分
string MyUseTime = "";//用时 string MyUseTime = "";//用时
decimal MyScore = 0;//得分 decimal MyScore = 0;//得分
int MyRank = 0;//排名 int MyRank = 0;//排名
if (tempList != null) if (tempList != null && tempList.Count > 0)
{ {
var least = tempList?.OrderBy(qitem => qitem.ExamMinutes)?.FirstOrDefault(); var least = tempList?.OrderBy(qitem => qitem.ExamMinutes)?.FirstOrDefault();
LeastTime = Common.ConvertHelper.CalcMinutesAndSeconds(least.StartTime, least.EndTime); LeastTime = Common.ConvertHelper.CalcMinutesAndSeconds(least.StartTime, least.EndTime);
HighestScore = tempList?.Max(qitem => qitem.Score)??0; HighestScore = tempList?.Max(qitem => qitem.Score) ?? 0;
var myLast= tempList?.Where(qitem=>qitem.StudentId==query.StudentId).OrderByDescending(qitem =>qitem.Id)?.FirstOrDefault(); var myLast = tempList?.Where(qitem => qitem.StudentId == query.StudentId).OrderByDescending(qitem => qitem.Id)?.FirstOrDefault();
if (myLast != null) if (myLast != null)
{ {
MyUseTime = Common.ConvertHelper.CalcMinutesAndSeconds(myLast.StartTime, myLast.EndTime); MyUseTime = Common.ConvertHelper.CalcMinutesAndSeconds(myLast.StartTime, myLast.EndTime);
...@@ -925,27 +889,14 @@ namespace Edu.Module.Exam ...@@ -925,27 +889,14 @@ namespace Edu.Module.Exam
{ {
foreach (var item in questionList) foreach (var item in questionList)
{ {
var QuestionContentObj = analysisQuestion.ParsingQuestion(item.QuestionTypeKey, item.QuestionContent); var QuestionContentObj = analysisQuestion.ParsingQuestion(item.QuestionTypeKey, item.QuestionContent, isNoAnswer: true);
List<object> answerList = new List<object>();
List<object> quesAnswerList = new List<object>(); List<object> quesAnswerList = new List<object>();
//填空题、分录题、资料题
if (item.QuestionTypeKey == "fill-in" || item.QuestionTypeKey == "entry-problem" || item.QuestionTypeKey == "data-question") if (!string.IsNullOrEmpty(item.Answer.ToString()))
{
var tempList = item.Answer.Split('★');
if (tempList != null && tempList.Count() > 0)
{
foreach (var tItem in tempList)
{
answerList.Add(tItem);
}
}
}
//完型填空
else if (item.QuestionTypeKey == "cloze")
{ {
if (!string.IsNullOrEmpty(item.Answer.ToString())) try
{ {
var qAnsList = Common.Plugin.JsonHelper.DeserializeObject<List<SubAnswerItem>>(item.Answer.ToString()); var qAnsList = Common.ConvertHelper.StringToFileList(item.Answer.ToString());
if (qAnsList != null && qAnsList.Count() > 0) if (qAnsList != null && qAnsList.Count() > 0)
{ {
foreach (var tItem in qAnsList) foreach (var tItem in qAnsList)
...@@ -954,27 +905,9 @@ namespace Edu.Module.Exam ...@@ -954,27 +905,9 @@ namespace Edu.Module.Exam
} }
} }
} }
catch (Exception ex)
}
else if (item.QuestionTypeKey == "reading-comprehensio" || item.QuestionTypeKey == "listening")
{
if (!string.IsNullOrEmpty(item.Answer.ToString()))
{ {
try Common.Plugin.LogHelper.Write(ex, "GetAppBankDetailsPageModule_Answer:" + Common.Plugin.JsonHelper.Serialize(item));
{
var tempList = Common.ConvertHelper.StringToFileList(item.Answer);
if (tempList != null && tempList.Count > 0)
{
foreach (var tItem in tempList)
{
quesAnswerList.Add(tItem);
}
}
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetAppBankDetailsPageModule_Item:" + Common.Plugin.JsonHelper.Serialize(item));
}
} }
} }
var obj = new var obj = new
...@@ -982,13 +915,16 @@ namespace Edu.Module.Exam ...@@ -982,13 +915,16 @@ namespace Edu.Module.Exam
item.QuestionId, item.QuestionId,
item.QuestionTypeId, item.QuestionTypeId,
item.QuestionTypeKey, item.QuestionTypeKey,
item.Category,
LevelType = item.BankType,
item.Title, item.Title,
item.DifficultyType, item.DifficultyType,
item.DifficultyTypeStr, item.DifficultyTypeStr,
item.AnswerParse, item.AnswerParse,
QuestionContentObj, QuestionContentObj,
QuestionAnswerList = quesAnswerList, QuestionAnswerList = quesAnswerList,
AnswerList = answerList, StundetAnswer = new List<string>(),
item.Answer,
}; };
result.Add(obj); result.Add(obj);
} }
......
...@@ -201,7 +201,15 @@ WHERE 1=1 ...@@ -201,7 +201,15 @@ WHERE 1=1
{ {
builder.AppendFormat(" AND A.{0}>{1} ", nameof(RB_Question_ViewModel.QuestionId), query.StartId); builder.AppendFormat(" AND A.{0}>{1} ", nameof(RB_Question_ViewModel.QuestionId), query.StartId);
} }
builder.AppendFormat(" ORDER BY A.{0} ASC ", nameof(RB_Question_ViewModel.QuestionId)); if (query.OrderByType == 1)
{
builder.AppendFormat(" ORDER BY A.{0} ASC ", nameof(RB_Question_ViewModel.QuestionId));
}
else
{
builder.AppendFormat(" ORDER BY A.{0} ASC ", nameof(RB_Question_ViewModel.SortNum));
}
return GetPage<RB_Question_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList(); return GetPage<RB_Question_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
} }
} }
......
...@@ -51,6 +51,10 @@ WHERE 1=1 "); ...@@ -51,6 +51,10 @@ WHERE 1=1 ");
builder.AppendFormat(" AND (A.{0} LIKE @BankName OR A.{1} LIKE @BankName)", nameof(RB_Question_Bank_ViewModel.BankName), nameof(RB_Question_Bank_ViewModel.BankNo)); builder.AppendFormat(" AND (A.{0} LIKE @BankName OR A.{1} LIKE @BankName)", nameof(RB_Question_Bank_ViewModel.BankName), nameof(RB_Question_Bank_ViewModel.BankNo));
parameters.Add("BankName", "%" + query.BankName.Trim() + "%"); parameters.Add("BankName", "%" + query.BankName.Trim() + "%");
} }
if (query.BankType > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Question_Bank_ViewModel.BankType), (int)query.BankType);
}
builder.AppendFormat(" ORDER BY A.{0} ASC ", nameof(RB_Question_Bank_ViewModel.BankNo)); builder.AppendFormat(" ORDER BY A.{0} ASC ", nameof(RB_Question_Bank_ViewModel.BankNo));
return GetPage<RB_Question_Bank_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList(); return GetPage<RB_Question_Bank_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
} }
......
...@@ -24,38 +24,42 @@ namespace Edu.Repository.Sell ...@@ -24,38 +24,42 @@ namespace Edu.Repository.Sell
/// <returns></returns> /// <returns></returns>
public List<RB_ReturnMoney_Batch_ViewModel> GetPageList(int pageIndex, int pageSize, out long count, int type, string month, int groupId) public List<RB_ReturnMoney_Batch_ViewModel> GetPageList(int pageIndex, int pageSize, out long count, int type, string month, int groupId)
{ {
string sql = $@"select IFNULL(SUM(b.CommissionMoeny),0) as TotalEmployee,IFNULL(SUM(c.CommissionMoeny),0) as TotalCustomer,a.FinanceIds, string sql = $@"";
IFNULL(SUM(d.CommissionMoeny),0) as TotalInternal,IFNULL(SUM(e.CommissionMoeny),0) as TotalTrans, a.Id,a.BatchName,TotalMoney,a.CreateBy,a.CreateDate,DATE_FORMAT(a.CreateDate,'%Y-%m-%d %H:%i:%S') as CreateDateStr"; sql += $@" ";
sql += $@" from RB_ReturnMoney_Batch a LEFT JOIN sql += " ";
(SELECT SUM(CommissionMoeny) as CommissionMoeny,BatchId FROM rb_order_returncomission where OrderSourceType=1 and `Status` in(1,2) GROUP BY OrderSourceType) as b StringBuilder builder = new StringBuilder();
on a.Id=b.BatchId builder.AppendFormat(@"
LEFT JOIN SELECT IFNULL(SUM(b.CommissionMoeny),0) as TotalEmployee,IFNULL(SUM(c.CommissionMoeny),0) as TotalCustomer,a.FinanceIds
(SELECT SUM(CommissionMoeny) as CommissionMoeny,BatchId FROM rb_order_returncomission where OrderSourceType=2 and `Status` in(1,2) GROUP BY OrderSourceType) as c ,IFNULL(SUM(d.CommissionMoeny),0) as TotalInternal,IFNULL(SUM(e.CommissionMoeny),0) as TotalTrans
on a.Id=c.BatchId ,a.Id,a.BatchName,TotalMoney,a.CreateBy,a.CreateDate,DATE_FORMAT(a.CreateDate,'%Y-%m-%d %H:%i:%S') as CreateDateStr
LEFT JOIN FROM RB_ReturnMoney_Batch a LEFT JOIN
(SELECT SUM(CommissionMoeny) as CommissionMoeny,BatchId FROM rb_order_returncomission where OrderSourceType=3 and `Status` in(1,2) GROUP BY OrderSourceType ) as d (SELECT SUM(CommissionMoeny) as CommissionMoeny,BatchId FROM rb_order_returncomission where OrderSourceType=1 and `Status` in(1,2) GROUP BY OrderSourceType,BatchId) as b
on a.Id=d.BatchId on a.Id=b.BatchId
LEFT JOIN LEFT JOIN
(SELECT SUM(CommissionMoeny) as CommissionMoeny,BatchId FROM rb_order_returncomission where OrderSourceType=4 and `Status` in(1,2) GROUP BY OrderSourceType ) as e (SELECT SUM(CommissionMoeny) as CommissionMoeny,BatchId FROM rb_order_returncomission where OrderSourceType=2 and `Status` in(1,2) GROUP BY OrderSourceType,BatchId) as c
on a.Id=e.BatchId "; on a.Id=c.BatchId
sql += " where a.GroupId=@gid"; LEFT JOIN
DynamicParameters parameters = new DynamicParameters(); (SELECT SUM(CommissionMoeny) as CommissionMoeny,BatchId FROM rb_order_returncomission where OrderSourceType=3 and `Status` in(1,2) GROUP BY OrderSourceType,BatchId) as d
parameters.Add("gid", groupId); on a.Id=d.BatchId
LEFT JOIN
(SELECT SUM(CommissionMoeny) as CommissionMoeny,BatchId FROM rb_order_returncomission where OrderSourceType=4 and `Status` in(1,2) GROUP BY OrderSourceType,BatchId) as e
on a.Id=e.BatchId
WHERE 1=1
");
if (groupId > 0)
{
builder.AppendFormat(" AND a.GroupId={0} ", groupId);
}
if (!string.IsNullOrEmpty(month)) if (!string.IsNullOrEmpty(month))
{ {
sql += " and DATE_FORMAT(a.CreateDate,'%Y-%m')=@month"; builder.AppendFormat(" AND DATE_FORMAT(a.CreateDate,'%Y-%m')=DATE_FORMAT('{0}-01','%Y-%m')", month);
parameters.Add("month", month);
} }
if (type != 0) if (type != 0)
{ {
sql += " and a.CommissionType=@type"; builder.AppendFormat(" and a.CommissionType={0} ", type);
parameters.Add("type", type);
} }
builder.Append(" order by a.CreateDate desc ");
sql += " order by a.CreateDate desc"; return GetPage<RB_ReturnMoney_Batch_ViewModel>(pageIndex, pageSize, out count, builder.ToString()).ToList();
return GetPage<RB_ReturnMoney_Batch_ViewModel>(pageIndex, pageSize, out count, sql, parameters).ToList();
} }
/// <summary> /// <summary>
......
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