using YBEE.EQM.Core; namespace YBEE.EQM.Application; /// /// 监测学生管理服务 /// [ApiDescriptionSettings(Name = "exam-student")] [Route("exam/student")] public class ExamStudentAppService : IDynamicApiController { private readonly IExamStudentService _examStudentService; public ExamStudentAppService(IExamStudentService examStudentService) { _examStudentService = examStudentService; } #region 批量导入 /// /// 上传批量导入文件 /// /// /// [RequestSizeLimit(long.MaxValue)] [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)] public async Task> Upload([FromForm] UploadExamDataInput input) { string fileExt = Path.GetExtension(input.File.FileName).ToLower(); if (fileExt != ".xls" && fileExt != ".xlsx") { throw Oops.Oh(ErrorCode.E1010); } string filePath = Path.Combine(FileUtil.GetTempFileRoot(), $"{Guid.NewGuid()}{fileExt}"); using FileStream fs = File.Create(filePath); await input.File.CopyToAsync(fs); await fs.FlushAsync(); fs.Close(); var ret = await _examStudentService.Upload(filePath, input.ExamPlanId); return ret; } /// /// 批量导入监测学生 /// /// /// public async Task Import(ImportExamStudentInput input) { await _examStudentService.Import(input); } #endregion #region 创建更新删除 /// /// 添加监测学生 /// /// /// public async Task Add(AddExamStudentInput input) { await _examStudentService.Add(input); } /// /// 更新监测学生 /// /// /// public async Task Update(UpdateExamStudentInput input) { await _examStudentService.Update(input); } /// /// 删除监测学生 /// /// /// public async Task Del(BaseId input) { await _examStudentService.Del(input); } /// /// 清空监测学生 /// /// /// public async Task Clear(ClearExamStudentInput input) { await _examStudentService.Clear(input); } #endregion #region 查询 /// /// 分页查询监测学生列表 /// /// /// public async Task> QueryPageList(ExamStudentPageInput input) { return await _examStudentService.QueryPageList(input); } /// /// 获取机构班级上报人数统计列表 /// /// /// public async Task GetOrgGradeClassStudentCount([FromQuery][Required] int examPlanId) { return await _examStudentService.GetOrgGradeClassStudentCount(examPlanId); } #endregion }