From 6afa8b962679ce1359a27d75d2e46d84b2550874 Mon Sep 17 00:00:00 2001
From: hang <872297557@qq.com>
Date: Fri, 22 Apr 2022 15:09:42 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8F=90=E7=A4=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
IRaCIS.Core.API/IRaCIS.Core.API.xml | 10 ++---
.../TrialSiteUser/TrialConfigService.cs | 5 ++-
.../Triggers/ChallengeStateTrigger.cs | 42 +++++++++++++++++++
3 files changed, 50 insertions(+), 7 deletions(-)
create mode 100644 IRaCIS.Core.Application/Triggers/ChallengeStateTrigger.cs
diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.xml b/IRaCIS.Core.API/IRaCIS.Core.API.xml
index afa222737..2e0673c7a 100644
--- a/IRaCIS.Core.API/IRaCIS.Core.API.xml
+++ b/IRaCIS.Core.API/IRaCIS.Core.API.xml
@@ -159,11 +159,11 @@
-
-
-
-
-
+
+ 影像转发
+
+
+
diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs
index 274a745ab..ee38855d6 100644
--- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs
+++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialConfigService.cs
@@ -170,9 +170,10 @@ namespace IRaCIS.Core.Application
[HttpGet("{trialId:guid}")]
public async Task IfTrialCanOngoing(Guid trialId)
{
- return ResponseOutput.Ok(await _trialRepository.AnyAsync(trial =>
+ var canOPt = await _trialRepository.AnyAsync(trial =>
trial.Id == trialId && trial.IsTrialBasicLogicConfirmed && trial.IsTrialProcessConfirmed &&
- trial.IsTrialUrgentConfirmed && trial.VisitPlanConfirmed));
+ trial.IsTrialUrgentConfirmed && trial.VisitPlanConfirmed);
+ return ResponseOutput.Ok(canOPt, msg: canOPt?"": "项目 基础配置、流程配置、加急配置 、访视计划,有未确认项");
}
///
diff --git a/IRaCIS.Core.Application/Triggers/ChallengeStateTrigger.cs b/IRaCIS.Core.Application/Triggers/ChallengeStateTrigger.cs
new file mode 100644
index 000000000..99b0342db
--- /dev/null
+++ b/IRaCIS.Core.Application/Triggers/ChallengeStateTrigger.cs
@@ -0,0 +1,42 @@
+using EntityFrameworkCore.Triggered;
+using IRaCIS.Core.Domain.Share;
+
+namespace IRaCIS.Core.Application.Triggers
+{
+ public class ChallengeStateTrigger : IAfterSaveTrigger
+ {
+ private readonly IRepository _repository;
+
+ public ChallengeStateTrigger(IRepository repository)
+ {
+ _repository = repository;
+ }
+
+ public async Task AfterSave(ITriggerContext context, CancellationToken cancellationToken)
+ {
+ var subjectVisitId = context.Entity.SubjectVisitId;
+
+ ChallengeStateEnum subjectVisitChallengeState = default;
+
+
+ var closedStateList = await _repository.Where(t => t.SubjectVisitId == subjectVisitId).Select(t => t.IsClosed).ToListAsync();
+
+ if (closedStateList.Count == 0)
+ {
+ subjectVisitChallengeState = ChallengeStateEnum.No;
+ }
+ else if (closedStateList.All(t => t is true))
+ {
+ subjectVisitChallengeState = ChallengeStateEnum.HaveAndAllClosed;
+ }
+ else
+ {
+ subjectVisitChallengeState = ChallengeStateEnum.HaveAndHaveNotClosed;
+ }
+
+
+ await _repository.BatchUpdateAsync(t => t.Id == subjectVisitId,
+ u => new SubjectVisit() { ChallengeState = subjectVisitChallengeState });
+ }
+ }
+}
\ No newline at end of file