diff --git a/IRaCIS.Core.API/HostService/HangfireHostService.cs b/IRaCIS.Core.API/HostService/HangfireHostService.cs
index 478d883b9..c522c2eb4 100644
--- a/IRaCIS.Core.API/HostService/HangfireHostService.cs
+++ b/IRaCIS.Core.API/HostService/HangfireHostService.cs
@@ -56,7 +56,7 @@ public class HangfireHostService(IRecurringMessageScheduler _recurringMessageSch
}
}
-
+ // 项目手动选择,周期性邮件
var taskInfoList = await _trialEmailNoticeConfigRepository.Where(t => t.Trial.TrialStatusStr == StaticData.TrialState.TrialOngoing && t.EmailCron != string.Empty && t.IsAutoSend)
.Select(t => new { t.Id, t.Code, TrialCode = t.Trial.TrialCode, t.EmailCron, t.BusinessScenarioEnum, t.TrialId })
.ToListAsync();
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index a52150858..b4b04a860 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -1517,6 +1517,14 @@
+
+
+ GPT 移动子树代码--适合一次提交事务
+
+
+
+
+
插入闭包表关系
diff --git a/IRaCIS.Core.Application/MassTransit/Recurring/QCRecurringEmailConsumer.cs b/IRaCIS.Core.Application/MassTransit/Recurring/QCRecurringEmailConsumer.cs
index 84ee27d3a..d2b39f2dc 100644
--- a/IRaCIS.Core.Application/MassTransit/Recurring/QCRecurringEmailConsumer.cs
+++ b/IRaCIS.Core.Application/MassTransit/Recurring/QCRecurringEmailConsumer.cs
@@ -14,7 +14,7 @@ using System.Threading.Tasks;
namespace IRaCIS.Core.Application.MassTransit.Consumer;
-
+//项目手动选择 周期性邮件
///
diff --git a/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs b/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs
index c9d1c5426..852302cc4 100644
--- a/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs
+++ b/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs
@@ -23,6 +23,7 @@ using IRaCIS.Core.Application.Contracts;
using Microsoft.EntityFrameworkCore;
using static Microsoft.Extensions.Logging.EventSource.LoggingEventSource;
using NPOI.SS.Formula.Functions;
+using EFCore.BulkExtensions;
namespace IRaCIS.Core.Application.Service;
@@ -234,6 +235,60 @@ public class AuditDocumentService(IRepository _auditDocumentRepos
#region 闭包修改
+ ///
+ /// GPT 移动子树代码--适合一次提交事务
+ ///
+ ///
+ ///
+ ///
+ private async Task MoveSubtreeAsync(Guid subtreeRootId, Guid? newParentId)
+ {
+
+ // 1. 子树所有闭包关系(后代包含自身)
+ var subtreeClosures = await _auditDocumentClosureRepository
+ .Where(c => c.AncestorId == subtreeRootId)
+ .ToListAsync();
+
+ var descendantIdsQuery = _auditDocumentClosureRepository
+ .Where(c => c.AncestorId == subtreeRootId).Select(c => c.DescendantId);
+
+ // 2. 删除原有祖先关系,保留自反关系和子树内部关系
+ await _auditDocumentClosureRepository.BatchDeleteNoTrackingAsync(c =>
+ descendantIdsQuery.Contains(c.DescendantId) &&
+ c.AncestorId != c.DescendantId && // 保留自反关系
+ !descendantIdsQuery.Contains(c.AncestorId) // 保留子树内部关系
+ );
+
+ // 3. 查新父节点祖先
+ var newParentClosures = newParentId.HasValue
+ ? await _auditDocumentClosureRepository
+ .Where(c => c.DescendantId == newParentId.Value)
+ .ToListAsync()
+ : new List();
+
+ // 4. 生成新关系
+ var newClosures = new List();
+
+ foreach (var pc in newParentClosures)
+ {
+ foreach (var sc in subtreeClosures)
+ {
+ newClosures.Add(new AuditDocumentClosure
+ {
+ AncestorId = pc.AncestorId,
+ DescendantId = sc.DescendantId,
+ Depth = pc.Depth + sc.Depth + 1 //深度公式:新深度 = 父祖先深度 + 子树原深度 + 1
+ });
+ }
+ }
+
+ // 5. 插入新关系
+ await _auditDocumentClosureRepository.AddRangeAsync(newClosures);
+ await _auditDocumentClosureRepository.SaveChangesAsync();
+
+ }
+
+
///
/// 插入闭包表关系
///
@@ -600,8 +655,19 @@ public class AuditDocumentService(IRepository _auditDocumentRepos
throw new BusinessValidationFailedException(_localizer["AuditDocument_CanNotMove"]);
}
+ #region 不考虑文件名重复 移动子树快速方法
+ //foreach (var item in inDto.Ids)
+ //{
+ // var subtreeRoot = await _auditDocumentRepository.FirstOrDefaultAsync(t => t.Id == item);
- // 不能自动到自己父类这个文件夹
+ // subtreeRoot.ParentId = inDto.ParentId;
+
+ // await MoveSubtreeAsync(item, inDto.ParentId);
+ //}
+ #endregion
+
+
+ // 不能移动到自己父类这个文件夹
if (await _auditDocumentRepository.AnyAsync(x => x.ParentId == inDto.ParentId && inDto.Ids.Contains(x.Id)))
{
throw new BusinessValidationFailedException(_localizer["AuditDocument_CanNotMoveToParent"]);
diff --git a/IRaCIS.Core.Infra.EFCore/Interceptor/AddDomainExt.cs b/IRaCIS.Core.Infra.EFCore/Interceptor/AddDomainExt.cs
index 64fbc4f1a..f5e5b09f6 100644
--- a/IRaCIS.Core.Infra.EFCore/Interceptor/AddDomainExt.cs
+++ b/IRaCIS.Core.Infra.EFCore/Interceptor/AddDomainExt.cs
@@ -25,7 +25,7 @@ public static class DBContext_Ext
//记录要保存到数据库的事件
var eventStoreList = new List();
- #region 中心调研邮件通知
+ #region 项目默认发送-- 中心调研邮件通知
foreach (var entry in changeTracker.Entries())
{
@@ -64,7 +64,7 @@ public static class DBContext_Ext
#endregion
- #region PD 入组发送邮件(不侵入之前的代码,有些判断过于复杂的,在代码里面有的,就手动 在跟踪的实体添加领域事件)
+ #region 项目手动选择发送--PD 入组发送邮件(不侵入之前的代码,有些判断过于复杂的,在代码里面有的,就手动 在跟踪的实体添加领域事件)
foreach (var entry in changeTracker.Entries())
{
@@ -385,7 +385,7 @@ public static class DBContext_Ext
#endregion
- #region 直接申请流程重传
+ #region 项目默认发送--直接申请流程重传
foreach (var entry in changeTracker.Entries())
{
@@ -424,7 +424,7 @@ public static class DBContext_Ext
#endregion
- #region 阅片人筛选
+ #region 项目默认发送--阅片人筛选
var spmApproveEnrollIdList = new List();
var pmApplyEnrollIdList = new List();