diff --git a/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs b/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs index 87e4398ca..935f184d7 100644 --- a/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/AuditDocumentService.cs @@ -15,6 +15,8 @@ using AutoMapper.Execution; using System.Linq; using IRaCIS.Core.Infrastructure; using DocumentFormat.OpenXml.Office2010.Excel; +using MassTransit; +using NPOI.POIFS.Properties; namespace IRaCIS.Core.Application.Service; @@ -281,16 +283,46 @@ public class AuditDocumentService(IRepository _auditDocumentRepos } - ///// - ///// 设置是否授权 - ///// - ///// - ///// - //[ht] - // public async Task SetIsAuthorization(SetIsAuthorizationInDto inDto) - //{ + /// + /// 设置是否授权 + /// + /// + /// + [HttpPost] + public async Task SetIsAuthorization(SetIsAuthorizationInDto inDto) + { + var data = await _auditDocumentRepository.Select(x => new DeleteAudit() + { + Id = x.Id, + ParentId = x.ParentId, + MainFileId = x.MainFileId + }).ToListAsync(); + + List allid = new List(); + findChild(allid, inDto.Ids, data); + + await _auditDocumentRepository.UpdatePartialFromQueryAsync(t => allid.Contains(t.Id), x => new AuditDocument() { - //} + IsAuthorization = inDto.IsAuthorization + }); + await _auditDocumentRepository.SaveChangesAsync(); + return ResponseOutput.Ok(); + + void findChild(List allId,List current, List data) + { + allId.AddRange(current); + + var child = data.Where(x =>(x.ParentId!=null&& current.Contains(x.ParentId.Value))||(x.MainFileId!=null&¤t.Contains(x.MainFileId.Value))).Select(x => x.Id).ToList(); + if (child.Count() > 0) + { + + + findChild(allId, child, data); + + } + + } + } }