ExamOrgDataReportAppService.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. using YBEE.EQM.Core;
  2. namespace YBEE.EQM.Application;
  3. /// <summary>
  4. /// 监测机构上报类型服务
  5. /// </summary>
  6. [ApiDescriptionSettings(Name = "exam-org-data-report")]
  7. [Route("exam/org/data/report")]
  8. public class ExamOrgDataReportAppService : IDynamicApiController
  9. {
  10. private readonly IExamOrgDataReportService _examOrgDataReportService;
  11. private readonly IResourceFileService _resourceFileService;
  12. public ExamOrgDataReportAppService(IExamOrgDataReportService examOrgDataReportService, IResourceFileService resourceFileService)
  13. {
  14. _examOrgDataReportService = examOrgDataReportService;
  15. _resourceFileService = resourceFileService;
  16. }
  17. /// <summary>
  18. /// 提交上报
  19. /// </summary>
  20. /// <param name="input"></param>
  21. /// <returns></returns>
  22. public async Task Submit(SubmitExamOrgDataReportInput input)
  23. {
  24. await _examOrgDataReportService.Submit(input);
  25. }
  26. /// <summary>
  27. /// 退回机构上报
  28. /// </summary>
  29. /// <param name="input"></param>
  30. /// <returns></returns>
  31. public async Task ReportReject(BaseId input)
  32. {
  33. await _examOrgDataReportService.ReportReject(input);
  34. }
  35. /// <summary>
  36. /// 上传佐证材料
  37. /// </summary>
  38. /// <param name="input"></param>
  39. /// <returns></returns>
  40. [RequestSizeLimit(1024 * 1024 * 20)]
  41. [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)]
  42. public async Task UploadAttachment([FromForm] UploadExamOrgDataReportAttachmentInput input)
  43. {
  44. var rfile = await _resourceFileService.Upload(input);
  45. var addParams = rfile.Adapt<AddExamOrgDataReportAttachmentInput>();
  46. addParams.Type = input.DataReportType;
  47. addParams.ExamPlanId = input.ExamPlanId;
  48. addParams.ExamOrgDataReportId = (int)input.SourceId;
  49. addParams.FileId = rfile.Id;
  50. addParams.ThumbFileId = rfile.ThumbResourceFile?.Id;
  51. await _examOrgDataReportService.AddAttachment(addParams);
  52. }
  53. /// <summary>
  54. /// 删除特殊学生佐证材料
  55. /// </summary>
  56. /// <param name="input"></param>
  57. /// <returns></returns>
  58. public async Task DelAttachment(DeleteExamOrgDataReportAttachmentInput input)
  59. {
  60. await _examOrgDataReportService.DelAttachment(input);
  61. }
  62. /// <summary>
  63. /// 获取监测机构上报类型列表
  64. /// </summary>
  65. /// <param name="examPlanId"></param>
  66. /// <param name="sysOrgId">机构ID</param>
  67. /// <returns></returns>
  68. public async Task<List<ExamOrgDataReportUnionOutput>> GetListByExamPlanId([FromQuery][Required] int examPlanId, short? sysOrgId = null)
  69. {
  70. return await _examOrgDataReportService.GetListByExamPlanId(examPlanId, sysOrgId);
  71. }
  72. /// <summary>
  73. /// 根据监测计划ID和上报类型获取机构上报信息
  74. /// </summary>
  75. /// <param name="type">上报类型</param>
  76. /// <param name="examPlanId">监测计划ID</param>
  77. /// <param name="sysOrgId">机构ID</param>
  78. /// <returns></returns>
  79. public async Task<ExamOrgDataReportUnionOutput> GetByTypeExamPlanId([FromQuery][Required] DataReportType type, [FromQuery][Required] int examPlanId, short? sysOrgId = null)
  80. {
  81. return await _examOrgDataReportService.GetByTypeExamPlanId(type, examPlanId, sysOrgId);
  82. }
  83. /// <summary>
  84. /// 分页查询机构上报类型列表
  85. /// </summary>
  86. /// <param name="input"></param>
  87. /// <returns></returns>
  88. public async Task<PageResult<ExamPlanOrgDataReportOutput>> QueryPageList(ExamOrgDataReportPageInput input)
  89. {
  90. return await _examOrgDataReportService.QueryPageList(input);
  91. }
  92. //[HttpGet]
  93. //[AllowAnonymous]
  94. //public async Task RefreshFileSize()
  95. //{
  96. // await _examOrgDataReportService.RefreshFileSize();
  97. //}
  98. }