修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
d5609560e2
commit
5874223866
|
@ -23,6 +23,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
IRepository<VisitTask> _visitTaskRepository,
|
IRepository<VisitTask> _visitTaskRepository,
|
||||||
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
|
IRepository<ReadingQuestionCriterionTrial> _readingQuestionCriterionTrialRepository,
|
||||||
ILogger<GeneralCalculateService> _logger,
|
ILogger<GeneralCalculateService> _logger,
|
||||||
|
|
||||||
IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository,
|
IRepository<ReadingTableQuestionTrial> _readingTableQuestionTrialRepository,
|
||||||
IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository,
|
IRepository<ReadingTableAnswerRowInfo> _readingTableAnswerRowInfoRepository,
|
||||||
IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository,
|
IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository,
|
||||||
|
@ -764,42 +765,63 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate
|
||||||
public async Task<string> FileDownSave(string url, string savePath)
|
public async Task<string> FileDownSave(string url, string savePath)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
#region 新
|
||||||
|
try
|
||||||
|
{
|
||||||
|
url= url.Replace(_options.CurrentValue.MinIO.ViewEndpoint, "");
|
||||||
|
if (!string.IsNullOrWhiteSpace(url))
|
||||||
|
{
|
||||||
|
string[] strArry = url.Split('/');
|
||||||
|
savePath = savePath + "/" + strArry[strArry.Length - 1];
|
||||||
|
}
|
||||||
|
await _oSSService.DownLoadFromOSSAsync(url, savePath);
|
||||||
|
|
||||||
await _oSSService.DownLoadFromOSSAsync(url, savePath);
|
return savePath;
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
|
||||||
return savePath;
|
throw new BusinessValidationFailedException(_localizer["ReadingCalculate_ImageNotExist"]);
|
||||||
|
}
|
||||||
|
|
||||||
//try
|
#endregion
|
||||||
//{
|
|
||||||
// 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;
|
#region 之前
|
||||||
//}
|
try
|
||||||
//catch (Exception)
|
{
|
||||||
//{
|
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"]);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
// throw new BusinessValidationFailedException(_localizer["ReadingCalculate_ImageNotExist"]);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue