using YBEE.EQM.Core;
namespace YBEE.EQM.Application;
///
/// 监测机构上报类型服务
///
[ApiDescriptionSettings(Name = "exam-org-data-report")]
[Route("exam/org/data/report")]
public class ExamOrgDataReportAppService : IDynamicApiController
{
private readonly IExamOrgDataReportService _examOrgDataReportService;
private readonly IResourceFileService _resourceFileService;
public ExamOrgDataReportAppService(IExamOrgDataReportService examOrgDataReportService, IResourceFileService resourceFileService)
{
_examOrgDataReportService = examOrgDataReportService;
_resourceFileService = resourceFileService;
}
///
/// 提交上报
///
///
///
public async Task Submit(SubmitExamOrgDataReportInput input)
{
await _examOrgDataReportService.Submit(input);
}
///
/// 退回机构上报
///
///
///
public async Task ReportReject(BaseId input)
{
await _examOrgDataReportService.ReportReject(input);
}
///
/// 上传佐证材料
///
///
///
[RequestSizeLimit(1024 * 1024 * 20)]
[RequestFormLimits(MultipartBodyLengthLimit = long.MaxValue)]
public async Task UploadAttachment([FromForm] UploadExamOrgDataReportAttachmentInput input)
{
var rfile = await _resourceFileService.Upload(input);
var addParams = rfile.Adapt();
addParams.Type = input.DataReportType;
addParams.ExamPlanId = input.ExamPlanId;
//addParams.SourceId = (int)input.SourceId;
//addParams.FileId = rfile.Id;
//addParams.ThumbFileId = rfile.ThumbResourceFile?.Id;
await _examOrgDataReportService.AddAttachment(addParams);
}
///
/// 删除特殊学生佐证材料
///
///
///
public async Task DelAttachment(DeleteAttachmentInput input)
{
await _examOrgDataReportService.DelAttachment(input);
}
///
/// 获取监测机构上报类型列表
///
///
/// 机构ID
///
public async Task> GetListByExamPlanId([FromQuery][Required] int examPlanId, short? sysOrgId = null)
{
return await _examOrgDataReportService.GetListByExamPlanId(examPlanId, sysOrgId);
}
///
/// 根据监测计划ID和上报类型获取机构上报信息
///
/// 上报类型
/// 监测计划ID
/// 机构ID
///
public async Task GetByTypeExamPlanId([FromQuery][Required] DataReportType type, [FromQuery][Required] int examPlanId, short? sysOrgId = null)
{
return await _examOrgDataReportService.GetByTypeExamPlanId(type, examPlanId, sysOrgId);
}
///
/// 分页查询机构上报类型列表
///
///
///
public async Task> QueryPageList(ExamOrgDataReportPageInput input)
{
return await _examOrgDataReportService.QueryPageList(input);
}
//[HttpGet]
//[AllowAnonymous]
//public async Task RefreshFileSize()
//{
// await _examOrgDataReportService.RefreshFileSize();
//}
}