From 281b5d2177baff147c7ebbb17120570c0462f7f5 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Tue, 26 Nov 2024 16:46:53 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Helper/FileDocProcess/ExcelExportHelper.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs b/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs index 879db8897..b97c0e8b4 100644 --- a/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs +++ b/IRaCIS.Core.Application/Helper/FileDocProcess/ExcelExportHelper.cs @@ -77,7 +77,8 @@ public static class ExcelExportHelper //处理集合里面时间类型,根据当前语言将时间转变为字符串 foreach (var itemValuePair in itemDic) { - if (DateTime.TryParse(itemValuePair.Value?.ToString(), out DateTime result)) + // 临床数据 1,1 会变成2024-01-01 + if (itemValuePair.Value?.ToString().Length > 4 && DateTime.TryParse(itemValuePair.Value?.ToString(), out DateTime result)) { itemDic[itemValuePair.Key] = ExportExcelConverterDate.DateTimeInternationalToString(result); } @@ -337,7 +338,7 @@ public static class ExcelExportHelper //处理集合里面时间类型,根据当前语言将时间转变为字符串 foreach (var itemValuePair in itemDic) { - if (DateTime.TryParse(itemValuePair.Value?.ToString(), out DateTime result)) + if (itemValuePair.Value?.ToString().Length > 4 && DateTime.TryParse(itemValuePair.Value?.ToString(), out DateTime result)) { itemDic[itemValuePair.Key] = ExportExcelConverterDate.DateTimeInternationalToString(result); } From 017babde86f7520f818f4d8327f44621a5c3258b Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 27 Nov 2024 14:53:35 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Document/TrialEmailNoticeConfigService.cs | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs index c5c0c92d2..2e2ed156e 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs @@ -1244,7 +1244,7 @@ namespace IRaCIS.Core.Application.Service { var trialConfig = _trialRepository.Where(t => t.Id == inQuery.TrialId).Select(t => new { t.IsEnrollementQualificationConfirm, t.IsPDProgressView }).First(); - var emailNoticeConfigQueryable = _emailNoticeConfigRepository.Where(t=>t.BusinessLevelEnum==BusinessLevel.Trial) + var emailNoticeConfigQueryable = _emailNoticeConfigRepository.Where(t => t.BusinessLevelEnum == BusinessLevel.Trial) .WhereIf(inQuery.BusinessScenarioEnum != null, t => t.BusinessScenarioEnum == inQuery.BusinessScenarioEnum) .WhereIf(inQuery.IsReturnRequired != null, t => t.IsReturnRequired == inQuery.IsReturnRequired) .WhereIf(inQuery.IsEnable != null, t => t.IsEnable == inQuery.IsEnable) @@ -1348,6 +1348,19 @@ namespace IRaCIS.Core.Application.Service await _trialEmailNoticeConfigRepository.SaveChangesAsync(); + //处理定时任务 + var taskInfoList = await _trialEmailNoticeConfigRepository.Where(t => t.TrialId== trialId && t.EmailCron != string.Empty && t.IsAutoSend) + .Select(t => new { t.Id, t.Code, TrialCode = t.Trial.TrialCode, t.EmailCron, t.BusinessScenarioEnum, t.TrialId }) + .ToListAsync(); + + foreach (var task in taskInfoList) + { + //利用主键作为任务Id + var jobId = $"{task.TrialId}({task.TrialCode})_({task.BusinessScenarioEnum})"; + + HangfireJobHelper.AddOrUpdateTrialCronJob(jobId, trialId, task.BusinessScenarioEnum, task.EmailCron); + } + return ResponseOutput.Ok(); @@ -1453,7 +1466,12 @@ namespace IRaCIS.Core.Application.Service await _trialEmailNoticeConfigRepository.SaveChangesAsync(); - var jobId = $"{addOrEditTrialEmailNoticeConfig.TrialId}_{id}"; + var cronInfo = await _trialEmailNoticeConfigRepository.Where(t => t.Id == addOrEditTrialEmailNoticeConfig.Id) + .Select(t => new { t.Id, t.Code, TrialCode = t.Trial.TrialCode, t.EmailCron, t.BusinessScenarioEnum, t.TrialId }) + .FirstAsync(); + + var jobId = $"{cronInfo.TrialId}({cronInfo.TrialCode})_({cronInfo.BusinessScenarioEnum})"; + if (addOrEditTrialEmailNoticeConfig.IsAutoSend) { From 38b661da0183a2ab58fb2eafbd5499989bec7f7d Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 27 Nov 2024 15:01:27 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=20=E7=A7=BB=E9=99=A4=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Document/TrialEmailNoticeConfigService.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs index 2e2ed156e..e54aaf023 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs @@ -1593,8 +1593,12 @@ namespace IRaCIS.Core.Application.Service [HttpDelete("{trialEmailNoticeConfigId:guid}")] public async Task DeleteTrialEmailNoticeConfig(Guid trialEmailNoticeConfigId) { - var trialId = await _trialEmailNoticeConfigRepository.Where(t => t.Id == trialEmailNoticeConfigId).Select(t => t.TrialId).FirstOrDefaultAsync(); - var jobId = $"{trialId}_{trialEmailNoticeConfigId}"; + + var cronInfo = await _trialEmailNoticeConfigRepository.Where(t => t.Id == trialEmailNoticeConfigId) + .Select(t => new { t.Id, t.Code, TrialCode = t.Trial.TrialCode, t.EmailCron, t.BusinessScenarioEnum, t.TrialId }) + .FirstAsync(); + + var jobId = $"{cronInfo.TrialId}({cronInfo.TrialCode})_({cronInfo.BusinessScenarioEnum})"; HangfireJobHelper.RemoveCronJob(jobId); From a1588273e8d77344444d0b0059182ac27ba41c62 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 27 Nov 2024 15:59:22 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=AF=BC=E8=A1=A8=E9=98=85=E7=89=87?= =?UTF-8?q?=E6=9C=9F=E8=A3=81=E5=88=A4=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.Application/Service/Common/ExcelExportService.cs | 2 ++ IRaCIS.Core.Application/Service/QC/_MapConfig.cs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs index 03a7dbd43..a8ca5b3b2 100644 --- a/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs +++ b/IRaCIS.Core.Application/Service/Common/ExcelExportService.cs @@ -1493,6 +1493,8 @@ namespace IRaCIS.Core.Application.Service.Common if (findJudge.ReadingTaskState == ReadingTaskState.HaveSigned) { item.IsJudgeSelect = findJudge.JudgeArmEnum == item.ArmEnum ? true : false; + + item.JudgeNote = findJudge.JudgeArmEnum == item.ArmEnum ? findJudge.JudgeNote : string.Empty; } else { diff --git a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs index b389ebbaa..c8f0760cd 100644 --- a/IRaCIS.Core.Application/Service/QC/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/QC/_MapConfig.cs @@ -255,7 +255,7 @@ namespace IRaCIS.Core.Application.Service (arbitrationRule == ArbitrationRule.Reading ? u.Subject.SubjectVisitTaskList.Any(t => t.TaskState == TaskState.Effect && t.IsAnalysisCreate == false && t.ReadingCategory == ReadingCategory.Judge && t.TrialReadingCriterionId == trialReadingCriterionId && u.VisitTaskNum < t.VisitTaskNum) : false))) - .ForMember(o => o.JudgeNote, t => t.MapFrom(u => u.JudgeVisitTask.JudgeResultRemark)) + .ForMember(o => o.JudgeNote, t => t.MapFrom(u => u.ReadingCategory==ReadingCategory.Judge? u.JudgeResultRemark : u.JudgeVisitTask.JudgeResultRemark)) .ForMember(o => o.VisitNote, t => t.MapFrom(u => u.ReadingTaskQuestionAnswerList.Where(c => c.ReadingQuestionTrial.QuestionType == QuestionType.AdjustReason).FirstOrDefault()!.Answer)) .ForMember(o => o.TrialSiteCode, t => t.MapFrom(u => u.Subject.TrialSite.TrialSiteCode)) .ForMember(o => o.SubjectCode, t => t.MapFrom(u => u.Subject.Code)) From 1b9eeba5bad79ecd709af4452b5ca734c33a41d3 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 27 Nov 2024 17:10:23 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E8=B0=83=E7=A0=94=E8=A1=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MassTransit/Consumer/SiteSurverEmailConsumer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs b/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs index 21d16c2f7..d1734d2e1 100644 --- a/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Consumer/SiteSurverEmailConsumer.cs @@ -110,7 +110,7 @@ public class UserSiteSurveySubmitedEventConsumer( return (topicStr, htmlBodyStr); }; - var scenario = _trialSiteSurveyRepository.Any(t => t.Id != trialSiteSurveyId && t.TrialId == siteSurveyInfo.TrialId && t.TrialSiteId == siteSurveyInfo.TrialSiteId) ? + var scenario = _trialSiteSurveyRepository.Where(t => t.Id != trialSiteSurveyId && t.TrialId == siteSurveyInfo.TrialId && t.TrialSiteId == siteSurveyInfo.TrialSiteId).IgnoreQueryFilters().Any() ? EmailBusinessScenario.Approval_UpdateSiteSurvey : EmailBusinessScenario.Approval_SubmitSiteSurvey; await CommonEmailHelper.GetEmailSubejctAndHtmlInfoAndBuildAsync(_emailNoticeConfigrepository, scenario, messageToSend, emailConfigFunc); From 156db9f6c579dcc85c2be0a410e6ada6f88261b5 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 27 Nov 2024 17:39:45 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B4=A6=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Triggers/BeforeSaveTrigger/UserLogTrigger.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/UserLogTrigger.cs b/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/UserLogTrigger.cs index e80a06385..3adc7fcfd 100644 --- a/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/UserLogTrigger.cs +++ b/IRaCIS.Core.Application/Triggers/BeforeSaveTrigger/UserLogTrigger.cs @@ -34,7 +34,12 @@ namespace IRaCIS.Core.Application.Triggers { var user = context.Entity; - await _userLogReposiotry.AddAsync(new UserLog() { OptType = UserOptType.AddUser, OptUserId = user.Id, LoginUserId = _userInfo.Id, IP = _userInfo.IP }); + if (context.ChangeType == ChangeType.Added) + { + await _userLogReposiotry.AddAsync(new UserLog() { OptType = UserOptType.AddUser, OptUserId = user.Id, LoginUserId = _userInfo.Id, IP = _userInfo.IP }); + + } + } } }