记录重复修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
1d6731e3a4
commit
0dff3d6e4b
|
|
@ -1434,6 +1434,8 @@ namespace IRaCIS.Core.Application.Service
|
||||||
var allVersions = new List<ObjectVersionSummary>();
|
var allVersions = new List<ObjectVersionSummary>();
|
||||||
var allDeleteMarkers = new List<DeleteMarkerSummary>();
|
var allDeleteMarkers = new List<DeleteMarkerSummary>();
|
||||||
|
|
||||||
|
var allDeleteDistinceKeys = new List<string>();
|
||||||
|
|
||||||
var request = new ListObjectVersionsRequest(tempToken.AliyunOSS.BucketName)
|
var request = new ListObjectVersionsRequest(tempToken.AliyunOSS.BucketName)
|
||||||
{
|
{
|
||||||
Prefix = "test-delete-restore",
|
Prefix = "test-delete-restore",
|
||||||
|
|
@ -1487,7 +1489,14 @@ namespace IRaCIS.Core.Application.Service
|
||||||
if (prevVersion == null)
|
if (prevVersion == null)
|
||||||
continue; // 没找到可恢复版本
|
continue; // 没找到可恢复版本
|
||||||
|
|
||||||
|
//这里会出现同一个key 删除多次,然后下载多次,恢复的时候插入数据有问题
|
||||||
|
|
||||||
|
if (allDeleteDistinceKeys.Contains(del.Key))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
allDeleteDistinceKeys.Add(del.Key);
|
||||||
|
|
||||||
|
|
||||||
// 创建 CopyObject 请求
|
// 创建 CopyObject 请求
|
||||||
|
|
@ -1560,6 +1569,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
tempToken.AliyunOSS.AccessKeySecret,
|
tempToken.AliyunOSS.AccessKeySecret,
|
||||||
tempToken.AliyunOSS.SecurityToken);
|
tempToken.AliyunOSS.SecurityToken);
|
||||||
|
|
||||||
|
var allDeleteDistinceKeys = new List<string>();
|
||||||
|
|
||||||
var restoreCount = 0;
|
var restoreCount = 0;
|
||||||
foreach (var item in rows)
|
foreach (var item in rows)
|
||||||
|
|
@ -1570,6 +1580,14 @@ namespace IRaCIS.Core.Application.Service
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (allDeleteDistinceKeys.Contains(item.Key))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
allDeleteDistinceKeys.Add(item.Key);
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -1599,7 +1617,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
var fileSize = new FileInfo(dicomFilePath).Length;
|
var fileSize = new FileInfo(dicomFilePath).Length;
|
||||||
|
|
||||||
await ArchiveDicomFileAsync(dicomFile, trialId, item.SubjectId, item.SubjectVisitId,item.Key, fileSize);
|
await ArchiveDicomFileAsync(dicomFile, trialId, item.SubjectId, item.SubjectVisitId, item.Key, fileSize);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
@ -1632,13 +1650,13 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
var copyResult = _ossClient.CopyObject(copyReq);
|
var copyResult = _ossClient.CopyObject(copyReq);
|
||||||
|
|
||||||
Console.WriteLine($"✅ 恢复成功: {item.Key} 版本{item.VersionId}, 新版本ID={copyResult.VersionId}");
|
Console.WriteLine($"✅ 恢复成功: {item.SubjectCode} {item.Key} 版本{item.VersionId}, 新版本ID={copyResult.VersionId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
||||||
var errorMsg = $"❌ 恢复失败: {item.Key}, 错误: {ex.Message}";
|
var errorMsg = $"❌ 恢复失败:{item.SubjectCode} {item.Key}, 错误: {ex.Message}";
|
||||||
Console.WriteLine(errorMsg);
|
Console.WriteLine(errorMsg);
|
||||||
|
|
||||||
await File.AppendAllTextAsync(outputErrorFile, errorMsg + Environment.NewLine);
|
await File.AppendAllTextAsync(outputErrorFile, errorMsg + Environment.NewLine);
|
||||||
|
|
@ -1699,7 +1717,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
/// <param name="subjectVisitId"></param>
|
/// <param name="subjectVisitId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="NotImplementedException"></exception>
|
/// <exception cref="NotImplementedException"></exception>
|
||||||
public async Task ArchiveDicomFileAsync(DicomFile dicomFile, Guid trialId, Guid subjectId, Guid subjectVisitId,string path,long fileSize)
|
public async Task ArchiveDicomFileAsync(DicomFile dicomFile, Guid trialId, Guid subjectId, Guid subjectVisitId, string path, long fileSize)
|
||||||
{
|
{
|
||||||
var dataset = dicomFile.Dataset;
|
var dataset = dicomFile.Dataset;
|
||||||
|
|
||||||
|
|
@ -1822,7 +1840,7 @@ namespace IRaCIS.Core.Application.Service
|
||||||
++findSerice.InstanceCount;
|
++findSerice.InstanceCount;
|
||||||
|
|
||||||
//賦值路徑
|
//賦值路徑
|
||||||
findInstance.Path = "/"+path;
|
findInstance.Path = "/" + path;
|
||||||
findInstance.FileSize = fileSize;
|
findInstance.FileSize = fileSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue