修改影像大小
continuous-integration/drone/push Build is passing Details

Test_HIR_Net8
hang 2025-12-18 09:51:06 +08:00
parent efd24ab9ba
commit df7eaf6986
1 changed files with 23 additions and 12 deletions

View File

@ -944,7 +944,7 @@ namespace IRaCIS.Core.API.Controllers
var progress = new var progress = new
{ {
TotalCount= totalCount, TotalCount= totalCount,
TotalSize= totalSize, TotalSize = (totalSize / 1024 / 1024).ToString("0.00") + " MB",
CountPercent = totalCount > 0 CountPercent = totalCount > 0
? Math.Round(receivedCount * 100m / totalCount, 2).ToString() ? Math.Round(receivedCount * 100m / totalCount, 2).ToString()
@ -1005,6 +1005,7 @@ namespace IRaCIS.Core.API.Controllers
{ {
foreach (var instance in series.InstanceList) foreach (var instance in series.InstanceList)
{ {
abortToken.ThrowIfCancellationRequested();
try try
{ {
@ -1012,7 +1013,6 @@ namespace IRaCIS.Core.API.Controllers
receivedSize = receivedSize + instance.FileSize ?? 0; receivedSize = receivedSize + instance.FileSize ?? 0;
receivedCount++; receivedCount++;
abortToken.ThrowIfCancellationRequested();
var entryPath = var entryPath =
$"{patient.PatientIdStr}/{studyTime}_{modalitysStr}/IMAGE/{instance.FileName}"; $"{patient.PatientIdStr}/{studyTime}_{modalitysStr}/IMAGE/{instance.FileName}";
@ -1149,7 +1149,7 @@ namespace IRaCIS.Core.API.Controllers
var progress = new var progress = new
{ {
TotalCount = totalCount, TotalCount = totalCount,
TotalSize = totalSize, TotalSize = (totalSize / 1024 / 1024).ToString("0.00") + " MB" ,
CountPercent = totalCount > 0 CountPercent = totalCount > 0
? Math.Round(receivedCount * 100m / totalCount, 2).ToString() ? Math.Round(receivedCount * 100m / totalCount, 2).ToString()
@ -1210,6 +1210,7 @@ namespace IRaCIS.Core.API.Controllers
{ {
foreach (var instance in series.InstanceList) foreach (var instance in series.InstanceList)
{ {
abortToken.ThrowIfCancellationRequested();
try try
{ {
@ -1217,7 +1218,6 @@ namespace IRaCIS.Core.API.Controllers
receivedSize = receivedSize + instance.FileSize ?? 0; receivedSize = receivedSize + instance.FileSize ?? 0;
receivedCount++; receivedCount++;
abortToken.ThrowIfCancellationRequested();
var entryPath = var entryPath =
$"{visit.SubjectCode}_{visit.VisitName}/{studyTime}_{modalitysStr}/IMAGE/{instance.FileName}"; $"{visit.SubjectCode}_{visit.VisitName}/{studyTime}_{modalitysStr}/IMAGE/{instance.FileName}";
@ -1378,20 +1378,31 @@ ClinicalDataDownloadDTO inCommand)
abortToken.ThrowIfCancellationRequested(); abortToken.ThrowIfCancellationRequested();
//当前完成大小 try
receivedCount++; {
//当前完成大小
receivedCount++;
var entryPath = $"{data.FileName}"; var entryPath = $"{data.FileName}";
var entry = zip.CreateEntry(entryPath, CompressionLevel.Fastest); var entry = zip.CreateEntry(entryPath, CompressionLevel.Fastest);
await using var entryStream = entry.Open(); await using var entryStream = entry.Open();
await using var source = await _oSSService.GetStreamFromOSSAsync(data.Path); await using var source = await _oSSService.GetStreamFromOSSAsync(data.Path);
await source.CopyToAsync(entryStream, 32 * 1024, abortToken); await source.CopyToAsync(entryStream, 32 * 1024, abortToken);
}
catch (Exception ex)
{
await NotifyProgressAsync(); Log.Logger.Warning($"处理文件{data.FileName}:{data.Path}失败: {ex.Message}");
}
finally
{
await NotifyProgressAsync();
}
} }