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();