AdoSmartOpsKpiCalcConfigDtos.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. namespace Admin.NET.Plugin.AiDOP.Dto.SmartOps;
  2. /// <summary>新增/编辑草稿。</summary>
  3. public sealed class KpiCalcConfigUpsertDto
  4. {
  5. public string MetricCode { get; set; } = string.Empty;
  6. public string ModuleCode { get; set; } = string.Empty;
  7. public string CalcEngineType { get; set; } = "CONFIG_SQL";
  8. public string? DataSourceCode { get; set; }
  9. public string? SqlScript { get; set; }
  10. public string? SqlParametersJson { get; set; }
  11. public int TimeoutSeconds { get; set; } = 30;
  12. public string? Remark { get; set; }
  13. }
  14. /// <summary>配置版本输出。</summary>
  15. public sealed class KpiCalcConfigDto
  16. {
  17. public long Id { get; set; }
  18. public long? TenantId { get; set; }
  19. public string MetricCode { get; set; } = string.Empty;
  20. public string ModuleCode { get; set; } = string.Empty;
  21. public int VersionNo { get; set; }
  22. public string CalcEngineType { get; set; } = string.Empty;
  23. public string? DataSourceCode { get; set; }
  24. public string? SqlScript { get; set; }
  25. public string? SqlParametersJson { get; set; }
  26. public int TimeoutSeconds { get; set; }
  27. public string PublishStatus { get; set; } = string.Empty;
  28. public bool IsCurrent { get; set; }
  29. public string? Remark { get; set; }
  30. public string? CreatedBy { get; set; }
  31. public DateTime CreatedAt { get; set; }
  32. public string? PublishedBy { get; set; }
  33. public DateTime? PublishedAt { get; set; }
  34. }
  35. /// <summary>SQL 校验入参。</summary>
  36. public sealed class KpiSqlValidateDto
  37. {
  38. public string? SqlScript { get; set; }
  39. }
  40. /// <summary>SQL 校验结果。</summary>
  41. public sealed class KpiSqlValidateResultDto
  42. {
  43. public bool Ok { get; set; }
  44. public string ValidationStatus { get; set; } = string.Empty; // VALID / INVALID
  45. public string? ErrorCode { get; set; }
  46. public string? ErrorMessage { get; set; }
  47. public List<string> ReferencedTables { get; set; } = new();
  48. }
  49. /// <summary>试算入参(服务端重读/重校验,不信任前端 tenant/权限)。</summary>
  50. public sealed class KpiSqlPreviewDto
  51. {
  52. public string MetricCode { get; set; } = string.Empty;
  53. public string ModuleCode { get; set; } = string.Empty;
  54. public string? DataSourceCode { get; set; }
  55. public string? SqlScript { get; set; }
  56. public int TimeoutSeconds { get; set; } = 20;
  57. public DateTime? BizDate { get; set; }
  58. }
  59. /// <summary>试算结果(不写正式 KPI 值)。</summary>
  60. public sealed class KpiSqlPreviewResultDto
  61. {
  62. public bool Ok { get; set; }
  63. public string ValidationStatus { get; set; } = string.Empty;
  64. public string MetricCode { get; set; } = string.Empty;
  65. public string EngineType { get; set; } = "CONFIG_SQL";
  66. public string? DataSourceCode { get; set; }
  67. public string BizDate { get; set; } = string.Empty;
  68. public long DurationMs { get; set; }
  69. public int RowCount { get; set; }
  70. public decimal? MetricValue { get; set; }
  71. public decimal? NumeratorValue { get; set; }
  72. public decimal? DenominatorValue { get; set; }
  73. public string ResultStatus { get; set; } = string.Empty; // SUCCESS / NO_DATA / FAILED
  74. public string? ResultMessage { get; set; }
  75. public string? ExecutedParameters { get; set; }
  76. public string? ErrorCode { get; set; }
  77. public string? ErrorMessage { get; set; }
  78. }