上传 心跳包处理
parent
43ef5bcdd9
commit
8875595012
|
@ -178,6 +178,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||||
|
|
||||||
public class PreArchiveDicomStudyCommand
|
public class PreArchiveDicomStudyCommand
|
||||||
{
|
{
|
||||||
|
//public string StudyInstanceUid { get; set; }
|
||||||
|
|
||||||
[NotDefault]
|
[NotDefault]
|
||||||
public Guid TrialId { get; set; }
|
public Guid TrialId { get; set; }
|
||||||
[NotDefault]
|
[NotDefault]
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
[ApiExplorerSettings(GroupName = "Image")]
|
[ApiExplorerSettings(GroupName = "Image")]
|
||||||
public class StudyService : BaseService, IStudyService
|
public class StudyService : BaseService, IStudyService
|
||||||
{
|
{
|
||||||
private static object lockCodeGenerate = new object();
|
private static object lockObj = new object();
|
||||||
private static readonly AsyncLock _mutex = new AsyncLock();
|
private static readonly AsyncLock _mutex = new AsyncLock();
|
||||||
private static readonly AsyncLock _mutex2 = new AsyncLock();
|
private static readonly AsyncLock _mutex2 = new AsyncLock();
|
||||||
|
|
||||||
|
@ -93,8 +93,18 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
public async Task<IResponseOutput> PreArchiveDicomStudy(PreArchiveDicomStudyCommand preArchiveStudyCommand)
|
public async Task<IResponseOutput> PreArchiveDicomStudy(PreArchiveDicomStudyCommand preArchiveStudyCommand)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
//lock (lockObj)
|
||||||
|
//{
|
||||||
|
// if (_provider.Exists($"StudyUid_{preArchiveStudyCommand.TrialId}_{preArchiveStudyCommand.StudyInstanceUid}"))
|
||||||
|
// {
|
||||||
|
// //---当前已有人正在上传和归档该检查!
|
||||||
|
// return ResponseOutput.NotOk(StaticData.International("UploadDownLoad_ArchiveInProgress"));
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// _provider.Set($"StudyUid_{preArchiveStudyCommand.TrialId}_{preArchiveStudyCommand.StudyInstanceUid}", _userInfo.Id, TimeSpan.FromSeconds(30));
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
var studyMonitor = new StudyMonitor()
|
var studyMonitor = new StudyMonitor()
|
||||||
{
|
{
|
||||||
|
@ -111,7 +121,6 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
IsDicomReUpload = preArchiveStudyCommand.IsDicomReUpload,
|
IsDicomReUpload = preArchiveStudyCommand.IsDicomReUpload,
|
||||||
FileSize = preArchiveStudyCommand.FileSize,
|
FileSize = preArchiveStudyCommand.FileSize,
|
||||||
FileCount = preArchiveStudyCommand.FileCount,
|
FileCount = preArchiveStudyCommand.FileCount,
|
||||||
//FailedFileCount = preArchiveStudyCommand.FailedFileCount,
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -123,9 +132,20 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IResponseOutput DicomUploadInprogress(Guid trialId, string studyInstanceUid)
|
||||||
|
{
|
||||||
|
_provider.Set($"StudyUid_{trialId}_{studyInstanceUid}", _userInfo.Id, TimeSpan.FromSeconds(30));
|
||||||
|
|
||||||
|
return ResponseOutput.Ok();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
[TypeFilter(typeof(TrialResourceFilter), Arguments = new object[] { "AfterStopCannNotOpt" })]
|
||||||
public async Task<IResponseOutput> AddOrUpdateArchiveStudy(NewArchiveStudyCommand incommand)
|
public async Task<IResponseOutput> AddOrUpdateArchiveStudy(NewArchiveStudyCommand incommand)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var trialId = incommand.TrialId;
|
var trialId = incommand.TrialId;
|
||||||
|
|
||||||
|
@ -289,7 +309,20 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
{
|
{
|
||||||
await _dicomInstanceRepository.SaveChangesAsync();
|
await _dicomInstanceRepository.SaveChangesAsync();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
return ResponseOutput.NotOk(ex.Message);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_provider.Remove($"StudyUid_{incommand.TrialId}_{incommand.Study.StudyInstanceUid}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -729,7 +762,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
|
|
||||||
var result = new VerifyStudyUploadResult();
|
var result = new VerifyStudyUploadResult();
|
||||||
|
|
||||||
if (_provider.Exists("StudyUid_" + studyInstanceUid))
|
if (_provider.Exists($"StudyUid_{trialId}_{studyInstanceUid}"))
|
||||||
{
|
{
|
||||||
result.AllowUpload = false;
|
result.AllowUpload = false;
|
||||||
|
|
||||||
|
@ -790,6 +823,16 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.StudyInstanceUid = studyInstanceUid;
|
result.StudyInstanceUid = studyInstanceUid;
|
||||||
|
|
||||||
|
|
||||||
|
if (result.AllowReUpload || result.AllowUpload)
|
||||||
|
{
|
||||||
|
lock (lockObj)
|
||||||
|
{
|
||||||
|
_provider.Set($"StudyUid_{trialId}_{studyInstanceUid}", _userInfo.Id, TimeSpan.FromMinutes(30));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue