diff --git a/IRaCIS.Core.Application/Helper/OSSService.cs b/IRaCIS.Core.Application/Helper/OSSService.cs index 29dd6e263..b82dda499 100644 --- a/IRaCIS.Core.Application/Helper/OSSService.cs +++ b/IRaCIS.Core.Application/Helper/OSSService.cs @@ -545,13 +545,23 @@ public class OSSService : IOSSService /// 是否覆盖已存在的目标文件(默认true) public void MoveObject(string sourcePath, string destPath, bool overwrite = true) { - + GetObjectStoreTempToken(); var aliConfig = ObjectStoreServiceOptions.AliyunOSS; var client = new OssClient(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? aliConfig.EndPoint : aliConfig.InternalEndpoint, AliyunOSSTempToken.AccessKeyId, AliyunOSSTempToken.AccessKeySecret, AliyunOSSTempToken.SecurityToken); + + if (sourcePath.StartsWith("/")) + { + sourcePath = sourcePath.Substring(1); + } + if (destPath.StartsWith("/")) + { + destPath = destPath.Substring(1); + } + var sourceBucket = aliConfig.BucketName; var sourceKey = sourcePath; @@ -565,9 +575,16 @@ public class OSSService : IOSSService // 检查目标是否存在(当不允许覆盖时) if (!overwrite && client.DoesObjectExist(destBucket, destKey)) { - throw new InvalidOperationException("File exist"); + throw new InvalidOperationException("File Exist"); } + + //var copyRequest = new Aliyun.OSS.CopyObjectRequest(sourceBucket, sourceKey, sourceBucket, destKey); + //var result = client.CopyObject(copyRequest); + + //// 2. 删除原文件(可选,根据是否需要保留原文件) + //client.DeleteObject(sourceBucket, sourceKey); + // 执行复制 var copyRequest = new Aliyun.OSS.CopyObjectRequest( sourceBucket, sourceKey, diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml index afabecdbb..6743968f8 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml @@ -1054,7 +1054,7 @@ 医生文档关联关系维护 - + 医生文档关联关系维护 @@ -1110,7 +1110,7 @@ - + 删除 @@ -1124,6 +1124,13 @@ + + + 更新医生资质 + + + + 保存多个附件 @@ -13610,6 +13617,14 @@ + + + 移动OSS文件到新路径 + + 原文件路径(格式:bucket/key) + 新文件路径(格式:bucket/key) + 是否覆盖已存在的目标文件(默认true) + 获取所有根目录名称 diff --git a/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs b/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs index 5e382518c..cee94899e 100644 --- a/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs +++ b/IRaCIS.Core.Application/Service/Doctor/AttachmentService.cs @@ -220,7 +220,7 @@ namespace IRaCIS.Core.Application.Service var fileName= attachmentData.Path.Split("/").Last(); - attachment.Path = $"/systemData/reviewe/{attachment.Type}/{attachment.DoctorId}/{fileName}`"; + attachment.Path = $"/systemData/reviewe/{attachment.Type}/{attachment.DoctorId}/{fileName}"; _oSSService.MoveObject(attachmentData.Path, attachment.Path);