From d807fe012636507ae8c963f2c26ace70e1a1fa8f Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 23 Apr 2026 17:43:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=9A=8F=E6=9C=BA=EF=BC=8C?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E6=B8=85=E7=90=86=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ImageAndDoc/StudyService.cs | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs index afa48f485..636c02fd1 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs @@ -94,6 +94,8 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var errorPathList = new List(); + var batchId = Guid.NewGuid(); + foreach (var item in idPathList) { var path = item.Path; @@ -106,14 +108,18 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc var prefix = path.Substring(1, path.LastIndexOf('/') - 1); - var maskPath = path.Contains(".MaskDicom") ? $"{Path.GetFileName(path)}" : $"{Path.GetFileName(path)}.MaskDicom"; + //每次都用一个新的名字 + var maskFileName = $"{Path.GetFileName(path)}.{batchId}_MaskDicom"; - //清理缓存的里面的遮盖图,多次遮盖同一张图时,清除缓存很重要 - await _oSSService.DeleteFromPrefix(maskPath, true); + if (path.Contains("_MaskDicom")) + { + //清理缓存的里面的遮盖图,多次遮盖同一张图时,清除缓存很重要 + await _oSSService.DeleteFromPrefix(path, true); //清理缓存的里面的遮盖图,多次遮盖同一张图时,清除缓存很重要 + } + + await _oSSService.UploadToOSSAsync(outPutStream, prefix, maskFileName, false); - await _oSSService.UploadToOSSAsync(outPutStream, prefix, maskPath, false); - - var newPath = path.Contains(".MaskDicom") ? path : path + ".MaskDicom"; + var newPath = $"/{prefix}/{maskFileName}"; await _dicomInstanceRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new DicomInstance() { Path = newPath, IsMasked = true }); } @@ -160,11 +166,12 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc foreach (var item in idPathList) { - if (item.Path.EndsWith(".MaskDicom")) + if (item.Path.EndsWith("_MaskDicom")) { - var newPath = item.Path[..^10]; + await _oSSService.DeleteFromPrefix(item.Path, true); - //await _oSSService.DeleteFromPrefix(newPath, true); + var length = Guid.Empty.ToString().Length + "_MaskDicom".Length; + var newPath = item.Path[..^length]; await _dicomInstanceRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new DicomInstance() { Path = newPath, IsMasked = false }); }