From 8d811155252421e35fb018d731e86803fcd77a1c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 8 Jul 2025 10:20:08 +0800 Subject: [PATCH] =?UTF-8?q?oss=20=E7=BB=B4=E6=8A=A4=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/appsettings.Prod_IRC.json | 8 ++++---- IRaCIS.Core.Application/Helper/OSSService.cs | 6 ++++-- IRaCIS.Core.Application/TestService.cs | 10 +++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/IRaCIS.Core.API/appsettings.Prod_IRC.json b/IRaCIS.Core.API/appsettings.Prod_IRC.json index b318514e2..183eb939d 100644 --- a/IRaCIS.Core.API/appsettings.Prod_IRC.json +++ b/IRaCIS.Core.API/appsettings.Prod_IRC.json @@ -7,10 +7,10 @@ } }, "ConnectionStrings": { - "RemoteNew": "Server=101.132.193.237,1434;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true", - "Hangfire": "Server=101.132.193.237,1434;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true" - //"RemoteNew": "Server=prod_mssql_standard,1433;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true", - //"Hangfire": "Server=prod_mssql_standard,1433;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true" + //"RemoteNew": "Server=101.132.193.237,1434;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true", + //"Hangfire": "Server=101.132.193.237,1434;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true" + "RemoteNew": "Server=prod_mssql_standard,1433;Database=Prod_IRC;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true", + "Hangfire": "Server=prod_mssql_standard,1433;Database=Prod_IRC_Hangfire;User ID=sa;Password=zhanying@2021;TrustServerCertificate=true" }, "ObjectStoreService": { "ObjectStoreUse": "AliyunOSS", diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 8882d7dd7..58877a5a1 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -18,6 +18,7 @@ using Minio.DataModel.Args; using Minio.Exceptions; using System.Reactive.Linq; using System.Runtime.InteropServices; +using System.Web; namespace IRaCIS.Core.Application.Helper; @@ -1022,9 +1023,10 @@ public class OSSService : IOSSService var _ossClient = new OssClient(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? aliConfig.EndPoint : aliConfig.InternalEndpoint, AliyunOSSTempToken.AccessKeyId, AliyunOSSTempToken.AccessKeySecret, AliyunOSSTempToken.SecurityToken); - var metadata = _ossClient.GetObjectMetadata(aliConfig.BucketName, objectkey); + var key = HttpUtility.UrlDecode(objectkey); + var metadata = _ossClient.GetObjectMetadata(aliConfig.BucketName, key); - long fileSize = metadata.ContentLength; // 文件大小(字节) + long fileSize = metadata?.ContentLength??0; // 文件大小(字节) return fileSize; } diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs index c9fe6896b..e9d5c9588 100644 --- a/IRaCIS.Core.Application/TestService.cs +++ b/IRaCIS.Core.Application/TestService.cs @@ -396,7 +396,7 @@ namespace IRaCIS.Core.Application.Service [FromServices] IRepository _noneDicomStudyFileRepository, [FromServices] IRepository _readingClinicalDataPDFRepository) { - var noneDicomList = _noneDicomStudyFileRepository.Where(t => t.FileSize == 0 || t.FileSize == null).Select(t => new { t.Path, t.Id }).ToList(); + var noneDicomList = _noneDicomStudyFileRepository/*.Where(t=>t.NoneDicomStudy.TrialId==Guid.Parse("01000000-ac13-0242-3ae4-08dc9b0495c6"))*/.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(); @@ -409,9 +409,9 @@ namespace IRaCIS.Core.Application.Service await _noneDicomStudyFileRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new NoneDicomStudyFile() { FileSize = fileSize }); } - catch (Exception) + catch (Exception ex) { - + Console.WriteLine(item.Path+" : " + ex.Message); } @@ -427,9 +427,9 @@ namespace IRaCIS.Core.Application.Service await _readingClinicalDataPDFRepository.BatchUpdateNoTrackingAsync(t => t.Id == item.Id, u => new ReadingClinicalDataPDF() { Size = (int)fileSize }); } - catch (Exception) + catch (Exception ex) { - + Console.WriteLine(item.Path + " : " + ex.Message); } }