diff --git a/IRaCIS.Core.Application/MassTransit/Recurring/SystemDocumentConsumer.cs b/IRaCIS.Core.Application/MassTransit/Recurring/SystemDocumentConsumer.cs index 3e9ec1470..d9361c315 100644 --- a/IRaCIS.Core.Application/MassTransit/Recurring/SystemDocumentConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Recurring/SystemDocumentConsumer.cs @@ -54,8 +54,10 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring from identityUser in _identityUserRepository.AsQueryable(false).Where(t => t.Status == UserStateEnum.Enable).Where(t => t.UserRoleList.Where(t => t.IsUserRoleDisabled == false).Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId))) join confirmc in _systemDocConfirmedUserRepository.Where() on new { ConfirmUserId = identityUser.Id, SystemDocumentId = sysDoc.Id } equals new { confirmc.ConfirmUserId, confirmc.SystemDocumentId } into cc from confirm in cc.DefaultIfEmpty() - select new UnionDocumentWithConfirmInfoView() + select new TriaAndSystemlSignDocView() { + DocLanguageType=sysDoc.DocLanguageType, + UserWorkLanguage=identityUser.UserWorkLanguage, IsSystemDoc = true, Id = sysDoc.Id, CreateTime = sysDoc.CreateTime, @@ -79,7 +81,9 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring }; var datalist = await systemDocQuery.IgnoreQueryFilters().Where(t => t.IsDeleted == false && t.ConfirmTime == null) .ToListAsync(); - datalist = datalist.Where(x => x.SuggestFinishTime != null && x.SuggestFinishTime.Value.Date == DateTime.Now.Date) + datalist = datalist + .Where(x=>x.DocLanguageType == DocLanguageType.CN_US || (int)x.DocLanguageType == (int)x.UserWorkLanguage) + .Where(x => x.SuggestFinishTime != null && x.SuggestFinishTime.Value.Date == DateTime.Now.Date) .Where(x => x.IsNeedSendEmial).ToList(); var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList(); var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync(); @@ -168,7 +172,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring Console.WriteLine($"只发送给新增的角色,角色数量: {context.Message.NewUserTypeIds.Count}"); } // 构建查询 - IQueryable systemDocQuery; + IQueryable systemDocQuery; if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any()) { @@ -180,8 +184,10 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring t.UserRoleList.Where(t => t.IsUserRoleDisabled == false) .Any(t => context.Message.NewUserTypeIds.Contains(t.UserTypeId) && sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId))) - select new UnionDocumentWithConfirmInfoView() + select new TriaAndSystemlSignDocView() { + DocLanguageType = sysDoc.DocLanguageType, + UserWorkLanguage = identityUser.UserWorkLanguage, IsSystemDoc = true, Id = sysDoc.Id, CreateTime = sysDoc.CreateTime, @@ -207,8 +213,10 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring .Where(t => t.Status == UserStateEnum.Enable && t.UserRoleList.Where(t => t.IsUserRoleDisabled == false) .Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserTypeId))) - select new UnionDocumentWithConfirmInfoView() + select new TriaAndSystemlSignDocView() { + DocLanguageType = sysDoc.DocLanguageType, + UserWorkLanguage = identityUser.UserWorkLanguage, IsSystemDoc = true, Id = sysDoc.Id, CreateTime = sysDoc.CreateTime, @@ -226,7 +234,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring }; } var datalist = await systemDocQuery.IgnoreQueryFilters().Where(x => x.IsNeedSendEmial).ToListAsync(); - + datalist = datalist.Where(x => x.DocLanguageType == DocLanguageType.CN_US || (int)x.DocLanguageType == (int)x.UserWorkLanguage).ToList(); var confirmUserIdList = datalist.Select(t => t.ConfirmUserId).Distinct().ToList(); var userinfoList = await _identityUserRepository.Where(x => confirmUserIdList.Contains(x.Id)).ToListAsync(); diff --git a/IRaCIS.Core.Application/MassTransit/Recurring/TrialDocumentConsumer.cs b/IRaCIS.Core.Application/MassTransit/Recurring/TrialDocumentConsumer.cs index ec374fa6c..0a2bc5fa1 100644 --- a/IRaCIS.Core.Application/MassTransit/Recurring/TrialDocumentConsumer.cs +++ b/IRaCIS.Core.Application/MassTransit/Recurring/TrialDocumentConsumer.cs @@ -64,8 +64,9 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring from confirm in cc.DefaultIfEmpty() where trialIdentityUser.TrialUserRoleList.Any(ur => !ur.IsDeleted && trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == ur.UserRole.UserTypeId)) - select new TrialSignDocView() + select new TriaAndSystemlSignDocView() { + TrialCode = trialDoc.Trial.TrialCode, ResearchProgramNo = trialDoc.Trial.ResearchProgramNo, ExperimentName = trialDoc.Trial.ExperimentName, @@ -209,7 +210,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring Console.WriteLine($"只发送给新增项目的角色,角色数量: {context.Message.NewUserTypeIds.Count}"); } // 构建查询 - IQueryable trialDocQuery; + IQueryable trialDocQuery; if (context.Message.NewUserTypeIds != null && context.Message.NewUserTypeIds.Any()) { @@ -223,7 +224,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring on trialIdentityUser.IdentityUserId equals identityUser.Id where trialIdentityUser.TrialUserRoleList.Any(ur => !ur.IsDeleted && context.Message.NewUserTypeIds.Contains(ur.UserRole.UserTypeId) && trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == ur.UserRole.UserTypeId)) - select new TrialSignDocView() + select new TriaAndSystemlSignDocView() { IsSystemDoc = true, Id = trialDoc.Id, @@ -259,7 +260,7 @@ namespace IRaCIS.Core.Application.MassTransit.Recurring where trialIdentityUser.TrialUserRoleList.Any(ur => !ur.IsDeleted &&trialDoc.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == ur.UserRole.UserTypeId)) - select new TrialSignDocView() + select new TriaAndSystemlSignDocView() { IsSystemDoc = false, Id = trialDoc.Id, diff --git a/IRaCIS.Core.Application/Service/Document/DTO/SystemDocumentViewModel.cs b/IRaCIS.Core.Application/Service/Document/DTO/SystemDocumentViewModel.cs index 4f50ce1c9..e192c1bfd 100644 --- a/IRaCIS.Core.Application/Service/Document/DTO/SystemDocumentViewModel.cs +++ b/IRaCIS.Core.Application/Service/Document/DTO/SystemDocumentViewModel.cs @@ -80,7 +80,7 @@ namespace IRaCIS.Core.Application.Contracts } - public class TrialSignDocView : UnionDocumentWithConfirmInfoView + public class TriaAndSystemlSignDocView : UnionDocumentWithConfirmInfoView { public string TrialCode { get; set; } public string ResearchProgramNo { get; set; } @@ -90,6 +90,8 @@ namespace IRaCIS.Core.Application.Contracts public TrialType TrialType { get; set; } public bool IsTestUser { get; set; } + + public UserWorkLanguage UserWorkLanguage { get; set; } } @@ -367,6 +369,8 @@ namespace IRaCIS.Core.Application.Contracts public DocLanguageType DocLanguageType { get; set; } + + }