修改上传存储路径
parent
7777a2c791
commit
895d024bc6
|
@ -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<IResponseOutput> UploadTrialDoc(Guid trialId,string type)
|
||||
public async Task<IResponseOutput> 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<IResponseOutput> UploadSysTemDoc( string type)
|
||||
public async Task<IResponseOutput> 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 模板
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("CommonDocument/UploadCommonDoc/{fileType}/{moduleType}")]
|
||||
[HttpPost("CommonDocument/UploadCommonDoc")]
|
||||
[DisableRequestSizeLimit]
|
||||
[DisableFormValueModelBinding]
|
||||
public async Task<IResponseOutput> UploadCommonDoc(string fileType, string moduleType)
|
||||
public async Task<IResponseOutput> 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);
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@
|
|||
<param name="opt"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.UploadController.UploadCommonDoc(System.String,System.String)">
|
||||
<member name="M:IRaCIS.Core.API.Controllers.UploadController.UploadCommonDoc">
|
||||
<summary>
|
||||
上传通用文档 比如一致性核查的 比如导出的excel 模板
|
||||
</summary>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
Loading…
Reference in New Issue