Commit 09f0e315 authored by 吴春's avatar 吴春

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

parents 841d27d6 292445ad
......@@ -11,6 +11,7 @@ using Edu.Module.Question;
using Edu.Repository.Question;
using Edu.Model.ViewModel.Question;
using System.Text.RegularExpressions;
using Edu.Model.CacheModel;
namespace Edu.Module.Exam
{
......@@ -524,7 +525,6 @@ namespace Edu.Module.Exam
{
// 定义正则表达式用来匹配 img 标签
string str = @"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>";
var extModel = examination_PaperRepository.GetEntity<RB_Examination_Paper_ViewModel>(PaperId);
if (extModel != null && extModel.PaperId > 0)
{
......@@ -532,7 +532,7 @@ namespace Edu.Module.Exam
extModel.GroupList = GetExaminationGroupListModule(new RB_Examination_Group_ViewModel()
{
PaperId = extModel.PaperId
});
})?.OrderBy(qitem => qitem.GSortNum)?.ToList();
var detailsList = GetExaminationDetailsListModule(new RB_Examination_Details_ViewModel()
{
PaperId = extModel.PaperId
......@@ -541,7 +541,7 @@ namespace Edu.Module.Exam
{
foreach (var gItem in extModel.GroupList)
{
gItem.DetailsList = detailsList?.Where(qitem => qitem.QuestionTypeId == gItem.QuestionTypeId)?.ToList() ?? new List<RB_Examination_Details_ViewModel>();
gItem.DetailsList = detailsList?.Where(qitem => qitem.QuestionTypeId == gItem.QuestionTypeId)?.OrderBy(qitem=>qitem.SortNum)?.ToList() ?? new List<RB_Examination_Details_ViewModel>();
if (gItem.DetailsList != null && gItem.DetailsList.Count > 0)
{
gItem.GScore = gItem?.DetailsList?.Sum(qitem => qitem.Score) ?? 0;
......@@ -622,6 +622,7 @@ namespace Edu.Module.Exam
{
flag = examination_DetailsRepository.DeleteOne(new WhereHelper(nameof(RB_Examination_Details_ViewModel.PaperId), PaperId));
}
//删除所有的自己点信息
if (childList != null && childList.Count > 0)
{
foreach (var item in childList)
......@@ -638,9 +639,10 @@ namespace Edu.Module.Exam
/// 根据试卷编号复制试卷
/// </summary>
/// <param name="PaperId"></param>
/// <param name="UserInfo">用户信息</param>
/// <returns></returns>
[TransactionCallHandler]
public bool CopyExamnationPaperModule(int PaperId)
public bool CopyExamnationPaperModule(int PaperId, UserInfo UserInfo)
{
var flag = true;
var model = GetExaminationPaperModule(PaperId);
......@@ -650,6 +652,11 @@ namespace Edu.Module.Exam
return flag;
}
model.PaperId = 0;
model.CreateBy = UserInfo.Id;
model.Group_Id = UserInfo.Group_Id;
model.School_Id = UserInfo.School_Id;
model.CreateTime = DateTime.Now;
if (model.GroupList != null && model.GroupList.Count > 0)
{
foreach (var gItem in model.GroupList)
......@@ -666,7 +673,6 @@ namespace Edu.Module.Exam
}
}
}
var configureModel = new RB_Examination_Configure_ViewModel()
{
Group_Id = model.Group_Id,
......@@ -824,7 +830,7 @@ namespace Edu.Module.Exam
{nameof(RB_Examination_Publish_ViewModel.FillInIsSubject), model.FillInIsSubject },
{nameof(RB_Examination_Publish_ViewModel.FillInIsIgnore), model.FillInIsIgnore },
{nameof(RB_Examination_Publish_ViewModel.IsHalfScore), model.IsHalfScore },
{nameof(RB_Examination_Publish_ViewModel.ExamineStatus), model.ExamineStatus },
{nameof(RB_Examination_Publish_ViewModel.ExamineStatus), model.ExamineStatus },
};
flag = examination_PublishRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Publish_ViewModel.Id), model.Id));
}
......@@ -833,17 +839,17 @@ namespace Edu.Module.Exam
var newId = examination_PublishRepository.Insert(model);
model.Id = newId;
model.IsExamine = 1;
flag = newId > 0;
flag = newId > 0;
examination_PaperRepository.UpdateExaminationPaperPublishCountRepository(model.PaperId);
}
if (flag && obj.IsOpenExamApply == 1 && model.IsExamine == 1)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Examination_Publish_ViewModel.ExamineStatus),Common.Enum.EduTask.EduTaskRrocessStatus.AuditIng },
{nameof(RB_Examination_Publish_ViewModel.Reviewer),obj.ZuJuanReviewer }
};
{
{nameof(RB_Examination_Publish_ViewModel.ExamineStatus),Common.Enum.EduTask.EduTaskRrocessStatus.AuditIng },
{nameof(RB_Examination_Publish_ViewModel.Reviewer),obj.ZuJuanReviewer }
};
flag = examination_PublishRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Publish_ViewModel.Id), model.Id));
var educationReceipt = new Model.Entity.EduTask.RB_Education_Receipt()
{
Id = 0,
......@@ -917,8 +923,6 @@ namespace Edu.Module.Exam
return flag;
}
#region 考试配置
/// <summary>
/// 获取配置列表
......@@ -969,6 +973,7 @@ namespace Edu.Module.Exam
return flag;
}
#endregion
/// <summary>
/// 根据编号获取考试发布详情
/// </summary>
......
......@@ -122,5 +122,17 @@ WHERE 1=1
parameters.Add("QPaperIds", QPaperIds, direction: ParameterDirection.Input);
return Get<RB_Examination_Paper_ViewModel>(procName, parameters, commandType: CommandType.StoredProcedure).ToList();
}
/// <summary>
/// 修改试卷发布次数
/// </summary>
/// <param name="PaperId"></param>
/// <returns></returns>
public int UpdateExaminationPaperPublishCountRepository(int PaperId)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(" UPDATE RB_Examination_Paper SET PublishCount=PublishCount+1 WHERE PaperId={0} ", PaperId);
return base.Execute(builder.ToString());
}
}
}
......@@ -380,7 +380,7 @@ namespace Edu.WebApi.Controllers.Exam
public ApiResult CopyPaper()
{
var PaperId = base.ParmJObj.GetInt("PaperId");
var flag = paperModule.CopyExamnationPaperModule(PaperId);
var flag = paperModule.CopyExamnationPaperModule(PaperId,base.UserInfo);
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