using YBEE.EQM.Core; namespace YBEE.EQM.Application; /// /// 监测数据上报类型管理服务 /// [ApiDescriptionSettings(Name = "exam-data-report")] [Route("exam/data/report")] public class ExamDataReportAppService : IDynamicApiController { private readonly IExamDataReportService _examDataReportService; private readonly IResourceFileService _resourceFileService; public ExamDataReportAppService(IExamDataReportService examDataReportService, IResourceFileService resourceFileService) { _examDataReportService = examDataReportService; _resourceFileService = resourceFileService; } #region 创建更新 /// /// 添加上报类型 /// /// /// public async Task Add(AddExamDataReportInput input) { await _examDataReportService.Add(input); } /// /// 更新上报类型 /// /// /// public async Task Update(UpdateExamDataReportInput input) { await _examDataReportService.Update(input); } /// /// 删除上报类型 /// /// /// public async Task Del(BaseId input) { await _examDataReportService.Del(input); } /// /// 上传附件 /// /// /// [RequestSizeLimit(1024 * 1024 * 1024)] [RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)] public async Task UploadAttachment([FromForm] UploadResourceFileInput input) { var rfile = await _resourceFileService.Upload(input); var addParams = rfile.Adapt(); await _examDataReportService.AddAttachment(addParams); } /// /// 删除附件 /// /// /// public async Task DelAttachment(DeleteAttachmentInput input) { await _examDataReportService.DelAttachment(input); } #endregion #region 状态处理 /// /// 开始 /// /// /// public async Task Start(BaseId input) { await _examDataReportService.Start(input); } /// /// 结束 /// /// /// public async Task Stop(BaseId input) { await _examDataReportService.Stop(input); } /// /// 取消 /// /// /// public async Task Cancel(BaseId input) { await _examDataReportService.Cancel(input); } #endregion #region 查询 /// /// 根据ID获取监测数据上报类型 /// /// /// public async Task GetById([FromQuery][Required] int id) { return await _examDataReportService.GetById(id); } /// /// 根据监测计划ID获取数据上报类型列表 /// /// /// public async Task> GetListByExamPlanId([FromQuery][Required] int examPlanId) { return await _examDataReportService.GetListByExamPlanId(examPlanId); } #endregion }