From b032ee5ab631a4e9c217411c69d5b1732b8c66de Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 27 May 2022 16:38:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AD=98=E5=82=A8=E8=B7=AF?= =?UTF-8?q?=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/Controllers/UploadController.cs | 1 - .../Service/QC/QCOperationService.cs | 12 +++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/IRaCIS.Core.API/Controllers/UploadController.cs b/IRaCIS.Core.API/Controllers/UploadController.cs index 95397fab..2c6e322d 100644 --- a/IRaCIS.Core.API/Controllers/UploadController.cs +++ b/IRaCIS.Core.API/Controllers/UploadController.cs @@ -206,7 +206,6 @@ namespace IRaCIS.Core.API.Controllers if (!Directory.Exists(uploadFolderPath)) Directory.CreateDirectory(uploadFolderPath); - var (trustedFileNameForFileStorage, fileName) = FileStoreHelper.GetStoreFileName(fileRealName); diff --git a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs index 19390e0c..2b18ccbc 100644 --- a/IRaCIS.Core.Application/Service/QC/QCOperationService.cs +++ b/IRaCIS.Core.Application/Service/QC/QCOperationService.cs @@ -22,6 +22,7 @@ using IRaCIS.Core.Application.Service.Inspection.DTO; using Nito.AsyncEx; using System.ComponentModel.DataAnnotations; using IRaCIS.Core.Application.Auth; +using IRaCIS.Core.Application.Helper; namespace IRaCIS.Core.Application.Image.QA { @@ -535,7 +536,7 @@ namespace IRaCIS.Core.Application.Image.QA // return ResponseOutput.NotOk("只有PM/APM具有操作权限!"); //} - var rootPath = Directory.GetParent(_hostEnvironment.ContentRootPath.TrimEnd('\\')).IfNullThrowException().FullName; + var rootPath = FileStoreHelper.GetIRaCISRootDataFolder(_hostEnvironment); var fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.ToString().Trim('"').ToLower(); if (!fileName.EndsWith(".xlsx") && !fileName.EndsWith(".csv") && !fileName.EndsWith(".xls")) @@ -544,7 +545,7 @@ namespace IRaCIS.Core.Application.Image.QA } //上传根路径 - string uploadFolderPath = Path.Combine(rootPath, "UploadFile", "Check"); + string uploadFolderPath = Path.Combine(rootPath,StaticData.TrialDataFolder, trialId.ToString(), "CheckExcel"); if (!Directory.Exists(uploadFolderPath)) { @@ -552,7 +553,12 @@ namespace IRaCIS.Core.Application.Image.QA } //存放核对表 - var filePath = Path.Combine(uploadFolderPath, DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss") + fileName); + var (trustedFileNameForFileStorage, fileName) = FileStoreHelper.GetStoreFileName(fileName); + + var filePath = Path.Combine(uploadFolderPath, trustedFileNameForFileStorage); + + + using (FileStream fs = System.IO.File.Create(filePath)) { await file.CopyToAsync(fs);