From 42e0e62b4be503d5bfa74d1f26b0465e60bc65e7 Mon Sep 17 00:00:00 2001
From: he <10978375@qq.com>
Date: Thu, 19 May 2022 14:01:02 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E7=89=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Service/Document/TrialDocumentService.cs | 18 ++++++---
.../Document/SystemDocConfirmedUser.cs | 6 +++
.../Document/TrialDocUserTypeConfirmedUser.cs | 7 ++++
.../Common/AuditingData.cs | 40 ++++++++++++++++---
.../Repository/Repository.cs | 2 +-
5 files changed, 61 insertions(+), 12 deletions(-)
diff --git a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs
index 551c1ef1e..f8c1c0da4 100644
--- a/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs
+++ b/IRaCIS.Core.Application/Service/Document/TrialDocumentService.cs
@@ -530,7 +530,6 @@ namespace IRaCIS.Core.Application.Services
///
/// 用户 签名某个文档
///
-
///
public async Task UserConfirm(UserConfirmCommand userConfirmCommand)
{
@@ -546,7 +545,7 @@ namespace IRaCIS.Core.Application.Services
return ResponseOutput.NotOk("文件已删除或者废除,签署失败!");
}
- await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id, SystemDocumentId = userConfirmCommand.DocumentId },true);
+ await _systemDocConfirmedUserRepository.AddAsync(new SystemDocConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id, IsDeleted=false, SystemDocumentId = userConfirmCommand.DocumentId },true);
}
else
{
@@ -560,7 +559,7 @@ namespace IRaCIS.Core.Application.Services
return ResponseOutput.NotOk("文件已删除或者废除,签署失败!");
}
- await _trialDocUserTypeConfirmedUserRepository.AddAsync(new TrialDocUserTypeConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id, TrialDocumentId = userConfirmCommand.DocumentId },true);
+ await _trialDocUserTypeConfirmedUserRepository.AddAsync(new TrialDocUserTypeConfirmedUser() { ConfirmTime = DateTime.Now, ConfirmUserId = _userInfo.Id,IsDeleted=false, TrialDocumentId = userConfirmCommand.DocumentId },true);
}
await _repository.SaveChangesAsync();
@@ -580,13 +579,20 @@ namespace IRaCIS.Core.Application.Services
{
if (isSystemDoc)
{
- await _systemDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new SystemDocument() { IsDeleted = true },true);
+ await _systemDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new SystemDocument() { IsDeleted = true });
+ await _systemDocConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.SystemDocumentId == documentId, x => new SystemDocConfirmedUser()
+ {
+ IsDeleted = true
+ });
}
else
{
- await _trialDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new TrialDocument() { IsDeleted = true }, true);
+ await _trialDocumentRepository.UpdatePartialFromQueryAsync(documentId, u => new TrialDocument() { IsDeleted = true });
+ await _trialDocUserTypeConfirmedUserRepository.UpdatePartialFromQueryAsync(x => x.TrialDocumentId == documentId, x => new TrialDocUserTypeConfirmedUser()
+ {
+ IsDeleted = true
+ });
}
-
await _systemDocumentRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
diff --git a/IRaCIS.Core.Domain/Document/SystemDocConfirmedUser.cs b/IRaCIS.Core.Domain/Document/SystemDocConfirmedUser.cs
index a6cd58a88..7381eee4a 100644
--- a/IRaCIS.Core.Domain/Document/SystemDocConfirmedUser.cs
+++ b/IRaCIS.Core.Domain/Document/SystemDocConfirmedUser.cs
@@ -44,6 +44,12 @@ namespace IRaCIS.Core.Domain.Models
public string SignText { get; set; } = string.Empty;
+ ///
+ /// 是否废除
+ ///
+ public bool? IsDeleted { get; set; }
+
+
}
}
diff --git a/IRaCIS.Core.Domain/Document/TrialDocUserTypeConfirmedUser.cs b/IRaCIS.Core.Domain/Document/TrialDocUserTypeConfirmedUser.cs
index 7ff5dc895..d0a91466f 100644
--- a/IRaCIS.Core.Domain/Document/TrialDocUserTypeConfirmedUser.cs
+++ b/IRaCIS.Core.Domain/Document/TrialDocUserTypeConfirmedUser.cs
@@ -47,6 +47,13 @@ namespace IRaCIS.Core.Domain.Models
public string SignText { get; set; } = string.Empty;
+
+
+ ///
+ /// 是否废除
+ ///
+ public bool? IsDeleted { get; set; }
+
}
diff --git a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
index b671b6efa..b25815d08 100644
--- a/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
+++ b/IRaCIS.Core.Infra.EFCore/Common/AuditingData.cs
@@ -202,21 +202,41 @@ namespace IRaCIS.Core.Infra.EFCore.Common
// 系统文件签署
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(SystemDocConfirmedUser)))
{
+ var entity = item.Entity as SystemDocConfirmedUser;
+ var systemDocument= await _dbContext.SystemDocument.Where(x => x.Id == entity.SystemDocumentId).FirstOrDefaultAsync();
await InsertInspection(item, type, x => new DataInspection()
{
GeneralId = x.Id,
- });
+ },new {
+
+ FileTypeId= systemDocument.FileTypeId,
+ Name = systemDocument.Name,
+ CreateTime=systemDocument.CreateTime,
+ IsSigned="是",// 是否签署 添加了就是签署了
+ }, null, "UserSigned");
}
// 项目文件签署
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialDocUserTypeConfirmedUser)))
{
+ var entity = item.Entity as TrialDocUserTypeConfirmedUser;
+ var trialDocument = await _dbContext.TrialDocument.Where(x => x.Id == entity.TrialDocumentId).FirstOrDefaultAsync();
+
+ var trialid = trialDocument.TrialId;
await InsertInspection(item, type, x => new DataInspection()
{
+ TrialId= trialid,
GeneralId = x.Id,
- });
+ },new {
+ FileTypeId = trialDocument.FileTypeId,
+ Name = trialDocument.Name,
+ CreateTime = trialDocument.CreateTime,
+ IsSigned = "是",// 是否签署 添加了就是签署了
+ },null, "UserSigned");
}
+
+
// 项目中心
foreach (var item in entitys.Where(x => x.Entity.GetType() == typeof(TrialSite)))
{
@@ -792,8 +812,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common
/// 类型
/// 表达式
/// 实体对象
+ /// 实体名称
///
- public async Task InsertInspection(EntityEntry data, string type, Expression> expression = null,object otherItem=null,T entityData=null) where T:class
+ public async Task InsertInspection(EntityEntry data, string type, Expression> expression = null,object otherItem=null,T entityData=null, string? entityTypeName=null) where T:class
{
object entityobj = entityData == null ? data.Entity : entityData;
DataInspection inspection = new DataInspection();
@@ -803,7 +824,15 @@ namespace IRaCIS.Core.Infra.EFCore.Common
var entity = entityobj as T;
inspection = f(entity);
}
- inspection.Identification = $"{_userInfo.RequestUrl}/{ entityobj.GetType().Name}/{type}";
+ if (entityTypeName == null)
+ {
+ entityTypeName = entityobj.GetType().Name;
+ }
+ else
+ {
+ entityTypeName = "New/" + entityTypeName;
+ }
+ inspection.Identification = $"{_userInfo.RequestUrl}/{ entityTypeName}/{type}";
//if (data != null)
//{
// var originaldata = data.OriginalValues.ToObject();
@@ -817,7 +846,8 @@ namespace IRaCIS.Core.Infra.EFCore.Common
await AddInspectionRecordAsync(inspection, entityobj, otherItem);
}
-
+
+
diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
index b2bf0162b..8f0681103 100644
--- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
+++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs
@@ -779,7 +779,7 @@ namespace IRaCIS.Core.Infra.EFCore
try
{
- if (!JsonData.ContainsKey(item.Key))
+ if (!JsonData.ContainsKey(item.Key) || JsonData[item.Key]==null)
{
continue;
}