NceeExportAppService.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. namespace YBEE.EQM.Application;
  2. /// <summary>
  3. /// 高中模拟分析导出服务
  4. /// </summary>
  5. [ApiDescriptionSettings(Name = "ncee-export")]
  6. [Route("ncee/export")]
  7. public class NceeExportAppService(INceeExportService nceeExportService) : IDynamicApiController
  8. {
  9. private readonly INceeExportService _nceeExportService = nceeExportService;
  10. /// <summary>
  11. /// 导出联盟区县模拟划线报表
  12. /// </summary>
  13. /// <param name="nceePlanId"></param>
  14. /// <returns></returns>
  15. public async Task<IActionResult> ExportAllianceDistrict([FromQuery][Required] int nceePlanId)
  16. {
  17. var (fileName, fileBytes) = await _nceeExportService.ExportAllianceDistrict(nceePlanId);
  18. return new FileContentResult(fileBytes, "application/octet-stream")
  19. {
  20. FileDownloadName = fileName,
  21. };
  22. }
  23. /// <summary>
  24. /// 导出已选科的模拟划线报表
  25. /// </summary>
  26. /// <param name="input">导出参数</param>
  27. /// <returns></returns>
  28. public async Task<IActionResult> ExportDirectionSeleted(NceeExportInput input)
  29. {
  30. var (fileName, fileBytes) = await _nceeExportService.ExportDirectionSeleted(input);
  31. return new FileContentResult(fileBytes, "application/octet-stream")
  32. {
  33. FileDownloadName = fileName,
  34. };
  35. }
  36. /// <summary>
  37. /// 导出未选科的模拟划线报表
  38. /// </summary>
  39. /// <param name="nceePlanId"></param>
  40. /// <returns></returns>
  41. public async Task<IActionResult> ExportDirectionUnseleted([FromQuery][Required] int nceePlanId)
  42. {
  43. var (fileName, fileBytes) = await _nceeExportService.ExportDirectionUnseleted(nceePlanId);
  44. return new FileContentResult(fileBytes, "application/octet-stream")
  45. {
  46. FileDownloadName = fileName,
  47. };
  48. }
  49. }