diff --git a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs index dd96cac8d..0bf0bc959 100644 --- a/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/SystemDocumentService.cs @@ -119,9 +119,9 @@ namespace IRaCIS.Core.Application.Services return ResponseOutput.NotOk("该文档下已有签名的用户"); } - var success = await _repository.BatchDeleteAsync(t => t.Id == systemDocumentId); + var success = await _systemDocumentRepository.DeleteFromQueryAsync(t => t.Id == systemDocumentId,true); - return ResponseOutput.Result(success); + return ResponseOutput.Result(true); } @@ -132,8 +132,6 @@ namespace IRaCIS.Core.Application.Services [HttpPost] public async Task> GetWaitSignSysDocList(SystemDocumentQuery querySystemDocument) { - - var query = from sysDoc in _systemDocumentRepository.Where(t => t.NeedConfirmedUserTypeList.Any(t => t.NeedConfirmUserTypeId == _userInfo.UserTypeId)) .WhereIf(!string.IsNullOrEmpty(querySystemDocument.Name), t => t.Name.Contains(querySystemDocument.Name)) .WhereIf(querySystemDocument.FileTypeId != null, t => t.FileTypeId == querySystemDocument.FileTypeId) diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs index 05298aed7..131338172 100644 --- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs +++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs @@ -580,6 +580,8 @@ namespace IRaCIS.Core.Application.Services { await _trialDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new TrialDocument() { IsDeleted = true }); } + + await _systemDocumentRepository.SaveChangesAsync(); return ResponseOutput.Ok(); } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 0c4287d0d..dbab9e024 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -371,9 +371,18 @@ namespace IRaCIS.Core.Infra.EFCore public async Task AddAudit() { - var entities = ChangeTracker.Entries().Where(u => (u.State == EntityState.Modified|| u.State == EntityState.Deleted || u.State == EntityState.Added)).Where(x => x.Entity.GetType() != typeof(DataInspection)).ToList(); - AuditingData auditingData = new AuditingData(this, _userInfo); - await auditingData.IncomingEntitys(entities); + try + { + var entities = ChangeTracker.Entries().Where(u => (u.State == EntityState.Modified || u.State == EntityState.Deleted || u.State == EntityState.Added)).Where(x => x.Entity.GetType() != typeof(DataInspection)).ToList(); + AuditingData auditingData = new AuditingData(this, _userInfo); + await auditingData.IncomingEntitys(entities); + } + catch (Exception) + { + + + } + } ///