Commit f15ac8eb authored by 黄奎's avatar 黄奎

页面修改

parent bb8e1068
...@@ -771,34 +771,37 @@ namespace Edu.Module.Exam ...@@ -771,34 +771,37 @@ namespace Edu.Module.Exam
/// <summary> /// <summary>
/// 根据试卷编号删除试卷 /// 根据试卷编号删除试卷
/// </summary> /// </summary>
/// <param name="PaperId"></param> /// <param name="PaperIds"></param>
/// <returns></returns> /// <returns></returns>
[TransactionCallHandler] [TransactionCallHandler]
public bool RemoveExamnationPaperModule(int PaperId) public bool RemoveExamnationPaperModule(List<int> PaperIds)
{ {
var flag = true; var flag = true;
var model = GetExaminationPaperModule(PaperId); foreach (var PaperId in PaperIds)
var childList = examination_PaperRepository.GetExaminationPaperChildRepository(PaperId.ToString());
if (PaperId > 0)
{
flag = examination_PaperRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Paper_ViewModel.PaperId), PaperId));
}
if (flag && model.GroupList != null && model.GroupList.Count > 0)
{
flag = examination_GroupRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Group_ViewModel.PaperId), PaperId));
}
if (flag && model.GroupList != null && model.GroupList.Count > 0 && model.GroupList[0].DetailsList != null && model.GroupList[0].DetailsList.Count > 0)
{
flag = examination_DetailsRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Details_ViewModel.PaperId), PaperId));
}
//删除所有的自己点信息
if (childList != null && childList.Count > 0)
{ {
foreach (var item in childList) var model = GetExaminationPaperModule(PaperId);
var childList = examination_PaperRepository.GetExaminationPaperChildRepository(PaperId.ToString());
if (PaperId > 0)
{
flag = examination_PaperRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Paper_ViewModel.PaperId), PaperId));
}
if (flag && model.GroupList != null && model.GroupList.Count > 0)
{ {
examination_PaperRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Paper_ViewModel.PaperId), item.PaperId)); flag = examination_GroupRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Group_ViewModel.PaperId), PaperId));
examination_GroupRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Group_ViewModel.PaperId), item.PaperId)); }
examination_DetailsRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Details_ViewModel.PaperId), item.PaperId)); if (flag && model.GroupList != null && model.GroupList.Count > 0 && model.GroupList[0].DetailsList != null && model.GroupList[0].DetailsList.Count > 0)
{
flag = examination_DetailsRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Details_ViewModel.PaperId), PaperId));
}
//删除所有的子节点信息
if (childList != null && childList.Count > 0)
{
foreach (var item in childList)
{
examination_PaperRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Paper_ViewModel.PaperId), item.PaperId));
examination_GroupRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Group_ViewModel.PaperId), item.PaperId));
examination_DetailsRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Details_ViewModel.PaperId), item.PaperId));
}
} }
} }
return flag; return flag;
...@@ -864,17 +867,13 @@ namespace Edu.Module.Exam ...@@ -864,17 +867,13 @@ namespace Edu.Module.Exam
/// <summary> /// <summary>
/// 移动试卷 /// 移动试卷
/// </summary> /// </summary>
/// <param name="PaperId">试卷编号</param>
/// <param name="ParentId">父节点编号</param> /// <param name="ParentId">父节点编号</param>
/// <param name="PaperIds">试卷编号</param>
/// <returns></returns> /// <returns></returns>
public bool MoveExamnationPaperModule(int PaperId, int ParentId) public bool MoveExamnationPaperModule(int ParentId,List<int> PaperIds)
{ {
var flag = true; var flag = true;
Dictionary<string, object> fileds = new Dictionary<string, object>() flag = examination_PaperRepository.BatchMovePaperRepository(ParentId, PaperIds) > 0;
{
{nameof(RB_Examination_Paper_ViewModel.ParentId),ParentId}
};
flag = examination_PaperRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Paper_ViewModel.PaperId), PaperId));
return flag; return flag;
} }
......
...@@ -168,5 +168,18 @@ WHERE 1=1 ...@@ -168,5 +168,18 @@ WHERE 1=1
builder.AppendFormat(" UPDATE RB_Examination_Paper SET IsOpen={0} WHERE PaperId IN({1}) ", IsOpen,string.Join(",",paperIds)); builder.AppendFormat(" UPDATE RB_Examination_Paper SET IsOpen={0} WHERE PaperId IN({1}) ", IsOpen,string.Join(",",paperIds));
return base.Execute(builder.ToString()); return base.Execute(builder.ToString());
} }
/// <summary>
/// 批量移动文件夹
/// </summary>
/// <param name="ParentId"></param>
/// <param name="paperIds"></param>
/// <returns></returns>
public int BatchMovePaperRepository(int ParentId, List<int> paperIds)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(" UPDATE RB_Examination_Paper SET ParentId={0} WHERE PaperId IN({1}) ", ParentId, string.Join(",", paperIds));
return base.Execute(builder.ToString());
}
} }
} }
...@@ -7,6 +7,7 @@ using Edu.Common.Plugin; ...@@ -7,6 +7,7 @@ using Edu.Common.Plugin;
using Edu.Model.ViewModel.Exam; using Edu.Model.ViewModel.Exam;
using Edu.Model.ViewModel.Flow; using Edu.Model.ViewModel.Flow;
using Edu.Module.Exam; using Edu.Module.Exam;
using Edu.Module.Question;
using Edu.Module.System; using Edu.Module.System;
using Edu.WebApi.Filter; using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
...@@ -37,6 +38,11 @@ namespace Edu.WebApi.Controllers.Exam ...@@ -37,6 +38,11 @@ namespace Edu.WebApi.Controllers.Exam
/// </summary> /// </summary>
private readonly BasicFlowModule basicFlowModule = AOP.AOPHelper.CreateAOPObject<BasicFlowModule>(); private readonly BasicFlowModule basicFlowModule = AOP.AOPHelper.CreateAOPObject<BasicFlowModule>();
/// <summary>
/// 问题验证处理类
/// </summary>
private readonly AnalysisQuestionTypeModule analysisQuestion = new AnalysisQuestionTypeModule();
/// <summary> /// <summary>
/// 获取试卷分页列表 /// 获取试卷分页列表
/// </summary> /// </summary>
...@@ -177,6 +183,18 @@ namespace Edu.WebApi.Controllers.Exam ...@@ -177,6 +183,18 @@ namespace Edu.WebApi.Controllers.Exam
Score = sObj.GetDecimal("Score"), Score = sObj.GetDecimal("Score"),
}; };
dSortNum++; dSortNum++;
string msg= analysisQuestion.CheckQuestion(detailModel.QuestionTypeKey, detailModel.QuestionContent, detailModel.Answer, out string newAnswer);
if (!string.IsNullOrEmpty(msg))
{
return ApiResult.Failed(message: msg);
}
else
{
if (!string.IsNullOrEmpty(newAnswer))
{
detailModel.Answer = newAnswer;
}
}
gModel.DetailsList.Add(detailModel); gModel.DetailsList.Add(detailModel);
} }
} }
...@@ -392,7 +410,17 @@ namespace Edu.WebApi.Controllers.Exam ...@@ -392,7 +410,17 @@ namespace Edu.WebApi.Controllers.Exam
public ApiResult DeletePaper() public ApiResult DeletePaper()
{ {
var PaperId = base.ParmJObj.GetInt("PaperId"); var PaperId = base.ParmJObj.GetInt("PaperId");
var flag = paperModule.RemoveExamnationPaperModule(PaperId); List<int> PaperIds = new List<int>();
if (PaperId > 0)
{
PaperIds.Add(PaperId);
}
var tempList= Common.Plugin.JsonHelper.DeserializeObject<List<int>>(base.ParmJObj.GetStringValue("PaperIds"));
if (tempList != null && tempList.Count > 0)
{
PaperIds.AddRange(tempList);
}
var flag = paperModule.RemoveExamnationPaperModule(PaperIds);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
...@@ -415,9 +443,9 @@ namespace Edu.WebApi.Controllers.Exam ...@@ -415,9 +443,9 @@ namespace Edu.WebApi.Controllers.Exam
[HttpPost] [HttpPost]
public ApiResult MovePaper() public ApiResult MovePaper()
{ {
var PaperId = base.ParmJObj.GetInt("PaperId"); var PaperIds = Common.Plugin.JsonHelper.DeserializeObject<List<int>>(base.ParmJObj.GetStringValue("PaperIds"));
var ParentId = base.ParmJObj.GetInt("ParentId"); var ParentId = base.ParmJObj.GetInt("ParentId");
var flag = paperModule.MoveExamnationPaperModule(PaperId, ParentId); var flag = paperModule.MoveExamnationPaperModule(ParentId, PaperIds);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
......
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