namespace Admin.NET.Plugin.AiDOP.Dto.SmartOps;
/// 业务来源登记 —— 保存入参。ModuleCode / TenantId 一律后端解析,不接受前端指定。
public sealed class KpiBusinessInputUpsertDto
{
public string MetricCode { get; set; } = string.Empty;
/// 仅用于容错展示;实际存储的 ModuleCode 由后端从 MetricCode 解析。
public string? ModuleCode { get; set; }
/// 目标状态 PENDING_BUSINESS_FIELDS / PENDING_BUSINESS_SQL / READY_FOR_CONFIG。置 READY 时后端强校验。
public string BusinessInputStatus { get; set; } = "PENDING_BUSINESS_FIELDS";
public string? SourceSystem { get; set; }
public string? SourceTables { get; set; }
public string? SourceFields { get; set; }
public string? BusinessSqlSource { get; set; }
public string? BusinessSqlRemark { get; set; }
public string? BusinessOwner { get; set; }
public string? FieldOwner { get; set; }
public string? Remark { get; set; }
}
/// 业务来源登记 —— 输出。查询不到时后端返回 IsPersisted=false 的默认 PENDING_BUSINESS_FIELDS 视图。
public sealed class KpiBusinessInputDto
{
/// false=默认视图(库中无记录);true=已保存记录。前端据此区分默认与已维护。
public bool IsPersisted { get; set; }
public long? TenantId { get; set; }
public string MetricCode { get; set; } = string.Empty;
public string ModuleCode { get; set; } = string.Empty;
public string BusinessInputStatus { get; set; } = "PENDING_BUSINESS_FIELDS";
public string? SourceSystem { get; set; }
public string? SourceTables { get; set; }
public string? SourceFields { get; set; }
public string? BusinessSqlSource { get; set; }
public string? BusinessSqlRemark { get; set; }
public string? BusinessOwner { get; set; }
public string? FieldOwner { get; set; }
public string? Remark { get; set; }
public string? UpdatedBy { get; set; }
public DateTime? UpdatedAt { get; set; }
}
/// 运行日志查询入参。TenantId 不接受前端,由 MetricCode 解析。
public sealed class KpiRunLogQueryDto
{
public string MetricCode { get; set; } = string.Empty;
public string? ModuleCode { get; set; }
public int Page { get; set; } = 1;
public int PageSize { get; set; } = 20;
/// 可选状态过滤 SUCCESS / NO_DATA / FAILED。
public string? Status { get; set; }
public DateTime? StartTime { get; set; }
public DateTime? EndTime { get; set; }
}
/// 运行日志单条(脱敏:不含 SQL 明文 / 参数快照 / 连接串;错误摘要截断)。
public sealed class KpiRunLogItemDto
{
public long Id { get; set; }
public string BatchId { get; set; } = string.Empty;
public string MetricCode { get; set; } = string.Empty;
public string EngineType { get; set; } = string.Empty;
public int? VersionNo { get; set; }
public string? DataSourceCode { get; set; }
public string BizDate { get; set; } = string.Empty;
public string StartedAt { get; set; } = string.Empty;
public long DurationMs { get; set; }
public string Status { get; set; } = string.Empty;
public int RowCount { get; set; }
public decimal? MetricValue { get; set; }
public string? ErrorCode { get; set; }
public string? ErrorMessage { get; set; }
public string TriggerType { get; set; } = string.Empty;
}
/// 运行日志分页结果。
public sealed class KpiRunLogPageDto
{
public int Total { get; set; }
public int Page { get; set; }
public int PageSize { get; set; }
public List List { get; set; } = new();
}