From cc6994e238ebc210340bb42736c5cb7adc0ebe73 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Fri, 14 Jul 2023 11:29:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=AD=E5=BF=83=E8=B0=83?= =?UTF-8?q?=E7=A0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Document/TrialEmailNoticeConfigService.cs | 2 -- .../Service/SiteSurvey/TrialSiteSurveyService.cs | 16 +++++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs index d8cf4d9fa..123865327 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialEmailNoticeConfigService.cs @@ -176,8 +176,6 @@ namespace IRaCIS.Core.Application.Service } - - public async Task CommonBusinessScenarioSendEmailAsync(Guid visitTaskId, bool? isEnrollment, bool? isPDConfirm) { #region 区分场景 diff --git a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs index 83162ecf6..52463445d 100644 --- a/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs +++ b/IRaCIS.Core.Application/Service/SiteSurvey/TrialSiteSurveyService.cs @@ -736,12 +736,20 @@ namespace IRaCIS.Core.Application.Contracts var trialSiteSurvey = (await _trialSiteSurveyRepository.Where(t => t.Id == trialSiteSurveyId).FirstOrDefaultAsync()).IfNullThrowException(); - var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId==trialId && t.TrialSiteSurvey.SiteId == trialSiteSurvey.SiteId && t.TrialSiteSurvey.IsDeleted==false).Select(t => new { t.TrialSiteSurveyId, t.IsGenerateAccount, t.IsGenerateSuccess, t.UserTypeId, - UserTypeEnum= (UserTypeEnum?) t.UserTypeRole.UserTypeEnum , t.TrialRoleName.Code }).ToListAsync(); + var siteUserList = await _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurvey.TrialId==trialId && t.TrialSiteSurvey.SiteId == trialSiteSurvey.SiteId && t.TrialSiteSurvey.IsDeleted==false).Select(t => + new { t.TrialSiteSurveyId, t.IsGenerateAccount, t.IsGenerateSuccess, t.UserTypeId, + UserTypeEnum= (UserTypeEnum?) t.UserTypeRole.UserTypeEnum , t.TrialRoleName.Code,t.Email }).ToListAsync(); + foreach (var group in (siteUserList.GroupBy(t => new { t.Email, t.IsGenerateAccount, t.UserTypeId }))) + { + if (group.Count() > 1) + { + throw new BusinessValidationFailedException("同一邮箱同一用户类型,生成账号的数据只允许存在一条!"); + } + } - if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined) + if (_userInfo.UserTypeEnumInt == (int)UserTypeEnum.Undefined) { //是第一次 if(!siteUserList.Any(t=>t.IsGenerateSuccess)) @@ -776,8 +784,6 @@ namespace IRaCIS.Core.Application.Contracts - - //已生成的不管 管的只需要是 生成失败的并且需要生成账号的 var needGenerateList = _trialSiteUserSurveyRepository.Where(t => t.TrialSiteSurveyId == trialSiteSurveyId && t.IsGenerateAccount && t.IsJoin != true).ProjectTo(_mapper.ConfigurationProvider).ToList();