NceeExportAppService.cs 1.9 KB

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