@@ -158,7 +158,7 @@ public interface IOSSService
|
||||
|
||||
public Task MoveObject(string sourcePath, string destPath, bool overwrite = true);
|
||||
|
||||
public Task<long> GetObjectSizeAsync(string sourcePath);
|
||||
public Task<long> GetObjectSizeAsync(string sourcePath);
|
||||
}
|
||||
|
||||
|
||||
@@ -1000,9 +1000,15 @@ public class OSSService : IOSSService
|
||||
}
|
||||
}
|
||||
|
||||
private bool isFirstCall = true;
|
||||
public async Task<long> GetObjectSizeAsync(string sourcePath)
|
||||
{
|
||||
GetObjectStoreTempToken();
|
||||
if (isFirstCall)
|
||||
{
|
||||
GetObjectStoreTempToken();
|
||||
isFirstCall = false;
|
||||
}
|
||||
|
||||
|
||||
var objectkey = sourcePath.Trim('/');
|
||||
|
||||
|
||||
@@ -218,22 +218,40 @@ namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
var noneDicomList = _noneDicomStudyFileRepository.Where(t => t.FileSize == 0 || t.FileSize == null).Select(t => new { t.Path, t.Id }).ToList();
|
||||
|
||||
var clinicalDataPDFList = _readingClinicalDataPDFRepository.Where(t => t.Size == 0).Select(t => new { t.Path, t.Id }).ToList();
|
||||
|
||||
|
||||
foreach (var item in noneDicomList)
|
||||
{
|
||||
var fileSize = await _oSSService.GetObjectSizeAsync(item.Path);
|
||||
try
|
||||
{
|
||||
var fileSize = await _oSSService.GetObjectSizeAsync(item.Path);
|
||||
await _noneDicomStudyFileRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new NoneDicomStudyFile() { FileSize = fileSize });
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
await _noneDicomStudyFileRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new NoneDicomStudyFile() { FileSize = fileSize });
|
||||
|
||||
}
|
||||
|
||||
var clinicalDataPDFList = _readingClinicalDataPDFRepository.Where(t => t.Size == 0).Select(t => new { t.Path, t.Id }).ToList();
|
||||
|
||||
|
||||
foreach (var item in clinicalDataPDFList)
|
||||
{
|
||||
var fileSize = await _oSSService.GetObjectSizeAsync(item.Path);
|
||||
try
|
||||
{
|
||||
var fileSize = await _oSSService.GetObjectSizeAsync(item.Path);
|
||||
|
||||
await _readingClinicalDataPDFRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new ReadingClinicalDataPDF() { Size = (int)fileSize });
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
await _readingClinicalDataPDFRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new ReadingClinicalDataPDF() { Size = (int)fileSize });
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user