ExamDataReportAppService.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using YBEE.EQM.Core;
  2. namespace YBEE.EQM.Application;
  3. /// <summary>
  4. /// 监测数据上报类型管理服务
  5. /// </summary>
  6. [ApiDescriptionSettings(Name = "exam-data-report")]
  7. [Route("exam/data/report")]
  8. public class ExamDataReportAppService : IDynamicApiController
  9. {
  10. private readonly IExamDataReportService _examDataReportService;
  11. private readonly IResourceFileService _resourceFileService;
  12. public ExamDataReportAppService(IExamDataReportService examDataReportService, IResourceFileService resourceFileService)
  13. {
  14. _examDataReportService = examDataReportService;
  15. _resourceFileService = resourceFileService;
  16. }
  17. #region 创建更新
  18. /// <summary>
  19. /// 添加上报类型
  20. /// </summary>
  21. /// <param name="input"></param>
  22. /// <returns></returns>
  23. public async Task Add(AddExamDataReportInput input)
  24. {
  25. await _examDataReportService.Add(input);
  26. }
  27. /// <summary>
  28. /// 更新上报类型
  29. /// </summary>
  30. /// <param name="input"></param>
  31. /// <returns></returns>
  32. public async Task Update(UpdateExamDataReportInput input)
  33. {
  34. await _examDataReportService.Update(input);
  35. }
  36. /// <summary>
  37. /// 删除上报类型
  38. /// </summary>
  39. /// <param name="input"></param>
  40. /// <returns></returns>
  41. public async Task Del(BaseId input)
  42. {
  43. await _examDataReportService.Del(input);
  44. }
  45. /// <summary>
  46. /// 上传附件
  47. /// </summary>
  48. /// <param name="input"></param>
  49. /// <returns></returns>
  50. [RequestSizeLimit(1024 * 1024 * 1024)]
  51. [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)]
  52. public async Task UploadAttachment([FromForm] UploadResourceFileInput input)
  53. {
  54. var rfile = await _resourceFileService.Upload(input);
  55. var addParams = rfile.Adapt<AddAttachmentInput>();
  56. await _examDataReportService.AddAttachment(addParams);
  57. }
  58. /// <summary>
  59. /// 删除附件
  60. /// </summary>
  61. /// <param name="input"></param>
  62. /// <returns></returns>
  63. public async Task DelAttachment(DeleteAttachmentInput input)
  64. {
  65. await _examDataReportService.DelAttachment(input);
  66. }
  67. #endregion
  68. #region 状态处理
  69. /// <summary>
  70. /// 开始
  71. /// </summary>
  72. /// <param name="input"></param>
  73. /// <returns></returns>
  74. public async Task Start(BaseId input)
  75. {
  76. await _examDataReportService.Start(input);
  77. }
  78. /// <summary>
  79. /// 结束
  80. /// </summary>
  81. /// <param name="input"></param>
  82. /// <returns></returns>
  83. public async Task Stop(BaseId input)
  84. {
  85. await _examDataReportService.Stop(input);
  86. }
  87. /// <summary>
  88. /// 取消
  89. /// </summary>
  90. /// <param name="input"></param>
  91. /// <returns></returns>
  92. public async Task Cancel(BaseId input)
  93. {
  94. await _examDataReportService.Cancel(input);
  95. }
  96. #endregion
  97. #region 查询
  98. /// <summary>
  99. /// 根据ID获取监测数据上报类型
  100. /// </summary>
  101. /// <param name="id"></param>
  102. /// <returns></returns>
  103. public async Task<ExamDataReportOutput> GetById([FromQuery][Required] int id)
  104. {
  105. return await _examDataReportService.GetById(id);
  106. }
  107. /// <summary>
  108. /// 根据监测计划ID获取数据上报类型列表
  109. /// </summary>
  110. /// <param name="examPlanId"></param>
  111. /// <returns></returns>
  112. public async Task<List<ExamDataReportOutput>> GetListByExamPlanId([FromQuery][Required] int examPlanId)
  113. {
  114. return await _examDataReportService.GetListByExamPlanId(examPlanId);
  115. }
  116. #endregion
  117. }