Browse Source

审计日志Input & Out Dto添加注释。Abp实体添加扩展方法以便添加中文注释。

master
guotianliang 3 years ago
parent
commit
48918447c5
  1. 3
      Sanhe.Abp.Framework.sln
  2. 19
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/AuditLogActionDto.cs
  3. 78
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/AuditLogDto.cs
  4. 42
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/AuditLogGetByPagedDto.cs
  5. 23
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/EntityChangeDto.cs
  6. 18
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/EntityChangeGetByPagedDto.cs
  7. 6
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/EntityChangeGetWithUsernameDto.cs
  8. 7
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/EntityChangeWithUsernameDto.cs
  9. 15
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/EntityPropertyChangeDto.cs
  10. 13
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/Dto/LogExceptionDto.cs
  11. 21
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/Dto/LogFieldDto.cs
  12. 23
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/Dto/LogGetByPagedDto.cs
  13. 3
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/ILogAppService.cs
  14. 17
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/LogDto.cs
  15. 34
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/LogExceptionDto.cs
  16. 66
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/LogFieldDto.cs
  17. 62
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/LogGetByPagedDto.cs
  18. 43
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/SecurityLogs/SecurityLogDto.cs
  19. 27
      modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/SecurityLogs/SecurityLogGetByPagedDto.cs
  20. 2
      modules/auditing/Sanhe.Abp.Auditing.Application/Sanhe/Abp/Auditing/AbpAuditingMapperProfile.cs
  21. 3
      modules/auditing/Sanhe.Abp.Auditing.Application/Sanhe/Abp/Auditing/Logging/LogAppService.cs
  22. 1
      modules/auditing/Sanhe.Abp.Auditing.HttpApi/Sanhe/Abp/Auditing/Logging/LogController.cs
  23. 26
      modules/common/Sanhe.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/AbpEntityTypeBuilderExtensions.cs
  24. 90
      modules/common/Sanhe.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/EntityTypeBuilderExtensions.cs
  25. 1
      modules/common/Sanhe.Abp.Features.LimitValidation/Sanhe/Abp/Features/LimitValidation/FeaturesLimitValidationInterceptor.cs

3
Sanhe.Abp.Framework.sln

@ -131,8 +131,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sanhe.Abp.Auditing.Applicat
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sanhe.Abp.Auditing.HttpApi", "modules\auditing\Sanhe.Abp.Auditing.HttpApi\Sanhe.Abp.Auditing.HttpApi.csproj", "{A82C2175-AD0D-4AF5-B4F9-E264E47617C3}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Sanhe.Abp.Auditing.HttpApi", "modules\auditing\Sanhe.Abp.Auditing.HttpApi\Sanhe.Abp.Auditing.HttpApi.csproj", "{A82C2175-AD0D-4AF5-B4F9-E264E47617C3}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "file", "file", "{9B6733E6-5B06-42B2-A92E-519C5CDCB3A6}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -394,7 +392,6 @@ Global
{D014ED3D-E73A-4AFB-873E-C50B81493C8B} = {5BD41DAA-FBB1-4F52-A5D5-3C1D6A123645} {D014ED3D-E73A-4AFB-873E-C50B81493C8B} = {5BD41DAA-FBB1-4F52-A5D5-3C1D6A123645}
{58BE1EAE-9C41-4ED4-B4B9-4F8052B3E9D7} = {5BD41DAA-FBB1-4F52-A5D5-3C1D6A123645} {58BE1EAE-9C41-4ED4-B4B9-4F8052B3E9D7} = {5BD41DAA-FBB1-4F52-A5D5-3C1D6A123645}
{A82C2175-AD0D-4AF5-B4F9-E264E47617C3} = {5BD41DAA-FBB1-4F52-A5D5-3C1D6A123645} {A82C2175-AD0D-4AF5-B4F9-E264E47617C3} = {5BD41DAA-FBB1-4F52-A5D5-3C1D6A123645}
{9B6733E6-5B06-42B2-A92E-519C5CDCB3A6} = {F5F5D604-531B-4B57-A88E-C9C5CEEC55D7}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {AB69BFDE-9DDB-4D16-8CB8-72472C0319CD} SolutionGuid = {AB69BFDE-9DDB-4D16-8CB8-72472C0319CD}

19
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/AuditLogActionDto.cs

