using YBEE.EQM.Core; namespace YBEE.EQM.Application; /// /// 监测抽样方案管理服务 /// [ApiDescriptionSettings(Name = "exam-sample")] [Route("exam/sample")] public class ExamSampleAppService : IDynamicApiController { private readonly IExamSampleService _examSampleService; public ExamSampleAppService(IExamSampleService examSampleService) { _examSampleService = examSampleService; } /// /// 添加监测抽样方案 /// /// /// public async Task Add(AddExamSampleInput input) { await _examSampleService.Add(input); } /// /// 更新监测抽样方案 /// /// /// public async Task Update(UpdateExamSampleInput input) { await _examSampleService.Update(input); } /// /// 复制抽样方案信息 /// /// /// public async Task Duplicate(BaseId input) { await _examSampleService.Duplicate(input); } /// /// 删除监测抽样方案 /// /// /// public async Task Del(BaseId input) { await _examSampleService.Del(input); } /// /// 保存全抽班级ID列表 /// /// /// public async Task SaveExamSampleAllClasses(SaveExamSampleAllClasses input) { await _examSampleService.SaveExamSampleAllClasses(input); } /// /// 切换全抽班级 /// /// /// public async Task SwitchExamSampleAllClass(SwitchExamSampleAllClassInput input) { await _examSampleService.SwitchExamSampleAllClass(input); } /// /// 选定方案 /// /// /// public async Task SelectSample(BaseId input) { await _examSampleService.SelectSample(input); } /// /// 执行抽样 /// /// 抽样方案ID /// /// public async Task ExecuteSample(BaseId input) { await _examSampleService.ExecuteSample(input); } /// /// 导出抽样方案存档文件 /// /// /// public async Task ExportToArchived(BaseId input) { var (fileName, fileBytes) = await _examSampleService.ExportToArchived(input.Id, false); return new FileContentResult(fileBytes, "application/octet-stream") { FileDownloadName = fileName, }; } /// /// 导出给印刷厂和网阅机构文件 /// /// /// public async Task ExportToPrintshop(BaseId input) { var (fileName, fileBytes) = await _examSampleService.ExportToArchived(input.Id, true); return new FileContentResult(fileBytes, "application/octet-stream") { FileDownloadName = fileName, }; } /// /// 导出给学校 /// /// /// public async Task ExportToOrg(BaseId input) { var (fileName, fileBytes) = await _examSampleService.ExportToOrg(input.Id); return new FileContentResult(fileBytes, "application/octet-stream") { FileDownloadName = fileName, }; } /// /// 导出抽样统计表 /// /// /// public async Task ExportSampleCount(BaseId input) { var (fileName, fileBytes) = await _examSampleService.ExportSampleCount(input.Id); return new FileContentResult(fileBytes, "application/octet-stream") { FileDownloadName = fileName, }; } /// /// 导出学校抽样统计表 /// /// /// public async Task ExportSampleCountToOrg(BaseId input) { var (fileName, fileBytes) = await _examSampleService.ExportSampleCountToOrg(input.Id); return new FileContentResult(fileBytes, "application/octet-stream") { FileDownloadName = fileName, }; } /// /// 根据ID获取抽样方案 /// /// /// public async Task GetById([FromQuery][Required] int id) { return await _examSampleService.GetById(id); } /// /// 根据监测计划ID获取全部抽样方案 /// /// /// public async Task> GetListByExamPlanId([FromQuery][Required] int examPlanId) { return await _examSampleService.GetListByExamPlanId(examPlanId); } /// /// 查询已发布抽样 /// /// 监测发布内容ID /// 抽样数据发布类型 /// public async Task GetByExamDataPublishId([FromQuery][Required] int examDataPublishId, [FromQuery][Required] DataPublishType type) { return await _examSampleService.GetByExamDataPublishId(examDataPublishId, type); } /// /// 获取抽样统计表 /// /// /// public async Task> GetSampleCountListById([FromQuery][Required] int id) { return await _examSampleService.GetSampleCountListById(id); } /// /// 获取学校抽样统计表 /// /// /// public async Task> GetOrgSampleCountListById([FromQuery][Required] int id) { return await _examSampleService.GetOrgSampleCountListById(id); } }