修改上传存储路径
parent
7777a2c791
commit
895d024bc6
|
@ -40,10 +40,10 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
_userInfo = userInfo;
|
_userInfo = userInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost("TrialDocument/UploadTrialDoc/{trialId:guid}/{type}")]
|
[HttpPost("TrialDocument/UploadTrialDoc/{trialId:guid}")]
|
||||||
[DisableRequestSizeLimit]
|
[DisableRequestSizeLimit]
|
||||||
[DisableFormValueModelBinding]
|
[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;
|
var boundary = HeaderUtilities.RemoveQuotes(MediaTypeHeaderValue.Parse(Request.ContentType).Boundary).Value;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
if (hasContentDispositionHeader)
|
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);
|
await WriteFileAsync(section.Body, serverFilePath);
|
||||||
|
|
||||||
|
@ -76,10 +76,10 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[HttpPost("TrialDocument/UploadSystemDoc/{type}")]
|
[HttpPost("TrialDocument/UploadSystemDoc")]
|
||||||
[DisableRequestSizeLimit]
|
[DisableRequestSizeLimit]
|
||||||
[DisableFormValueModelBinding]
|
[DisableFormValueModelBinding]
|
||||||
public async Task<IResponseOutput> UploadSysTemDoc( string type)
|
public async Task<IResponseOutput> UploadSysTemDoc( )
|
||||||
{
|
{
|
||||||
var boundary = HeaderUtilities.RemoveQuotes(MediaTypeHeaderValue.Parse(Request.ContentType).Boundary).Value;
|
var boundary = HeaderUtilities.RemoveQuotes(MediaTypeHeaderValue.Parse(Request.ContentType).Boundary).Value;
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
if (hasContentDispositionHeader)
|
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);
|
await WriteFileAsync(section.Body, serverFilePath);
|
||||||
|
|
||||||
|
@ -116,10 +116,10 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
/// 上传通用文档 比如一致性核查的 比如导出的excel 模板
|
/// 上传通用文档 比如一致性核查的 比如导出的excel 模板
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("CommonDocument/UploadCommonDoc/{fileType}/{moduleType}")]
|
[HttpPost("CommonDocument/UploadCommonDoc")]
|
||||||
[DisableRequestSizeLimit]
|
[DisableRequestSizeLimit]
|
||||||
[DisableFormValueModelBinding]
|
[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;
|
var boundary = HeaderUtilities.RemoveQuotes(MediaTypeHeaderValue.Parse(Request.ContentType).Boundary).Value;
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
if (hasContentDispositionHeader)
|
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);
|
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 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);
|
if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath);
|
||||||
|
|
||||||
|
|
||||||
var fileNameEX = Path.GetExtension(fileRealName);
|
//var fileNameEX = Path.GetExtension(fileRealName);
|
||||||
var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileNameEX;
|
//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);
|
serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage);
|
||||||
}
|
}
|
||||||
|
@ -218,59 +220,64 @@ namespace IRaCIS.Core.API.Controllers
|
||||||
{
|
{
|
||||||
var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).FullName;
|
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);
|
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 = Guid.NewGuid().ToString() + fileRealName;
|
||||||
var trustedFileNameForFileStorage = fileName + Guid.NewGuid().ToString() + fileNameEX;
|
|
||||||
|
|
||||||
relativePath = $"{StaticData.SystemNoticeFolder}/{trustedFileNameForFileStorage}";
|
relativePath = $"/{StaticData.SystemDataFolder}/{StaticData.NoticeAttachment}/{trustedFileNameForFileStorage}";
|
||||||
|
|
||||||
serverFilePath = Path.Combine(uploadFolderPath, 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 rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).FullName;
|
||||||
//上传根路径
|
//上传根路径
|
||||||
var _fileStorePath = Path.Combine(rootPath, StaticData.TrialDataFolder);
|
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);
|
if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath);
|
||||||
|
|
||||||
|
|
||||||
var fileNameEX = Path.GetExtension(fileRealName);
|
//var fileNameEX = Path.GetExtension(fileRealName);
|
||||||
var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileNameEX;
|
//var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileNameEX;
|
||||||
|
|
||||||
relativePath = $"/{StaticData.TrialDataFolder}/SysTemDocument/{type}/{trustedFileNameForFileStorage}";
|
var trustedFileNameForFileStorage = Guid.NewGuid().ToString() + fileRealName;
|
||||||
|
|
||||||
serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage);
|
relativePath = $"/{StaticData.TrialDataFolder}/{trialId}/{StaticData.SignDocumentFolder}/{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}";
|
|
||||||
|
|
||||||
serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage);
|
serverFilePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,7 +387,7 @@
|
||||||
<param name="opt"></param>
|
<param name="opt"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.API.Controllers.UploadController.UploadCommonDoc(System.String,System.String)">
|
<member name="M:IRaCIS.Core.API.Controllers.UploadController.UploadCommonDoc">
|
||||||
<summary>
|
<summary>
|
||||||
上传通用文档 比如一致性核查的 比如导出的excel 模板
|
上传通用文档 比如一致性核查的 比如导出的excel 模板
|
||||||
</summary>
|
</summary>
|
||||||
|
|
|
@ -15,9 +15,7 @@ namespace IRaCIS.Core.API
|
||||||
var uploadPath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.UploadFileFolder);
|
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 dicomPath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.TrialDataFolder);
|
||||||
|
|
||||||
var comonPathPath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.CommonFileFolder);
|
var systemDataFolder = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.SystemDataFolder);
|
||||||
|
|
||||||
var systemNoticePath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.SystemNoticeFolder);
|
|
||||||
|
|
||||||
|
|
||||||
if (!Directory.Exists(uploadPath))
|
if (!Directory.Exists(uploadPath))
|
||||||
|
@ -30,15 +28,9 @@ namespace IRaCIS.Core.API
|
||||||
Directory.CreateDirectory(dicomPath);
|
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
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
|
@ -56,16 +48,32 @@ namespace IRaCIS.Core.API
|
||||||
|
|
||||||
app.UseStaticFiles(new StaticFileOptions
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
{
|
{
|
||||||
FileProvider = new PhysicalFileProvider(systemNoticePath),
|
FileProvider = new PhysicalFileProvider(systemDataFolder),
|
||||||
RequestPath = $"/{StaticData.SystemNoticeFolder}"
|
RequestPath = $"/{StaticData.SystemDataFolder}"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
app.UseStaticFiles(new StaticFileOptions
|
#region 兼容之前的文档能查看
|
||||||
{
|
|
||||||
FileProvider = new PhysicalFileProvider(comonPathPath),
|
//var comonPathPath = Path.Combine(Directory.GetParent(env.ContentRootPath.TrimEnd('\\')).FullName, StaticData.CommonFileFolder);
|
||||||
RequestPath = $"/{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.Mvc;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using IRaCIS.Core.Domain.Share;
|
using IRaCIS.Core.Domain.Share;
|
||||||
using SharpCompress.Archives;
|
using SharpCompress.Archives;
|
||||||
|
@ -14,7 +13,6 @@ using IRaCIS.Core.Application.Service.Inspection.Interface;
|
||||||
using IRaCIS.Core.Application.Service.Inspection.DTO;
|
using IRaCIS.Core.Application.Service.Inspection.DTO;
|
||||||
using Nito.AsyncEx;
|
using Nito.AsyncEx;
|
||||||
using IRaCIS.Application.Interfaces;
|
using IRaCIS.Application.Interfaces;
|
||||||
using IRaCIS.Core.Domain.Common;
|
|
||||||
using IRaCIS.Core.Infrastructure;
|
using IRaCIS.Core.Infrastructure;
|
||||||
|
|
||||||
namespace IRaCIS.Core.Application.Contracts
|
namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
|
@ -23,10 +23,25 @@
|
||||||
|
|
||||||
|
|
||||||
public static readonly string TrialDataFolder = "TrialData";
|
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 DicomFolder = "Dicom";
|
||||||
public static readonly string NoneDicomFolder = "NoneDicom";
|
public static readonly string NoneDicomFolder = "NoneDicom";
|
||||||
public static readonly string UploadFileFolder = "UploadFile";
|
public static readonly string UploadFileFolder = "UploadFile";
|
||||||
public static readonly string TreatmenthistoryFolder = "Treatmenthistory";
|
public static readonly string TreatmenthistoryFolder = "Treatmenthistory";
|
||||||
|
|
||||||
|
|
||||||
public static readonly string CommonFileFolder = "CommonFileFolder";
|
public static readonly string CommonFileFolder = "CommonFileFolder";
|
||||||
public static readonly string SystemNoticeFolder = "SystemNoticeFolder";
|
public static readonly string SystemNoticeFolder = "SystemNoticeFolder";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue