From 88c6f574ecf2b6441dcefc359612da1761aab8f7 Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Tue, 15 Apr 2025 15:36:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/Document/TrialDocumentService.cs | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index 3485fcfc3..12873b772 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -231,7 +231,7 @@ namespace IRaCIS.Core.Application.Services #region 统一用户修改 var systemDocQuery = - from sysDoc in _systemDocumentRepository.AsQueryable(true).Include(x=>x.SystemDocumentAttachmentList).Where(t => t.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == _userInfo.UserTypeId)) + from sysDoc in _systemDocumentRepository.AsQueryable(true).Where(t => t.NeedConfirmedUserTypeList.Any(c => c.NeedConfirmUserTypeId == _userInfo.UserTypeId)) //外部人员 只签署 外部需要签署的 .WhereIf(isInternal == false, t => t.DocUserSignType == DocUserSignType.InnerAndOuter) from trialUser in _trialIdentityUserRepository.AsQueryable(false) @@ -243,7 +243,6 @@ namespace IRaCIS.Core.Application.Services select new UnionDocumentWithConfirmInfoView() { IsSystemDoc = true, - AttachmentCount= sysDoc.SystemDocumentAttachmentList.Count(), Id = sysDoc.Id, CreateTime = sysDoc.CreateTime, IsDeleted = sysDoc.IsDeleted, @@ -411,6 +410,21 @@ namespace IRaCIS.Core.Application.Services var result = await unionQuery.ToPagedListAsync(inQuery); + + //Concat 不能用导航属性 + var sysids = result.CurrentPageData.Where(t => t.IsSystemDoc == true).Select(t => t.Id).ToList(); + + var sysDataList = await _systemDocumentRepository.Where(x => sysids.Contains(x.Id)).Include(x => x.SystemDocumentAttachmentList).ToListAsync(); + result.CurrentPageData.ForEach(x => + { + if (sysDataList.Any(y => y.Id == x.Id)) + { + x.AttachmentCount = sysDataList.Where(y => y.Id == x.Id).Select(x => x.SystemDocumentAttachmentList.Count()).FirstOrDefault(); + } + + + + }); #endregion #region 临时方案 @@ -517,7 +531,7 @@ namespace IRaCIS.Core.Application.Services var systemDocQuery = - from sysDoc in _systemDocumentRepository.AsQueryable(false).Include(x=>x.SystemDocumentAttachmentList).Where(u => trialInfo.TrialFinishedTime != null ? u.CreateTime < trialInfo.TrialFinishedTime : true) + from sysDoc in _systemDocumentRepository.AsQueryable(false).Where(u => trialInfo.TrialFinishedTime != null ? u.CreateTime < trialInfo.TrialFinishedTime : true) .Where(t => inQuery.UserTypeId != null ? t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == inQuery.UserTypeId) : true) from trialUser in _trialIdentityUserRepository.AsQueryable(false).Where(t => t.TrialId == inQuery.TrialId && t.TrialUserRoleList.Any(t => sysDoc.NeedConfirmedUserTypeList.AsQueryable().Any(c => c.NeedConfirmUserTypeId == t.UserRole.UserTypeId))) @@ -568,6 +582,18 @@ namespace IRaCIS.Core.Application.Services var result = await unionQuery.ToPagedListAsync(inQuery); + //Concat 不能用导航属性 + var sysids = result.CurrentPageData.Where(t => t.IsSystemDoc == true).Select(t => t.Id).ToList(); + + var sysDataList = await _systemDocumentRepository.Where(x => sysids.Contains(x.Id)).Include(x => x.SystemDocumentAttachmentList).ToListAsync(); + result.CurrentPageData.ForEach(x => + { + if (sysDataList.Any(y => y.Id == x.Id)) + { + x.AttachmentCount = sysDataList.Where(y => y.Id == x.Id).Select(x => x.SystemDocumentAttachmentList.Count()).FirstOrDefault(); + } + }); + #region 处理文档 需要签署的角色类型 和每个人的角色信息 var trialDocIdList = result.CurrentPageData.Where(t => t.IsSystemDoc == false).Select(t => t.Id).ToList();