From 913084cc8df47e78dc5a2d51a8b12e231b4e8a98 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Thu, 3 Apr 2025 09:57:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../General/GeneralCalculateService.cs | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs index e51495f89..375488abb 100644 --- a/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs +++ b/IRaCIS.Core.Application/Service/ReadingCalculate/General/GeneralCalculateService.cs @@ -768,7 +768,7 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate #region 新 try { - url= url.Replace(_options.CurrentValue.MinIO.ViewEndpoint, ""); + if (!string.IsNullOrWhiteSpace(url)) { string[] strArry = url.Split('/'); @@ -789,37 +789,38 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate #region 之前 - try - { - HttpClient httpClient = new HttpClient(); - if (!string.IsNullOrWhiteSpace(url)) - { - string[] strArry = url.Split('/'); - savePath = savePath + "/" + strArry[strArry.Length - 1]; - } + // 之前需要有绝对路径 + //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); - } + // 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(); + // stream.Close(); + // responseStream.Close(); - return savePath; - } - catch (Exception) - { + // return savePath; + //} + //catch (Exception) + //{ - throw new BusinessValidationFailedException(_localizer["ReadingCalculate_ImageNotExist"]); - } + // throw new BusinessValidationFailedException(_localizer["ReadingCalculate_ImageNotExist"]); + //} #endregion @@ -900,9 +901,9 @@ namespace IRaCIS.Core.Application.Service.ReadingCalculate lesionImage.Add(new Dictionary() { { "ImageOneMark",getPicNum(true)+ picRowinfo[2*i].VisitTask.TaskName+" "+picRowinfo[2*i].RowMark}, - { "ImageOneUrl" ,await GetWordPictureMaxWL(_options.CurrentValue.MinIO.ViewEndpoint+picRowinfo[2*i].PicturePath ,System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"wwwroot/ReadReoprtTemplate/downLoad/{DownLoadGuid}"),290,390) }, + { "ImageOneUrl" ,await GetWordPictureMaxWL(picRowinfo[2*i].PicturePath ,System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"wwwroot/ReadReoprtTemplate/downLoad/{DownLoadGuid}"),290,390) }, { "ImageTwoMark",getPicNum(picCount>2*i+1) + (picCount<=2*i+1?string.Empty:picRowinfo[2*i+1].VisitTask.TaskName+" "+picRowinfo[2*i+1].RowMark) }, - { "ImageTwoUrl", picCount<=2*i+1?string.Empty:await GetWordPictureMaxWL(_options.CurrentValue.MinIO.ViewEndpoint+picRowinfo[2*i+1].PicturePath ,System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"wwwroot/ReadReoprtTemplate/downLoad/{DownLoadGuid}"),290, 390) }, + { "ImageTwoUrl", picCount<=2*i+1?string.Empty:await GetWordPictureMaxWL(picRowinfo[2*i+1].PicturePath ,System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"wwwroot/ReadReoprtTemplate/downLoad/{DownLoadGuid}"),290, 390) }, }); }