版本260406

This commit is contained in:
2026-04-06 22:04:05 +08:00
parent 7dc5e73af7
commit 0b150470be
216 changed files with 98993 additions and 33 deletions

View File

@@ -0,0 +1,192 @@
namespace OrpaonVision.Core.Audit.Contracts;
/// <summary>
/// 审计统计结果。
/// </summary>
public sealed class AuditStatisticsDto
{
/// <summary>
/// 统计时间范围开始UTC
/// </summary>
public DateTime StartTimeUtc { get; init; }
/// <summary>
/// 统计时间范围结束UTC
/// </summary>
public DateTime EndTimeUtc { get; init; }
/// <summary>
/// 总操作次数。
/// </summary>
public long TotalOperations { get; init; }
/// <summary>
/// 成功操作次数。
/// </summary>
public long SuccessOperations { get; init; }
/// <summary>
/// 失败操作次数。
/// </summary>
public long FailedOperations { get; init; }
/// <summary>
/// 成功率。
/// </summary>
public decimal SuccessRate { get; init; }
/// <summary>
/// 平均响应时间(毫秒)。
/// </summary>
public decimal AverageResponseTimeMs { get; init; }
/// <summary>
/// 按操作类型分组的统计。
/// </summary>
public IReadOnlyList<OperationTypeStatisticsDto> OperationTypeStatistics { get; init; } = [];
/// <summary>
/// 按模块分组的统计。
/// </summary>
public IReadOnlyList<ModuleStatisticsDto> ModuleStatistics { get; init; } = [];
/// <summary>
/// 按用户分组的统计。
/// </summary>
public IReadOnlyList<UserStatisticsDto> UserStatistics { get; init; } = [];
/// <summary>
/// 按风险级别分组的统计。
/// </summary>
public IReadOnlyList<RiskLevelStatisticsDto> RiskLevelStatistics { get; init; } = [];
/// <summary>
/// 每小时操作统计。
/// </summary>
public IReadOnlyList<HourlyStatisticsDto> HourlyStatistics { get; init; } = [];
}
/// <summary>
/// 操作类型统计。
/// </summary>
public sealed class OperationTypeStatisticsDto
{
/// <summary>
/// 操作类型。
/// </summary>
public string ActionType { get; init; } = string.Empty;
/// <summary>
/// 操作次数。
/// </summary>
public long Count { get; init; }
/// <summary>
/// 占比。
/// </summary>
public decimal Percentage { get; init; }
/// <summary>
/// 平均响应时间(毫秒)。
/// </summary>
public decimal AverageResponseTimeMs { get; init; }
}
/// <summary>
/// 模块统计。
/// </summary>
public sealed class ModuleStatisticsDto
{
/// <summary>
/// 模块名称。
/// </summary>
public string Module { get; init; } = string.Empty;
/// <summary>
/// 操作次数。
/// </summary>
public long Count { get; init; }
/// <summary>
/// 占比。
/// </summary>
public decimal Percentage { get; init; }
/// <summary>
/// 平均响应时间(毫秒)。
/// </summary>
public decimal AverageResponseTimeMs { get; init; }
}
/// <summary>
/// 用户统计。
/// </summary>
public sealed class UserStatisticsDto
{
/// <summary>
/// 用户ID。
/// </summary>
public Guid UserId { get; init; }
/// <summary>
/// 用户名。
/// </summary>
public string UserName { get; init; } = string.Empty;
/// <summary>
/// 操作次数。
/// </summary>
public long Count { get; init; }
/// <summary>
/// 最后操作时间UTC
/// </summary>
public DateTime LastOperatedAtUtc { get; init; }
}
/// <summary>
/// 风险级别统计。
/// </summary>
public sealed class RiskLevelStatisticsDto
{
/// <summary>
/// 风险级别。
/// </summary>
public string RiskLevel { get; init; } = string.Empty;
/// <summary>
/// 操作次数。
/// </summary>
public long Count { get; init; }
/// <summary>
/// 占比。
/// </summary>
public decimal Percentage { get; init; }
}
/// <summary>
/// 每小时统计。
/// </summary>
public sealed class HourlyStatisticsDto
{
/// <summary>
/// 小时0-23
/// </summary>
public int Hour { get; init; }
/// <summary>
/// 操作次数。
/// </summary>
public long Count { get; init; }
/// <summary>
/// 成功操作次数。
/// </summary>
public long SuccessCount { get; init; }
/// <summary>
/// 失败操作次数。
/// </summary>
public long FailedCount { get; init; }
}