From 86c24e6002ab67ff2fc05d83def357c45ce201b5 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 29 Sep 2025 15:12:06 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Document/AuditDocumentService.cs | 56 +++---------------- 1 file changed, 8 insertions(+), 48 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs b/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs index d45d8895b..1ae0865bb 100644 --- a/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs @@ -600,6 +600,13 @@ public class AuditDocumentService(IRepository _auditDocumentRepos throw new BusinessValidationFailedException(_localizer["AuditDocument_CanNotMove"]); } + // 不能自动到自己父类这个文件夹 + if (await _auditDocumentRepository.AnyAsync(x => x.ParentId == inDto.ParentId && inDto.Ids.Contains(x.Id))) + { + throw new BusinessValidationFailedException(_localizer["AuditDocument_CanNotMoveToParent"]); + } + + await CopyFileOrFolder(inDto); await DeleteAuditDocument(new DeleteAuditDocumentInDto() @@ -619,54 +626,7 @@ public class AuditDocumentService(IRepository _auditDocumentRepos public async Task CopyFileOrFolder(MovieFileOrFolderInDto inDto) { - #region 不考虑版本的话处理方式 - - ////1、当前节点的后代(包括自己) 拷贝的节点以及子节点 - //var nodeList = await _auditDocumentClosureRepository.Where(t => t.AncestorId == id).Select(t => t.Descendant).ToListAsync(); - - //// 2. 创建映射表 OldId -> NewId - //var oldToNewId = new Dictionary(); - - //// 3. 复制节点 - - //var newNodeList = nodeList.Clone(); - - //foreach (var node in newNodeList) - //{ - // var newId = NewId.NextSequentialGuid(); - - // //存储旧Id 和新Id 关系 - // oldToNewId[node.Id] = newId; - - // //设置新节点Id - // node.Id = newId; - //} - - - //// 4. 调整 ParentId 指向新 Id - //foreach (var newNode in newNodeList) - //{ - // if (newNode.ParentId.HasValue && oldToNewId.TryGetValue(newNode.ParentId.Value, out var newParentId)) - // { - // newNode.ParentId = newParentId; // 指向新父节点 - // } - // else - // { - // newNode.ParentId = inDto.ParentId; // 顶层节点指向目标父节点 - // } - //} - - //foreach (var node in newNodeList) - //{ - - // await _auditDocumentRepository.AddAsync(node); - - // //建立新的闭包关系 - // await AddClosureRelationsAsync(node.Id, inDto.ParentId); - - //} - - #endregion + foreach (var item in inDto.Ids) { From 955fe25d30e2d0b4f4082aca0a6b031cbf8cefdf Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Mon, 29 Sep 2025 15:19:34 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs b/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs index 1ae0865bb..c9d1c5426 100644 --- a/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs @@ -600,6 +600,7 @@ public class AuditDocumentService(IRepository _auditDocumentRepos throw new BusinessValidationFailedException(_localizer["AuditDocument_CanNotMove"]); } + // 不能自动到自己父类这个文件夹 if (await _auditDocumentRepository.AnyAsync(x => x.ParentId == inDto.ParentId && inDto.Ids.Contains(x.Id))) {