Test_HIR_Net8
parent
20718bca5d
commit
a5b4ab6531
|
@ -31,7 +31,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
IRepository<TumorAssessment_RECIST1Point1> _tumorAssessmentRepository,
|
||||
IRepository<ReadingTaskQuestionAnswer> _readingTaskQuestionAnswerRepository,
|
||||
IRepository<InspectionFile> _inspectionFileRepository,
|
||||
IOSSService oSSService, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IGeneralCalculateService
|
||||
IOSSService _oSSService, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IGeneralCalculateService
|
||||
{
|
||||
|
||||
|
||||
|
@ -78,7 +78,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
|
||||
try
|
||||
{
|
||||
var ossRelativePath = await oSSService.UploadToOSSAsync(fileStream, "InspectionUpload/"+ pathCode, file.FileName);
|
||||
var ossRelativePath = await _oSSService.UploadToOSSAsync(fileStream, "InspectionUpload/"+ pathCode, file.FileName);
|
||||
await _inspectionFileRepository.AddAsync(new InspectionFile() { FileName = file.FileName, RelativePath = ossRelativePath, TrialId = trialId });
|
||||
}
|
||||
catch (Exception)
|
||||
|
@ -763,37 +763,43 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
|||
/// <returns><placeholder>A <see cref="Task"/>
|
||||
public async Task<string> FileDownSave(string url, string savePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpClient httpClient = new HttpClient();
|
||||
if (!string.IsNullOrWhiteSpace(url))
|
||||
{
|
||||
string[] strArry = url.Split('/');
|
||||
savePath = savePath + "/" + strArry[strArry.Length - 1];
|
||||
}
|
||||
|
||||
var t = httpClient.GetByteArrayAsync(url);
|
||||
t.Wait();
|
||||
Stream responseStream = new MemoryStream(t.Result);
|
||||
Stream stream = new FileStream(savePath, FileMode.Create);
|
||||
byte[] bArr = new byte[1024];
|
||||
int size = responseStream.Read(bArr, 0, bArr.Length);
|
||||
while (size > 0)
|
||||
{
|
||||
stream.Write(bArr, 0, size);
|
||||
size = responseStream.Read(bArr, 0, bArr.Length);
|
||||
}
|
||||
|
||||
stream.Close();
|
||||
responseStream.Close();
|
||||
await _oSSService.DownLoadFromOSSAsync(url, savePath);
|
||||
|
||||
return savePath;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return savePath;
|
||||
|
||||
throw new BusinessValidationFailedException(_localizer["ReadingCalculate_ImageNotExist"]);
|
||||
}
|
||||
//try
|
||||
//{
|
||||
// HttpClient httpClient = new HttpClient();
|
||||
// if (!string.IsNullOrWhiteSpace(url))
|
||||
// {
|
||||
// string[] strArry = url.Split('/');
|
||||
// savePath = savePath + "/" + strArry[strArry.Length - 1];
|
||||
// }
|
||||
|
||||
// var t = httpClient.GetByteArrayAsync(url);
|
||||
// t.Wait();
|
||||
// Stream responseStream = new MemoryStream(t.Result);
|
||||
// Stream stream = new FileStream(savePath, FileMode.Create);
|
||||
// byte[] bArr = new byte[1024];
|
||||
// int size = responseStream.Read(bArr, 0, bArr.Length);
|
||||
// while (size > 0)
|
||||
// {
|
||||
// stream.Write(bArr, 0, size);
|
||||
// size = responseStream.Read(bArr, 0, bArr.Length);
|
||||
// }
|
||||
|
||||
// stream.Close();
|
||||
// responseStream.Close();
|
||||
|
||||
// return savePath;
|
||||
//}
|
||||
//catch (Exception)
|
||||
//{
|
||||
|
||||
// throw new BusinessValidationFailedException(_localizer["ReadingCalculate_ImageNotExist"]);
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue