diff --git a/IRaCIS.Core.API/Controllers/UploadController.cs b/IRaCIS.Core.API/Controllers/UploadController.cs index c7fe0b43b..319f93ed1 100644 --- a/IRaCIS.Core.API/Controllers/UploadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadController.cs @@ -40,10 +40,10 @@ namespace IRaCIS.Core.API.Controllers _userInfo = userInfo; } - [HttpPost("TrialDocument/UploadTrialDoc/{trialId:guid}/{type}")] + [HttpPost("TrialDocument/UploadTrialDoc/{trialId:guid}")] [DisableRequestSizeLimit] [DisableFormValueModelBinding] - public async Task UploadTrialDoc(Guid trialId,string type) + public async Task UploadTrialDoc(Guid trialId) { var boundary = HeaderUtilities.RemoveQuotes(MediaTypeHeaderValue.Parse(Request.ContentType).Boundary).Value; @@ -58,7 +58,7 @@ namespace IRaCIS.Core.API.Controllers if (hasContentDispositionHeader) { - DealTrialStorePath(trialId, type, contentDisposition.FileName.Value, out string serverFilePath, out string relativePath ); + DealTrialStorePath(trialId, contentDisposition.FileName.Value, out string serverFilePath, out string relativePath ); await WriteFileAsync(section.Body, serverFilePath); @@ -76,10 +76,10 @@ namespace IRaCIS.Core.API.Controllers } - [HttpPost("TrialDocument/UploadSystemDoc/{type}")] + [HttpPost("TrialDocument/UploadSystemDoc")] [DisableRequestSizeLimit] [DisableFormValueModelBinding] - public async Task UploadSysTemDoc( string type) + public async Task UploadSysTemDoc( ) { var boundary = HeaderUtilities.RemoveQuotes(MediaTypeHeaderValue.Parse(Request.ContentType).Boundary).Value; @@ -94,7 +94,7 @@ namespace IRaCIS.Core.API.Controllers if (hasContentDispositionHeader) { - DealSysTemStorePath( type, contentDisposition.FileName.Value, out string serverFilePath, out string relativePath); + DealSysTemStorePath( contentDisposition.FileName.Value, out string serverFilePath, out string relativePath); await WriteFileAsync(section.Body, serverFilePath); @@ -116,10 +116,10 @@ namespace IRaCIS.Core.API.Controllers /// 上传通用文档 比如一致性核查的 比如导出的excel 模板 /// /// - [HttpPost("CommonDocument/UploadCommonDoc/{fileType}/{moduleType}")] + [HttpPost("CommonDocument/UploadCommonDoc")] [DisableRequestSizeLimit] [DisableFormValueModelBinding] - public async Task UploadCommonDoc(string fileType, string moduleType) + public async Task UploadCommonDoc(/*string fileType, string moduleType*/) { var boundary = HeaderUtilities.RemoveQuotes(MediaTypeHeaderValue.Parse(Request.ContentType).Boundary).Value; @@ -134,7 +134,7 @@ namespace IRaCIS.Core.API.Controllers if (hasContentDispositionHeader) { - DealCommonStorePath(fileType, moduleType, contentDisposition.FileName.Value, out string serverFilePath, out string relativePath); + DealCommonStorePath(/*fileType, moduleType,*/ contentDisposition.FileName.Value, out string serverFilePath, out string relativePath); await WriteFileAsync(section.Body, serverFilePath); @@ -194,21 +194,23 @@ namespace IRaCIS.Core.API.Controllers } - private void DealCommonStorePath(string fileType, string moduleType, string fileRealName, out string serverFilePath, out string relativePath) + private void DealCommonStorePath(/*string fileType, string moduleType,*/ string fileRealName, out string serverFilePath, out string relativePath) { var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).FullName; //上传根路径 - var _fileStorePath = Path.Combine(rootPath, StaticData.CommonFileFolder); + var _fileStorePath = Path.Combine(rootPath, StaticData.SystemDataFolder); //文件类型路径处理 - var uploadFolderPath = Path.Combine(_fileStorePath, moduleType, fileType); + var uploadFolderPath = Path.Combine(_fileStorePath, StaticData.DataTemplate); if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath); - var fileNameEX = Path.GetExtension(fileRealName); - var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileNameEX; + //var fileNameEX = Path.GetExtension(fileRealName); + //var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileNameEX; - relativePath = $"/{StaticData.CommonFileFolder}/{moduleType}/{fileType}/{trustedFileNameForFileStorage}"; + var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileRealName; + + relativePath = $"/{StaticData.SystemDataFolder}/{StaticData.DataTemplate}/{trustedFileNameForFileStorage}"; serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage); } @@ -218,59 +220,64 @@ namespace IRaCIS.Core.API.Controllers { var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).FullName; //上传根路径 - var _fileStorePath = Path.Combine(rootPath, StaticData.SystemNoticeFolder); + var _fileStorePath = Path.Combine(rootPath, StaticData.SystemDataFolder); //文件类型路径处理 - var uploadFolderPath = Path.Combine(_fileStorePath); + var uploadFolderPath = Path.Combine(_fileStorePath, StaticData.NoticeAttachment); if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath); - var fileNameEX = Path.GetExtension(fileRealName); + //var fileNameEX = Path.GetExtension(fileRealName); + //var fileName=Path.GetFileName(fileRealName); + //var trustedFileNameForFileStorage = fileName + Guid.NewGuid().ToString() + fileNameEX; - var fileName=Path.GetFileName(fileRealName); - var trustedFileNameForFileStorage = fileName + Guid.NewGuid().ToString() + fileNameEX; + var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileRealName; - relativePath = $"{StaticData.SystemNoticeFolder}/{trustedFileNameForFileStorage}"; + relativePath = $"/{StaticData.SystemDataFolder}/{StaticData.NoticeAttachment}/{trustedFileNameForFileStorage}"; serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage); } - private void DealSysTemStorePath( string type, string fileRealName, out string serverFilePath, out string relativePath) + private void DealSysTemStorePath( string fileRealName, out string serverFilePath, out string relativePath) + { + var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).FullName; + //上传根路径 + var _fileStorePath = Path.Combine(rootPath, StaticData.SystemDataFolder); + + //文件类型路径处理 + var uploadFolderPath = Path.Combine(_fileStorePath, StaticData.SignDocumentFolder); + if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath); + + + //var fileNameEX = Path.GetExtension(fileRealName); + //var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileNameEX; + + var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileRealName; + + relativePath = $"/{StaticData.SystemDataFolder}/{ StaticData.SignDocumentFolder}/{trustedFileNameForFileStorage}"; + + serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage); + } + + + private void DealTrialStorePath(Guid trialId,string fileRealName, out string serverFilePath, out string relativePath) { var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).FullName; //上传根路径 var _fileStorePath = Path.Combine(rootPath, StaticData.TrialDataFolder); //文件类型路径处理 - var uploadFolderPath = Path.Combine(_fileStorePath, "SysTemDocument", type); + var uploadFolderPath = Path.Combine(_fileStorePath, trialId.ToString(), StaticData.SignDocumentFolder); if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath); - var fileNameEX = Path.GetExtension(fileRealName); - var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileNameEX; + //var fileNameEX = Path.GetExtension(fileRealName); + //var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileNameEX; - relativePath = $"/{StaticData.TrialDataFolder}/SysTemDocument/{type}/{trustedFileNameForFileStorage}"; + var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileRealName; - serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage); - } - - - private void DealTrialStorePath(Guid trialId,string type,string fileRealName, out string serverFilePath, out string relativePath) - { - var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).FullName; - //上传根路径 - var _fileStorePath = Path.Combine(rootPath, StaticData.TrialDataFolder); - - //文件类型路径处理 - var uploadFolderPath = Path.Combine(_fileStorePath, trialId.ToString(), type); - if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath); - - - var fileNameEX = Path.GetExtension(fileRealName); - var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileNameEX; - - relativePath = $"/{StaticData.TrialDataFolder}/{trialId}/{type}/{trustedFileNameForFileStorage}"; + relativePath = $"/{StaticData.TrialDataFolder}/{trialId}/{StaticData.SignDocumentFolder}/{trustedFileNameForFileStorage}"; serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage); } diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml index 07a3e2433..b7ff1f0b4 100644 --- a/IRaCIS.Core.API/IRaCIS.Core.API.xml +++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml @@ -387,7 +387,7 @@ - + 上传通用文档 比如一致性核查的 比如导出的excel 模板 diff --git a/IRaCIS.Core.API/_PipelineExtensions/IRacisHostFileStoreConfig.cs b/IRaCIS.Core.API/_PipelineExtensions/IRacisHostFileStoreConfig.cs index 6f5f81935..06133e9f9 100644 --- a/IRaCIS.Core.API/_PipelineExtensions/IRacisHostFileStoreConfig.cs +++ b/IRaCIS.Core.API/_PipelineExtensions/IRacisHostFileStoreConfig.cs @@ -15,11 +15,9 @@ namespace IRaCIS.Core.API var uploadPath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.UploadFileFolder); var dicomPath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.TrialDataFolder); - var comonPathPath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.CommonFileFolder); - - var systemNoticePath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.SystemNoticeFolder); - + var systemDataFolder = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.SystemDataFolder); + if (!Directory.Exists(uploadPath)) { Directory.CreateDirectory(uploadPath); @@ -30,17 +28,11 @@ namespace IRaCIS.Core.API Directory.CreateDirectory(dicomPath); } - if (!Directory.Exists(systemNoticePath)) + if (!Directory.Exists(systemDataFolder)) { - Directory.CreateDirectory(systemNoticePath); + Directory.CreateDirectory(systemDataFolder); } - - - if (!Directory.Exists(comonPathPath)) - { - Directory.CreateDirectory(comonPathPath); - } - + app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(uploadPath), @@ -56,16 +48,32 @@ namespace IRaCIS.Core.API app.UseStaticFiles(new StaticFileOptions { - FileProvider = new PhysicalFileProvider(systemNoticePath), - RequestPath = $"/{StaticData.SystemNoticeFolder}" + FileProvider = new PhysicalFileProvider(systemDataFolder), + RequestPath = $"/{StaticData.SystemDataFolder}" }); - app.UseStaticFiles(new StaticFileOptions - { - FileProvider = new PhysicalFileProvider(comonPathPath), - RequestPath = $"/{StaticData.CommonFileFolder}" - }); + #region 兼容之前的文档能查看 + + //var comonPathPath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.CommonFileFolder); + + //var systemNoticePath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.SystemNoticeFolder); + + //if (!Directory.Exists(comonPathPath)) + //{ + // Directory.CreateDirectory(comonPathPath); + //} + //app.UseStaticFiles(new StaticFileOptions + //{ + // FileProvider = new PhysicalFileProvider(comonPathPath), + // RequestPath = $"/{StaticData.CommonFileFolder}" + //}); + + #endregion + + + + } } } diff --git a/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs b/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs index ffce75e54..f165537c4 100644 --- a/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs +++ b/IRaCIS.Core.Application/Service/QC/NoneDicomStudyService.cs @@ -4,7 +4,6 @@ // 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 //-------------------------------------------------------------------- using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using IRaCIS.Core.Domain.Share; using SharpCompress.Archives; @@ -14,7 +13,6 @@ using IRaCIS.Core.Application.Service.Inspection.Interface; using IRaCIS.Core.Application.Service.Inspection.DTO; using Nito.AsyncEx; using IRaCIS.Application.Interfaces; -using IRaCIS.Core.Domain.Common; using IRaCIS.Core.Infrastructure; namespace IRaCIS.Core.Application.Contracts diff --git a/IRaCIS.Core.Domain.Share/_StaticData.cs b/IRaCIS.Core.Domain.Share/_StaticData.cs index 4b1400cb1..f7fac6678 100644 --- a/IRaCIS.Core.Domain.Share/_StaticData.cs +++ b/IRaCIS.Core.Domain.Share/_StaticData.cs @@ -23,10 +23,25 @@ public static readonly string TrialDataFolder = "TrialData"; + public static readonly string SystemDataFolder = "SystemData"; + + + public static readonly string SignDocumentFolder = "SignDocument"; + + public static readonly string DataTemplate = "DataTemplate"; + + public static readonly string NoticeAttachment = "NoticeAttachment"; + + public static readonly string UploadEDCData = "UploadEDCData"; + + + public static readonly string DicomFolder = "Dicom"; public static readonly string NoneDicomFolder = "NoneDicom"; public static readonly string UploadFileFolder = "UploadFile"; public static readonly string TreatmenthistoryFolder = "Treatmenthistory"; + + public static readonly string CommonFileFolder = "CommonFileFolder"; public static readonly string SystemNoticeFolder = "SystemNoticeFolder";