From 95a84bb330888ab83b936ceeeb50774c905ba15e Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Fri, 27 Sep 2024 17:42:37 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=8E=E5=A4=84?=
=?UTF-8?q?=E7=90=86=E4=B8=8A=E4=BC=A0=E7=9A=84=E6=A3=80=E6=9F=A5modality?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 8 ++++++++
.../ImageAndDoc/DownloadAndUploadService.cs | 14 ++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 794eb3962..19b4bacde 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -1527,6 +1527,14 @@
+
+
+ 更新后处理上传的检查modality
+
+
+
+
+
受试者级别所有的影像
diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs
index 70e3455d0..956605827 100644
--- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs
+++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs
@@ -1131,6 +1131,20 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
return await query.ToPagedListAsync(inQuery);
}
+ ///
+ /// 更新后处理上传的检查modality
+ ///
+ ///
+ ///
+ ///
+ [HttpPut]
+ public async Task UpdateTaskStudyModality(Guid taskStudyId, string modality)
+ {
+ await _taskStudyRepository.UpdatePartialFromQueryAsync(t => t.Id == taskStudyId, u => new TaskStudy() { ModalityForEdit = modality }, true);
+ return ResponseOutput.Ok();
+ }
+
+
#region 之前后端下载废弃
From 1bacc222be5d664815d426efe2e4345c345bc091 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Fri, 27 Sep 2024 18:06:05 +0800
Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BF=94=E5=9B=9E?=
=?UTF-8?q?=E9=A1=B9=E7=9B=AEmodality?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../IRaCIS.Core.Application.xml | 32 ++++++-----------
.../ImageAndDoc/DownloadAndUploadService.cs | 4 +--
.../JudgeVisitTaskTrigger.cs | 36 +++++++------------
3 files changed, 26 insertions(+), 46 deletions(-)
rename IRaCIS.Core.Application/Triggers/{ => AfterSaveTrigger}/JudgeVisitTaskTrigger.cs (59%)
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index 19b4bacde..ed0344dd6 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -16120,6 +16120,17 @@
+
+
+ 因为维护状态先后顺序导致 裁判任务关联的 任务上的JudgeVisitTaskId==nulll 在这里需要重新设置下
+
+ 比如 两个任务产生了裁判,然后其中一个人申请了重阅,影响了裁判,需要清理之前任务的上裁判id (申请重阅,退回,里面分有序,无序,情况太多,所以不在那块逻辑修改,不然得加多个地方处理,在这里统一处理)
+ 比如: 申请裁判任务重阅,事务里面本来设置了任务上的裁判id,但是因为下面的逻辑,导致设置的值又被清理了,只能重新设置下
+
+
+
+
+
因为可能先一致性核查通过,生成其他标准的任务了,新签名的标准也需要产生任务
@@ -16140,27 +16151,6 @@
维护 IsFrontTaskNeedSignButNotSign 字段 另外附加评估结果
-
-
- 因为维护状态先后顺序导致 裁判任务关联的 任务上的JudgeVisitTaskId==nulll 在这里需要重新设置下
-
- 比如: 申请裁判任务重阅,事务里面本来设置了任务上的裁判id,但是因为下面的逻辑,导致设置的值又被清理了,只能重新设置下
-
-
-
-
-
-
-
- 比如 两个任务产生了裁判,然后其中一个人申请了重阅,影响了裁判,需要清理之前任务的上裁判id
-
-
- 因为申请重阅,退回,里面分有序,无序,情况太多,所以不在那块逻辑修改,不然得加多个地方处理,在这里统一处理
-
-
-
-
-
添加访视计划 要给改项目下的所有Subject 添加该访视
diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs
index 956605827..4f1695a86 100644
--- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs
+++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs
@@ -117,7 +117,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
//要根据标准阅片顺序,确定是否查询单个任务的,还是查询所有的
var criterionInfo = await _readingQuestionCriterionTrialRepository.Where(t => t.Id == inQuery.TrialReadingCriterionId)
- .Select(t => new { t.IsReadingTaskViewInOrder }).FirstNotNullAsync();
+ .Select(t => new { t.IsReadingTaskViewInOrder, t.Trial.Modalitys }).FirstNotNullAsync();
var subjectCode = string.Empty;
var subjectId = inQuery.SubjectId;
@@ -217,7 +217,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc
var list = await query.Where(t => t.SubjectCode == subjectCode).ToListAsync();
- return ResponseOutput.Ok(list);
+ return ResponseOutput.Ok(list, new { TrialModality = criterionInfo.Modalitys });
}
private void SpecialArchiveStudyDeal(TaskStudy study)
diff --git a/IRaCIS.Core.Application/Triggers/JudgeVisitTaskTrigger.cs b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/JudgeVisitTaskTrigger.cs
similarity index 59%
rename from IRaCIS.Core.Application/Triggers/JudgeVisitTaskTrigger.cs
rename to IRaCIS.Core.Application/Triggers/AfterSaveTrigger/JudgeVisitTaskTrigger.cs
index e4c907da0..cbade7176 100644
--- a/IRaCIS.Core.Application/Triggers/JudgeVisitTaskTrigger.cs
+++ b/IRaCIS.Core.Application/Triggers/AfterSaveTrigger/JudgeVisitTaskTrigger.cs
@@ -6,7 +6,7 @@ namespace IRaCIS.Core.Application.Triggers
public class JudgeVisitTaskTrigger(
IRepository _visitTaskRepository,
- IRepository _readingJudgeInfoRepository) : IBeforeSaveTrigger, IAfterSaveTrigger
+ IRepository _readingJudgeInfoRepository) : IAfterSaveTrigger
{
@@ -14,6 +14,7 @@ namespace IRaCIS.Core.Application.Triggers
///
/// 因为维护状态先后顺序导致 裁判任务关联的 任务上的JudgeVisitTaskId==nulll 在这里需要重新设置下
///
+ /// 比如 两个任务产生了裁判,然后其中一个人申请了重阅,影响了裁判,需要清理之前任务的上裁判id (申请重阅,退回,里面分有序,无序,情况太多,所以不在那块逻辑修改,不然得加多个地方处理,在这里统一处理)
/// 比如: 申请裁判任务重阅,事务里面本来设置了任务上的裁判id,但是因为下面的逻辑,导致设置的值又被清理了,只能重新设置下
///
///
@@ -23,34 +24,22 @@ namespace IRaCIS.Core.Application.Triggers
{
var visitTask = context.Entity;
//裁判任务维护,当裁判任务受到影响的时候,需要清理任务上关联的裁判任务id
- if (context.ChangeType == ChangeType.Added && visitTask.ReadingCategory == ReadingCategory.Judge && visitTask.TaskState == TaskState.Effect)
+ if (context.ChangeType == ChangeType.Added)
{
- var find = _readingJudgeInfoRepository.Where(t => t.JudgeTaskId == visitTask.Id).FirstOrDefault();
-
- if (find != null)
+ if (visitTask.ReadingCategory == ReadingCategory.Judge && visitTask.TaskState == TaskState.Effect)
{
- var ids = new Guid[] { find.TaskIdOne, find.TaskIdTwo };
- await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => ids.Contains(t.Id), u => new VisitTask() { JudgeVisitTaskId = visitTask.Id });
+ var find = _readingJudgeInfoRepository.Where(t => t.JudgeTaskId == visitTask.Id).FirstOrDefault();
+
+ if (find != null)
+ {
+ var ids = new Guid[] { find.TaskIdOne, find.TaskIdTwo };
+ await _visitTaskRepository.BatchUpdateNoTrackingAsync(t => ids.Contains(t.Id), u => new VisitTask() { JudgeVisitTaskId = visitTask.Id });
+ }
}
}
- }
-
- ///
- /// 比如 两个任务产生了裁判,然后其中一个人申请了重阅,影响了裁判,需要清理之前任务的上裁判id
- ///
- ///
- /// 因为申请重阅,退回,里面分有序,无序,情况太多,所以不在那块逻辑修改,不然得加多个地方处理,在这里统一处理
- ///
- ///
- ///
- ///
- public async Task BeforeSave(ITriggerContext context, CancellationToken cancellationToken)
- {
- var visitTask = context.Entity;
- //裁判任务维护,当裁判任务受到影响的时候,需要清理任务上关联的裁判任务id
- if (context.ChangeType == ChangeType.Modified)
+ else if (context.ChangeType == ChangeType.Modified)
{
if (visitTask.ReadingCategory == ReadingCategory.Judge && (visitTask.TaskState == TaskState.Adbandon || visitTask.TaskState == TaskState.HaveReturned))
{
@@ -64,5 +53,6 @@ namespace IRaCIS.Core.Application.Triggers
}
}
}
+
}
}
\ No newline at end of file
From 7693c72802bfba49dcc331a6fd56315bc814953c Mon Sep 17 00:00:00 2001
From: hang <87227557@qq.com>
Date: Sat, 28 Sep 2024 21:21:52 +0800
Subject: [PATCH 3/3] =?UTF-8?q?MasstransitMeditor=20=E4=B8=8D=E5=9C=A8efco?=
=?UTF-8?q?re=20=E5=90=8C=E4=B8=80=E4=B8=AA=E4=BA=8B=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
IRaCIS.Core.API/Progranm.cs | 1 +
.../IRaCIS.Core.Application.xml | 6 ++--
.../NeedVerify/AddSubjectTriggerConsumer.cs | 4 +--
IRaCIS.Core.Application/TestService.cs | 13 +++++++++
.../Triggers/SubjectTrigger.cs | 1 -
IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs | 5 +---
.../Interceptor/AuditEntityInterceptor.cs | 28 ++++++-------------
7 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/IRaCIS.Core.API/Progranm.cs b/IRaCIS.Core.API/Progranm.cs
index e90cbe6c8..89c40314f 100644
--- a/IRaCIS.Core.API/Progranm.cs
+++ b/IRaCIS.Core.API/Progranm.cs
@@ -151,6 +151,7 @@ builder.Services.AddMediator(cfg =>
{
cfg.AddConsumer();
cfg.AddConsumer();
+ cfg.AddConsumer();
});
// 添加 MassTransit 和 InMemory 传输
diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
index ed0344dd6..0a897fe0a 100644
--- a/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
+++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.xml
@@ -12658,7 +12658,8 @@
- 添加Subject 触发添加访视 不能代替 Trigger,稽查BatchId 不一致 暂时废弃
+ 添加Subject 触发添加访视 不能代替 Trigger,稽查BatchId 不一致
+ 因为消费者这里的数据库上下文 和消息发送者上下文不是同一个,相当于两个独立的事务
@@ -12667,7 +12668,8 @@
- 添加Subject 触发添加访视 不能代替 Trigger,稽查BatchId 不一致 暂时废弃
+ 添加Subject 触发添加访视 不能代替 Trigger,稽查BatchId 不一致
+ 因为消费者这里的数据库上下文 和消息发送者上下文不是同一个,相当于两个独立的事务
diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/NeedVerify/AddSubjectTriggerConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/NeedVerify/AddSubjectTriggerConsumer.cs
index 3e9ef7abc..3a2e67594 100644
--- a/IRaCIS.Core.Application/MassTransit/Consumer/NeedVerify/AddSubjectTriggerConsumer.cs
+++ b/IRaCIS.Core.Application/MassTransit/Consumer/NeedVerify/AddSubjectTriggerConsumer.cs
@@ -7,7 +7,8 @@ using MassTransit;
namespace IRaCIS.Core.Application.MassTransit.Consumer;
///
-/// 添加Subject 触发添加访视 不能代替 Trigger,稽查BatchId 不一致 暂时废弃
+/// 添加Subject 触发添加访视 不能代替 Trigger,稽查BatchId 不一致
+/// 因为消费者这里的数据库上下文 和消息发送者上下文不是同一个,相当于两个独立的事务
///
///
///
@@ -41,6 +42,5 @@ public class AddSubjectTriggerConsumer(IRepository _subjectVisitRe
});
await _subjectVisitRepository.AddRangeAsync(svList);
- await _subjectVisitRepository.SaveChangesAsync();
}
}
diff --git a/IRaCIS.Core.Application/TestService.cs b/IRaCIS.Core.Application/TestService.cs
index 0c91dbb43..65c5d8134 100644
--- a/IRaCIS.Core.Application/TestService.cs
+++ b/IRaCIS.Core.Application/TestService.cs
@@ -4,11 +4,13 @@ using IRaCIS.Core.Application.BusinessFilter;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.ViewModel;
+using IRaCIS.Core.Domain;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using IRaCIS.Core.Infrastructure.Encryption;
using IRaCIS.Core.Infrastructure.NewtonsoftJson;
using MassTransit;
+using MassTransit.Mediator;
using Medallion.Threading;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
@@ -119,6 +121,17 @@ namespace IRaCIS.Core.Application.Service
}
+ public async Task TestMasstransitMeditor([FromServices] IMediator _mediator, [FromServices] IRepository _testLengthRepository)
+ {
+ await _testLengthRepository.AddAsync(new TestLength() { Name = "zhouhang1" });
+
+ await _mediator.Send(new AddSubjectTriggerCommand { SubjectId = Guid.Empty });
+
+ await _testLengthRepository.SaveChangesAsync();
+
+ return ResponseOutput.Ok();
+ }
+
public async Task TestJson()
{
var model1 = new TestModel() { TestId = NewId.NextSequentialGuid(), TestName = null };
diff --git a/IRaCIS.Core.Application/Triggers/SubjectTrigger.cs b/IRaCIS.Core.Application/Triggers/SubjectTrigger.cs
index 0f936accf..3cddab770 100644
--- a/IRaCIS.Core.Application/Triggers/SubjectTrigger.cs
+++ b/IRaCIS.Core.Application/Triggers/SubjectTrigger.cs
@@ -117,7 +117,6 @@ namespace IRaCIS.Core.Application.Triggers
await _subjectVisitRepository.AddRangeAsync(svList);
- //await _subjectVisitRepository.SaveChangesAsync();
}
diff --git a/IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs b/IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs
index ff8da5068..27c54d5ac 100644
--- a/IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs
+++ b/IRaCIS.Core.Domain/BaseModel/IAuditAdd.cs
@@ -11,7 +11,4 @@ public interface IAuditAdd : IAuditAdd
}
-public interface IAuditAddWithUserName : IAuditAdd
-{
- public string CreateUser { get; set; }
-}
+
diff --git a/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs b/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs
index 750e96ae8..a97b5a65d 100644
--- a/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs
+++ b/IRaCIS.Core.Infra.EFCore/Interceptor/AuditEntityInterceptor.cs
@@ -12,7 +12,7 @@ using System.Data;
namespace IRaCIS.Core.Infra.EFCore;
-public class AuditEntityInterceptor(IUserInfo _userInfo,
+public class AuditEntityInterceptor(IUserInfo _userInfo,
ILogger _logger
, IMediator _mediator
) : SaveChangesInterceptor
@@ -28,9 +28,9 @@ public class AuditEntityInterceptor(IUserInfo _userInfo,
public override ValueTask> SavingChangesAsync(DbContextEventData eventData,
InterceptionResult result, CancellationToken cancellationToken = default)
{
- ////领域命令 (同一个事务提交的一些逻辑,类似Trigger 保存事务之前执行的一些逻辑)
+ //////领域命令 (同一个事务提交的一些逻辑,类似Trigger 保存事务之前执行的一些逻辑)
//eventData.Context.AddDomainCommands();
- //DispatchDomainCommands(eventData.Context).GetAwaiter().GetResult();
+ //await DispatchDomainCommands(eventData.Context);
//领域事件
eventData.Context.AddDomainEvents();
@@ -41,6 +41,8 @@ public class AuditEntityInterceptor(IUserInfo _userInfo,
//IRC稽查 放在savechange 之前 不影响之前的逻辑
IRCDataInspection(eventData.Context);
+ //return result;
+
return base.SavingChangesAsync(eventData, result, cancellationToken);
}
public override InterceptionResult SavingChanges(DbContextEventData eventData, InterceptionResult result)
@@ -55,6 +57,8 @@ public class AuditEntityInterceptor(IUserInfo _userInfo,
//IRC稽查 放在savechange 之前 不影响之前的逻辑
IRCDataInspection(eventData.Context);
+ //return result;
+
return base.SavingChanges(eventData, result);
}
public void AuditEntities(DbContext? context)
@@ -122,22 +126,6 @@ public class AuditEntityInterceptor(IUserInfo _userInfo,
updateEntity.UpdateTime = DateTime.Now;
updateEntity.UpdateUserId = _userInfo.Id;
}
-
- if (entry.Entity is IAuditAddWithUserName addEntity3)
- {
- if (addEntity3.CreateTime == default(DateTime))
- {
- addEntity3.CreateTime = DateTime.Now;
-
- }
- if (addEntity3.CreateUserId == default(Guid))
- {
- addEntity3.CreateUserId = _userInfo.Id;
- addEntity3.CreateUser = _userInfo.RealName;
- }
-
-
- }
break;
}
}
@@ -164,7 +152,6 @@ public class AuditEntityInterceptor(IUserInfo _userInfo,
#region 异常处理
- #endregion
private void LoggerDBContextException(DbContextErrorEventData eventData)
{
@@ -225,6 +212,7 @@ public class AuditEntityInterceptor(IUserInfo _userInfo,
base.SaveChangesFailed(eventData);
}
+ #endregion
#region 领域命令分发