From d3f7c199c7b917768fe9943573dbe6fac76bbfb0 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 31 Jul 2024 14:05:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E5=89=8D=E7=AB=AF=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ImageAndDoc/StudyService.cs | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs index 13a2857bb..dbed0f7c8 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/StudyService.cs @@ -146,20 +146,21 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc public async Task AddOrUpdateArchiveStudy(NewArchiveStudyCommand incommand) { - //var @uploadLock = _distributedLockProvider.CreateLock($"UploadDicom"); + var @uploadLock = _distributedLockProvider.CreateLock($"UploadDicom"); - //using (await @uploadLock.AcquireAsync()) - //{ - // if (_provider.Exists($"StudyUid_{incommand.TrialId}_{incommand.Study.StudyInstanceUid}")) - // { - // //---当前已有人正在上传和归档该检查! - // return ResponseOutput.NotOk(StaticData.International("UploadDownLoad_ArchiveInProgress")); - // } - // else - // { - // _provider.Set($"StudyUid_{incommand.TrialId}_{incommand.Study.StudyInstanceUid}", _userInfo.Id, TimeSpan.FromSeconds(30)); - // } - //} + using (await @uploadLock.AcquireAsync()) + { + if (_provider.Exists($"{incommand.TrialId}_{incommand.Study.StudyInstanceUid}")) + { + //---当前已有人正在上传和归档该检查! + return ResponseOutput.NotOk(StaticData.International("UploadDownLoad_ArchiveInProgress")); + } + else + { + //在事务未完成前 防止前端重复提交 + _provider.Set($"{incommand.TrialId}_{incommand.Study.StudyInstanceUid}", _userInfo.Id, TimeSpan.FromMinutes(3)); + } + } var modalitys = string.Empty; @@ -355,6 +356,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc finally { _provider.Remove($"StudyUid_{incommand.TrialId}_{incommand.Study.StudyInstanceUid}"); + _provider.Remove($"{incommand.TrialId}_{incommand.Study.StudyInstanceUid}"); }