Commit fbd802d6 authored by 吴春's avatar 吴春

提交代码

parent a7752df6
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Common.Enum;
using VT.FW.DB;
namespace Edu.Model.Entity.Exam
{
/// <summary>
/// 试卷考试配置
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Examination_Configure
{
/// <summary>
/// 试卷考试配置编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 是否开启组卷审批 0-否,1-是
/// </summary>
public int IsOpenZuJuan { get; set; }
/// <summary>
/// 组卷审核人
/// </summary>
public int ZuJuanReviewer { get; set; }
/// <summary>
/// 是否开启考试申请 0-否,1-是
/// </summary>
public int IsOpenExamApply { get; set; }
/// <summary>
/// 考试申请审核人
/// </summary>
public int ExamApplyReviewer { get; set; }
/// <summary>
/// 是否开启自动阅卷 0-否,1-是
/// </summary>
public int IsOpenAutoMarking { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Edu.Model.Entity.Exam;
namespace Edu.Model.ViewModel.Exam
{
/// <summary>
/// 考试配置扩展表
/// </summary>
public class RB_Examination_Configure_ViewModel : RB_Examination_Configure
{
}
}
......@@ -53,6 +53,11 @@ namespace Edu.Module.Exam
/// </summary>
private readonly RB_Examination_PublishRepository examination_PublishRepository = new RB_Examination_PublishRepository();
/// <summary>
/// 考试配置仓储层对象
/// </summary>
private readonly RB_Examination_ConfigureRepository examination_ConfigureRepository = new RB_Examination_ConfigureRepository();
/// <summary>
/// 获取试卷分页列表
/// </summary>
......@@ -521,7 +526,7 @@ namespace Edu.Module.Exam
/// <param name="GId"></param>
/// <param name="QuestionTypeId">问题类型编号</param>
/// <returns></returns>
[TransactionCallHandler]
[TransactionCallHandler]
public bool RemoveExamnationGroupModule(int GId, int QuestionTypeId)
{
var flag = true;
......@@ -622,7 +627,7 @@ namespace Edu.Module.Exam
{
List<ExamFolderTreeModel> list = new List<ExamFolderTreeModel>();
var dataList = examination_PaperRepository.GetExaminationPaperListRepository(query);
if (dataList != null&&dataList.Count>0)
if (dataList != null && dataList.Count > 0)
{
var rootList = dataList?.Where(qitem => qitem.ParentId == 0)?.ToList();
foreach (var rItem in rootList)
......@@ -728,5 +733,58 @@ namespace Edu.Module.Exam
}
return flag;
}
#region 考试配置
/// <summary>
/// 获取配置列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Examination_Configure_ViewModel> GetExaminationConfigureListRepository(RB_Examination_Configure_ViewModel query)
{
return examination_ConfigureRepository.GetExaminationConfigureListRepository(query);
}
/// <summary>
/// 获取考试配置实体
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public RB_Examination_Configure_ViewModel GetExaminationConfigureModel(RB_Examination_Configure_ViewModel query)
{
return examination_ConfigureRepository.GetExaminationConfigureListRepository(query).FirstOrDefault();
}
/// <summary>
/// 新增考试配置
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetExaminationConfigure(RB_Examination_Configure_ViewModel model)
{
bool flag = false;
if (model.Id == 0)
{
flag = examination_ConfigureRepository.Insert(model) > 0;
}
else
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Examination_Configure_ViewModel.IsOpenAutoMarking), model.IsOpenAutoMarking },
{nameof(RB_Examination_Configure_ViewModel.IsOpenExamApply), model.IsOpenExamApply },
{nameof(RB_Examination_Configure_ViewModel.IsOpenZuJuan), model.IsOpenZuJuan },
{nameof(RB_Examination_Configure_ViewModel.ZuJuanReviewer), model.ZuJuanReviewer },
{nameof(RB_Examination_Configure_ViewModel.ExamApplyReviewer), model.ExamApplyReviewer }
};
flag = examination_ConfigureRepository.Update(fileds, new WhereHelper(nameof(RB_Examination_Configure_ViewModel.Id), model.Id));
}
return flag;
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Edu.Model.Entity.Exam;
using Edu.Model.ViewModel.Exam;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Exam
{
/// <summary>
/// 考试配置仓储类
/// </summary>
public class RB_Examination_ConfigureRepository : BaseRepository<RB_Examination_Configure>
{
/// <summary>
/// 获取配置列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Examination_Configure_ViewModel> GetExaminationConfigureListRepository(RB_Examination_Configure_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Examination_Configure AS A
WHERE 1=1
");
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Examination_Configure_ViewModel.Status), 0);
if (query != null)
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Examination_Configure_ViewModel.Group_Id), query.Group_Id);
}
}
return Get<RB_Examination_Configure_ViewModel>(builder.ToString(), parameters).ToList();
}
}
}
......@@ -277,7 +277,7 @@ namespace Edu.WebApi.Controllers.Exam
bool flag = paperModule.SetExaminationPaperFolderModule(extModel);
return flag ? ApiResult.Success(data: extModel) : ApiResult.Failed();
}
/// <summary>
/// 根据编号获取试卷信息
......@@ -366,7 +366,7 @@ namespace Edu.WebApi.Controllers.Exam
CreateBy = UserInfo.Id,
Group_Id = base.UserInfo.Group_Id,
ParentId = base.ParmJObj.GetInt("ParentId"),
IsQueryFolder=1,
IsQueryFolder = 1,
};
var obj = paperModule.GetFolderTreeModule(extModel);
return ApiResult.Success(data: obj);
......@@ -435,5 +435,69 @@ namespace Edu.WebApi.Controllers.Exam
pageModel.PageData = result;
return ApiResult.Success(data: pageModel);
}
#region 考试配置
/// <summary>
/// 考试配置实体
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetExaminationConfigureModel()
{
var extModel = new RB_Examination_Configure_ViewModel()
{
Group_Id = base.UserInfo.Group_Id,
};
var obj = paperModule.GetExaminationConfigureModel(extModel);
if (obj == null || obj.Id == 0)
{
obj = new RB_Examination_Configure_ViewModel();
}
var result = new {
obj.IsOpenZuJuan,
obj.IsOpenAutoMarking,
obj.IsOpenExamApply,
obj.ZuJuanReviewer,
obj.ExamApplyReviewer,
};
return ApiResult.Success(data: result);
}
/// <summary>
/// 新增修改考试配置实体
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetExaminationConfigure()
{
var extModel = new RB_Examination_Configure_ViewModel()
{
IsOpenZuJuan = base.ParmJObj.GetInt("IsOpenZuJuan"),
IsOpenAutoMarking = base.ParmJObj.GetInt("IsOpenAutoMarking"),
IsOpenExamApply = base.ParmJObj.GetInt("IsOpenExamApply"),
ZuJuanReviewer = base.ParmJObj.GetInt("ZuJuanReviewer"),
CreateBy = UserInfo.Id,
CreateTime = DateTime.Now,
Group_Id = base.UserInfo.Group_Id,
ExamApplyReviewer = base.ParmJObj.GetInt("ExamApplyReviewer")
};
if (extModel.IsOpenZuJuan == 1 && extModel.ZuJuanReviewer == 0)
{
return ApiResult.Failed("请选择试卷组卷审批主管");
}
if (extModel.IsOpenExamApply == 1 && extModel.ExamApplyReviewer == 0)
{
return ApiResult.Failed("请选择试卷申请审批主管");
}
var obj = paperModule.GetExaminationConfigureModel(extModel);
if (obj != null && obj.Id > 0)
{
extModel.Id = obj.Id;
}
bool flag = paperModule.SetExaminationConfigure(extModel);
return flag ? ApiResult.Success(data: extModel) : ApiResult.Failed();
}
#endregion
}
}
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