@ -5,14 +5,25 @@ namespace Sanhe.Abp.Auditing.AuditLogs
{ {
public class AuditLogActionDto : ExtensibleEntityDto<Guid> public class AuditLogActionDto : ExtensibleEntityDto<Guid>
{ {
/// <summary>
/// 服务名称
/// </summary>
public string ServiceName { get; set; } public string ServiceName { get; set; }
/// <summary>
/// 方法名称
/// </summary>
public string MethodName { get; set; } public string MethodName { get; set; }
/// <summary>
/// 参数列表
/// </summary>
public string Parameters { get; set; } public string Parameters { get; set; }
/// <summary>
/// 调用时间
/// </summary>
public DateTime ExecutionTime { get; set; } public DateTime ExecutionTime { get; set; }
/// <summary>
/// 响应时间(ms)
/// </summary>
public int ExecutionDuration { get; set; } public int ExecutionDuration { get; set; }
} }
} }

78
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/AuditLogDto.cs

@ -6,43 +6,85 @@ namespace Sanhe.Abp.Auditing.AuditLogs
{ {
public class AuditLogDto : ExtensibleEntityDto<Guid> public class AuditLogDto : ExtensibleEntityDto<Guid>
{ {
/// <summary>
/// 应用名称
/// </summary>
public string ApplicationName { get; set; } public string ApplicationName { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public Guid? UserId { get; set; } public Guid? UserId { get; set; }
/// <summary>
/// 用户名称
/// </summary>
public string UserName { get; set; } public string UserName { get; set; }
/// <summary>
/// 租户Id
/// </summary>
public Guid? TenantId { get; set; } public Guid? TenantId { get; set; }
/// <summary>
/// 租户名称
/// </summary>
public string TenantName { get; set; } public string TenantName { get; set; }
/// <summary>
/// 模拟用户Id
/// </summary>
public Guid? ImpersonatorUserId { get; set; } public Guid? ImpersonatorUserId { get; set; }
/// <summary>
/// 模拟租户Id
/// </summary>
public Guid? ImpersonatorTenantId { get; set; } public Guid? ImpersonatorTenantId { get; set; }
/// <summary>
/// 调用时间
/// </summary>
public DateTime ExecutionTime { get; set; } public DateTime ExecutionTime { get; set; }
/// <summary>
/// 响应时间(ms)
/// </summary>
public int ExecutionDuration { get; set; } public int ExecutionDuration { get; set; }
/// <summary>
/// 客户端Ip地址
/// </summary>
public string ClientIpAddress { get; set; } public string ClientIpAddress { get; set; }
/// <summary>
/// 客户端名称
/// </summary>
public string ClientName { get; set; } public string ClientName { get; set; }
/// <summary>
/// 客户端Id
/// </summary>
public string ClientId { get; set; } public string ClientId { get; set; }
/// <summary>
/// 链路标识
/// </summary>
public string CorrelationId { get; set; } public string CorrelationId { get; set; }
/// <summary>
/// 浏览器信息
/// </summary>
public string BrowserInfo { get; set; } public string BrowserInfo { get; set; }
/// <summary>
/// Http方法
/// </summary>
public string HttpMethod { get; set; } public string HttpMethod { get; set; }
/// <summary>
/// Url
/// </summary>
public string Url { get; set; } public string Url { get; set; }
/// <summary>
/// 异常
/// </summary>
public string Exceptions { get; set; } public string Exceptions { get; set; }
/// <summary>
/// 评论
/// </summary>
public string Comments { get; set; } public string Comments { get; set; }
/// <summary>
/// Http状态码
/// </summary>
public int? HttpStatusCode { get; set; } public int? HttpStatusCode { get; set; }
/// <summary>
/// 实体变更
/// </summary>
public List<EntityChangeDto> EntityChanges { get; set; } public List<EntityChangeDto> EntityChanges { get; set; }
public List<AuditLogActionDto> Actions { get; set; } public List<AuditLogActionDto> Actions { get; set; }

42
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/AuditLogGetByPagedDto.cs

@ -6,19 +6,61 @@ namespace Sanhe.Abp.Auditing.AuditLogs
{ {
public class AuditLogGetByPagedDto : PagedAndSortedResultRequestDto public class AuditLogGetByPagedDto : PagedAndSortedResultRequestDto
{ {
/// <summary>
/// 开始时间
/// </summary>
public DateTime? StartTime { get; set; } public DateTime? StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime? EndTime { get; set; } public DateTime? EndTime { get; set; }
/// <summary>
/// 请求方法
/// </summary>
public string HttpMethod { get; set; } public string HttpMethod { get; set; }
/// <summary>
/// Url
/// </summary>
public string Url { get; set; } public string Url { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public Guid? UserId { get; set; } public Guid? UserId { get; set; }
/// <summary>
/// 用户名称
/// </summary>
public string UserName { get; set; } public string UserName { get; set; }
/// <summary>
/// 应用名称
/// </summary>
public string ApplicationName { get; set; } public string ApplicationName { get; set; }
/// <summary>
/// 链路标识
/// </summary>
public string CorrelationId { get; set; } public string CorrelationId { get; set; }
/// <summary>
/// 客户端Id
/// </summary>
public string ClientId { get; set; } public string ClientId { get; set; }
/// <summary>
/// 客户端Ip地址
/// </summary>
public string ClientIpAddress { get; set; } public string ClientIpAddress { get; set; }
/// <summary>
/// 最长响应时间(ms)
/// </summary>
public int? MaxExecutionDuration { get; set; } public int? MaxExecutionDuration { get; set; }
/// <summary>
/// 最短响应时间(ms)
/// </summary>
public int? MinExecutionDuration { get; set; } public int? MinExecutionDuration { get; set; }
/// <summary>
/// 包含异常
/// </summary>
public bool? HasException { get; set; } public bool? HasException { get; set; }
/// <summary>
/// Http状态码
/// </summary>
public HttpStatusCode? HttpStatusCode { get; set; } public HttpStatusCode? HttpStatusCode { get; set; }
} }
} }

23
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/EntityChangeDto.cs

@ -7,16 +7,29 @@ namespace Sanhe.Abp.Auditing.AuditLogs
{ {
public class EntityChangeDto : ExtensibleEntityDto<Guid> public class EntityChangeDto : ExtensibleEntityDto<Guid>
{ {
/// <summary>
/// 变更时间
/// </summary>
public DateTime ChangeTime { get; set; } public DateTime ChangeTime { get; set; }
/// <summary>
/// 变更类型
/// </summary>
public EntityChangeType ChangeType { get; set; } public EntityChangeType ChangeType { get; set; }
/// <summary>
/// 实体租户Id
/// </summary>
public Guid? EntityTenantId { get; set; } public Guid? EntityTenantId { get; set; }
/// <summary>
/// 实体标识
/// </summary>
public string EntityId { get; set; } public string EntityId { get; set; }
/// <summary>
/// 实体类型
/// </summary>
public string EntityTypeFullName { get; set; } public string EntityTypeFullName { get; set; }
/// <summary>
/// 属性变更
/// </summary>
public List<EntityPropertyChangeDto> PropertyChanges { get; set; } public List<EntityPropertyChangeDto> PropertyChanges { get; set; }
public EntityChangeDto() public EntityChangeDto()

18
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/EntityChangeGetByPagedDto.cs

@ -6,10 +6,28 @@ namespace Sanhe.Abp.Auditing.AuditLogs;
public class EntityChangeGetByPagedDto : PagedAndSortedResultRequestDto public class EntityChangeGetByPagedDto : PagedAndSortedResultRequestDto
{ {
/// <summary>
/// 审计日志Id
/// </summary>
public Guid? AuditLogId { get; set; } public Guid? AuditLogId { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime? StartTime { get; set; } public DateTime? StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime? EndTime { get; set; } public DateTime? EndTime { get; set; }
/// <summary>
/// 变更类型
/// </summary>
public EntityChangeType? ChangeType { get; set; } public EntityChangeType? ChangeType { get; set; }
/// <summary>
/// 实体标识
/// </summary>
public string EntityId { get; set; } public string EntityId { get; set; }
/// <summary>
/// 实体类型
/// </summary>
public string EntityTypeFullName { get; set; } public string EntityTypeFullName { get; set; }
} }

6
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/EntityChangeGetWithUsernameDto.cs

@ -2,6 +2,12 @@
public class EntityChangeGetWithUsernameDto public class EntityChangeGetWithUsernameDto
{ {
/// <summary>
/// 实体标识
/// </summary>
public string EntityId { get; set; } public string EntityId { get; set; }
/// <summary>
/// 实体类型
/// </summary>
public string EntityTypeFullName { get; set; } public string EntityTypeFullName { get; set; }
} }

7
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/EntityChangeWithUsernameDto.cs

@ -2,7 +2,12 @@
public class EntityChangeWithUsernameDto public class EntityChangeWithUsernameDto
{ {
/// <summary>
/// 实体变更
/// </summary>
public EntityChangeDto EntityChange { get; set; } public EntityChangeDto EntityChange { get; set; }
/// <summary>
/// 用户名称
/// </summary>
public string UserName { get; set; } public string UserName { get; set; }
} }

15
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/AuditLogs/EntityPropertyChangeDto.cs

@ -5,12 +5,21 @@ namespace Sanhe.Abp.Auditing.AuditLogs
{ {
public class EntityPropertyChangeDto : EntityDto<Guid> public class EntityPropertyChangeDto : EntityDto<Guid>
{ {
/// <summary>
/// 当前值
/// </summary>
public string NewValue { get; set; } public string NewValue { get; set; }
/// <summary>
/// 原始值
/// </summary>
public string OriginalValue { get; set; } public string OriginalValue { get; set; }
/// <summary>
/// 属性名称
/// </summary>
public string PropertyName { get; set; } public string PropertyName { get; set; }
/// <summary>
/// 属性类型
/// </summary>
public string PropertyTypeFullName { get; set; } public string PropertyTypeFullName { get; set; }
} }
} }

13
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/Dto/LogExceptionDto.cs

@ -1,13 +0,0 @@
namespace Sanhe.Abp.Auditing.Logging.Dto
{
public class LogExceptionDto
{
public int Depth { get; set; }
public string Class { get; set; }
public string Message { get; set; }
public string Source { get; set; }
public string StackTrace { get; set; }
public int HResult { get; set; }
public string HelpURL { get; set; }
}
}

21
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/Dto/LogFieldDto.cs

@ -1,21 +0,0 @@
namespace Sanhe.Abp.Auditing.Logging.Dto
{
public class LogFieldDto
{
public string Id { get; set; }
public string MachineName { get; set; }
public string Environment { get; set; }
public string Application { get; set; }
public string Context { get; set; }
public string ActionId { get; set; }
public string ActionName { get; set; }
public string RequestId { get; set; }
public string RequestPath { get; set; }
public string ConnectionId { get; set; }
public string CorrelationId { get; set; }
public string ClientId { get; set; }
public string UserId { get; set; }
public int ProcessId { get; set; }
public int ThreadId { get; set; }
}
}

23
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/Dto/LogGetByPagedDto.cs

@ -1,23 +0,0 @@
using Microsoft.Extensions.Logging;
using System;
using Volo.Abp.Application.Dtos;
namespace Sanhe.Abp.Auditing.Logging.Dto
{
public class LogGetByPagedDto : PagedAndSortedResultRequestDto
{
public DateTime? StartTime { get; set; }
public DateTime? EndTime { get; set; }
public LogLevel? Level { get; set; }
public string MachineName { get; set; }
public string Environment { get; set; }
public string Application { get; set; }
public string Context { get; set; }
public string RequestId { get; set; }
public string RequestPath { get; set; }
public string CorrelationId { get; set; }
public int? ProcessId { get; set; }
public int? ThreadId { get; set; }
public bool? HasException { get; set; }
}
}

3
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/ILogAppService.cs

@ -1,5 +1,4 @@
using Sanhe.Abp.Auditing.Logging.Dto; using System.Threading.Tasks;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;

17
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/Dto/LogDto.cs → modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/LogDto.cs

@ -2,14 +2,29 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Sanhe.Abp.Auditing.Logging.Dto namespace Sanhe.Abp.Auditing.Logging
{ {
public class LogDto public class LogDto
{ {
/// <summary>
/// 时间戳
/// </summary>
public DateTime TimeStamp { get; set; } public DateTime TimeStamp { get; set; }
/// <summary>
/// 日志级别
/// </summary>
public LogLevel Level { get; set; } public LogLevel Level { get; set; }
/// <summary>
/// 信息
/// </summary>
public string Message { get; set; } public string Message { get; set; }
/// <summary>
/// 字段
/// </summary>
public LogFieldDto Fields { get; set; } public LogFieldDto Fields { get; set; }
/// <summary>
/// 错误信息
/// </summary>
public List<LogExceptionDto> Exceptions { get; set; } public List<LogExceptionDto> Exceptions { get; set; }
} }
} }

34
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/LogExceptionDto.cs

@ -0,0 +1,34 @@
namespace Sanhe.Abp.Auditing.Logging
{
public class LogExceptionDto
{
/// <summary>
/// 深度
/// </summary>
public int Depth { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Class { get; set; }
/// <summary>
/// 消息
/// </summary>
public string Message { get; set; }
/// <summary>
/// 来源
/// </summary>
public string Source { get; set; }
/// <summary>
/// 堆栈
/// </summary>
public string StackTrace { get; set; }
/// <summary>
/// 代码
/// </summary>
public int HResult { get; set; }
/// <summary>
/// 帮助
/// </summary>
public string HelpURL { get; set; }
}
}

66
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/LogFieldDto.cs

@ -0,0 +1,66 @@
namespace Sanhe.Abp.Auditing.Logging
{
public class LogFieldDto
{
/// <summary>
/// Id
/// </summary>
public string Id { get; set; }
/// <summary>
/// 机器名称
/// </summary>
public string MachineName { get; set; }
/// <summary>
/// 应用环境
/// </summary>
public string Environment { get; set; }
/// <summary>
/// 应用信息
/// </summary>
public string Application { get; set; }
/// <summary>
/// 上下文
/// </summary>
public string Context { get; set; }
/// <summary>
/// 方法标识
/// </summary>
public string ActionId { get; set; }
/// <summary>
/// 方法名称
/// </summary>
public string ActionName { get; set; }
/// <summary>
/// 请求标识
/// </summary>
public string RequestId { get; set; }
/// <summary>
/// 请求路径
/// </summary>
public string RequestPath { get; set; }
/// <summary>
/// 连接标识
/// </summary>
public string ConnectionId { get; set; }
/// <summary>
/// 链路标识
/// </summary>
public string CorrelationId { get; set; }
/// <summary>
/// 客户端标识
/// </summary>
public string ClientId { get; set; }
/// <summary>
/// 用户标识
/// </summary>
public string UserId { get; set; }
/// <summary>
/// 进程标识
/// </summary>
public int ProcessId { get; set; }
/// <summary>
/// 线程标识
/// </summary>
public int ThreadId { get; set; }
}
}

62
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/Logging/LogGetByPagedDto.cs

@ -0,0 +1,62 @@
using Microsoft.Extensions.Logging;
using System;
using Volo.Abp.Application.Dtos;
namespace Sanhe.Abp.Auditing.Logging
{
public class LogGetByPagedDto : PagedAndSortedResultRequestDto
{
/// <summary>
/// 开始时间
/// </summary>
public DateTime? StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime? EndTime { get; set; }
/// <summary>
/// 日志等级
/// </summary>
public LogLevel? Level { get; set; }
/// <summary>
/// 机器名称
/// </summary>
public string MachineName { get; set; }
/// <summary>
/// 应用环境
/// </summary>
public string Environment { get; set; }
/// <summary>
/// 应用信息
/// </summary>
public string Application { get; set; }
/// <summary>
/// 上下文
/// </summary>
public string Context { get; set; }
/// <summary>
/// 请求标识
/// </summary>
public string RequestId { get; set; }
/// <summary>
/// 请求路径
/// </summary>
public string RequestPath { get; set; }
/// <summary>
/// 链路标识
/// </summary>
public string CorrelationId { get; set; }
/// <summary>
/// 进程标识
/// </summary>
public int? ProcessId { get; set; }
/// <summary>
/// 线程标识
/// </summary>
public int? ThreadId { get; set; }
/// <summary>
/// 包含异常
/// </summary>
public bool? HasException { get; set; }
}
}

43
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/SecurityLogs/SecurityLogDto.cs

@ -5,26 +5,49 @@ namespace Sanhe.Abp.Auditing.SecurityLogs
{ {
public class SecurityLogDto : ExtensibleEntityDto<Guid> public class SecurityLogDto : ExtensibleEntityDto<Guid>
{ {
/// <summary>
/// 应用名称
/// </summary>
public string ApplicationName { get; set; } public string ApplicationName { get; set; }
/// <summary>
/// 标识
/// </summary>
public string Identity { get; set; } public string Identity { get; set; }
/// <summary>
/// 操作
/// </summary>
public string Action { get; set; } public string Action { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public Guid? UserId { get; set; } public Guid? UserId { get; set; }
/// <summary>
/// 用户名称
/// </summary>
public string UserName { get; set; } public string UserName { get; set; }
/// <summary>
/// 租户名称
/// </summary>
public string TenantName { get; set; } public string TenantName { get; set; }
/// <summary>
/// 客户端Id
/// </summary>
public string ClientId { get; set; } public string ClientId { get; set; }
/// <summary>
/// 链路标识
/// </summary>
public string CorrelationId { get; set; } public string CorrelationId { get; set; }
/// <summary>
/// 客户端地址
/// </summary>
public string ClientIpAddress { get; set; } public string ClientIpAddress { get; set; }
/// <summary>
/// 浏览器信息
/// </summary>
public string BrowserInfo { get; set; } public string BrowserInfo { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreationTime { get; set; } public DateTime CreationTime { get; set; }
} }
} }

27
modules/auditing/Sanhe.Abp.Auditing.Application.Contracts/Sanhe/Abp/Auditing/SecurityLogs/SecurityLogGetByPagedDto.cs

@ -5,14 +5,41 @@ namespace Sanhe.Abp.Auditing.SecurityLogs
{ {
public class SecurityLogGetByPagedDto : PagedAndSortedResultRequestDto public class SecurityLogGetByPagedDto : PagedAndSortedResultRequestDto
{ {
/// <summary>
/// 开始时间
/// </summary>
public DateTime? StartTime { get; set; } public DateTime? StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime? EndTime { get; set; } public DateTime? EndTime { get; set; }
/// <summary>
/// 应用名称
/// </summary>
public string ApplicationName { get; set; } public string ApplicationName { get; set; }
/// <summary>
/// 标识
/// </summary>
public string Identity { get; set; } public string Identity { get; set; }
/// <summary>
/// 方法名称
/// </summary>
public string ActionName { get; set; } public string ActionName { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public Guid? UserId { get; set; } public Guid? UserId { get; set; }
/// <summary>
/// 用户名称
/// </summary>
public string UserName { get; set; } public string UserName { get; set; }
/// <summary>
/// 客户端Id
/// </summary>
public string ClientId { get; set; } public string ClientId { get; set; }
/// <summary>
/// 链路标识
/// </summary>
public string CorrelationId { get; set; } public string CorrelationId { get; set; }
} }
} }

2
modules/auditing/Sanhe.Abp.Auditing.Application/Sanhe/Abp/Auditing/AbpAuditingMapperProfile.cs

@ -1,6 +1,6 @@
using AutoMapper; using AutoMapper;
using Sanhe.Abp.Auditing.AuditLogs; using Sanhe.Abp.Auditing.AuditLogs;
using Sanhe.Abp.Auditing.Logging.Dto; using Sanhe.Abp.Auditing.Logging;
using Sanhe.Abp.Auditing.SecurityLogs; using Sanhe.Abp.Auditing.SecurityLogs;
using Sanhe.Abp.AuditLogging; using Sanhe.Abp.AuditLogging;
using Sanhe.Abp.Logging; using Sanhe.Abp.Logging;

3
modules/auditing/Sanhe.Abp.Auditing.Application/Sanhe/Abp/Auditing/Logging/LogAppService.cs

@ -1,5 +1,4 @@
using Sanhe.Abp.Auditing.Logging.Dto; using Sanhe.Abp.Logging;
using Sanhe.Abp.Logging;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;

1
modules/auditing/Sanhe.Abp.Auditing.HttpApi/Sanhe/Abp/Auditing/Logging/LogController.cs

@ -1,5 +1,4 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Sanhe.Abp.Auditing.Logging.Dto;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Dtos;

26
modules/common/Sanhe.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/AbpEntityTypeBuilderExtensions.cs

@ -1,26 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.ComponentModel;
using System.Reflection;
namespace Volo.Abp.EntityFrameworkCore.Modeling;
public static class AbpEntityTypeBuilderExtensions
{
public static void ConfigureCommentByDisplayName<T>(this EntityTypeBuilder<T> builder) where T : class
{
Check.NotNull(builder, nameof(builder));
Type type = typeof(T);
PropertyInfo[] properties = type.GetProperties();
foreach (PropertyInfo propertyInfo in properties)
{
string text = propertyInfo.GetCustomAttribute<DisplayNameAttribute>()?.DisplayName;
if (!string.IsNullOrEmpty(text))
{
builder.Property(propertyInfo.Name).HasComment(text);
}
}
builder.HasComment(type.GetCustomAttribute<DisplayNameAttribute>()?.DisplayName);
}
}

90
modules/common/Sanhe.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/EntityTypeBuilderExtensions.cs

@ -0,0 +1,90 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.ComponentModel;
using System.Reflection;
using Volo.Abp.Auditing;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities;
using Volo.Abp.MultiTenancy;
namespace Volo.Abp.EntityFrameworkCore.Modeling;
public static class EntityTypeBuilderExtensions
{
/// <summary>
/// 根据<see cref="DisplayNameAttribute.DisplayName"/>设置字段注释。
/// </summary>
/// <typeparam name="T">实体</typeparam>
/// <param name="builder"></param>
public static void ConfigureCommentByDisplayName<T>(this EntityTypeBuilder<T> builder) where T : class
{
Check.NotNull(builder, nameof(builder));
var type = typeof(T);
var properties = type.GetProperties();
foreach (var propertyInfo in properties)
{
var text = propertyInfo.GetCustomAttribute<DisplayNameAttribute>()?.DisplayName;
if (!string.IsNullOrEmpty(text))
{
builder.Property(propertyInfo.Name).HasComment(text);
}
}
builder.HasComment(type.GetCustomAttribute<DisplayNameAttribute>()?.DisplayName);
}
public static void ConfigureByConventionWithChineseComment(this EntityTypeBuilder b)
{
AbpEntityTypeBuilderExtensions.ConfigureByConvention(b);
if (b.Metadata.ClrType.IsAssignableTo<IHasConcurrencyStamp>())
{
b.Property(nameof(IHasConcurrencyStamp.ConcurrencyStamp)).HasComment("并发标识");
}
if (b.Metadata.ClrType.IsAssignableTo<IHasExtraProperties>())
{
b.Property<ExtraPropertyDictionary>(nameof(IHasExtraProperties.ExtraProperties)).HasComment("扩展属性");
}
if (b.Metadata.ClrType.IsAssignableTo<IMayHaveCreator>())
{
b.Property(nameof(IMayHaveCreator.CreatorId)).HasComment("创建人Id");
}
if (b.Metadata.ClrType.IsAssignableTo<ISoftDelete>())
{
b.Property(nameof(ISoftDelete.IsDeleted)).HasComment("是否删除");
}
if (b.Metadata.ClrType.IsAssignableTo<IHasDeletionTime>())
{
b.Property(nameof(IHasDeletionTime.DeletionTime)).HasComment("删除时间");
}
if (b.Metadata.ClrType.IsAssignableTo<IDeletionAuditedObject>())
{
b.Property(nameof(IDeletionAuditedObject.DeleterId)).HasComment("删除人Id");
}
if (b.Metadata.ClrType.IsAssignableTo<IHasCreationTime>())
{
b.Property(nameof(IHasCreationTime.CreationTime)).HasComment("创建时间");
}
if (b.Metadata.ClrType.IsAssignableTo<IHasModificationTime>())
{
b.Property(nameof(IHasModificationTime.LastModificationTime)).HasComment("修改时间");
}
if (b.Metadata.ClrType.IsAssignableTo<IModificationAuditedObject>())
{
b.Property(nameof(IModificationAuditedObject.LastModifierId)).HasComment("最后修改人Id");
}
if (b.Metadata.ClrType.IsAssignableTo<IMultiTenant>())
{
b.Property(nameof(IMultiTenant.TenantId)).HasComment("租户Id");
}
}
}

1
modules/common/Sanhe.Abp.Features.LimitValidation/Sanhe/Abp/Features/LimitValidation/FeaturesLimitValidationInterceptor.cs

@ -55,7 +55,6 @@ public class FeaturesLimitValidationInterceptor : AbpInterceptor, ITransientDepe
// 执行代理方法 // 执行代理方法
await invocation.ProceedAsync(); await invocation.ProceedAsync();
// 调用次数递增 // 调用次数递增
// TODO: 使用Redis结合Lua脚本?
await PostCheckFeatureAsync(limitFeatureContext); await PostCheckFeatureAsync(limitFeatureContext);
} }

Loading…
Cancel
Save