AdoS8OrderFlowSnapshot.cs 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. namespace Admin.NET.Plugin.AiDOP.Entity.S8.OrderFlow;
  2. /// <summary>
  3. /// ORDER-FLOW-S8-INTEGRATED-DOMAIN-RESET-1 t1a:S8 订单链路基线快照表(baseline 聚合)。
  4. /// 同时替代 service 层任何 baseline 硬编码。
  5. /// service 读取协议:scope_code=BASELINE_PPT → 取本表行;scope_code=CURRENT_FILTERED → 实时聚合明细表。
  6. /// 任何 baseline 数值(如总订单数 / 平均时长 / 5 阶段聚合)严禁出现在 service 字面量。
  7. /// </summary>
  8. [SugarTable("ado_s8_order_flow_snapshot", "S8 订单执行链路聚合快照")]
  9. [SugarIndex("uk_order_flow_snapshot_code", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(SnapshotCode), OrderByType.Asc, IsUnique = true)]
  10. [SugarIndex("idx_order_flow_snapshot_scope", nameof(TenantId), OrderByType.Asc, nameof(FactoryId), OrderByType.Asc, nameof(ScopeCode), OrderByType.Asc, nameof(IsDeleted), OrderByType.Asc)]
  11. public class AdoS8OrderFlowSnapshot
  12. {
  13. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, ColumnDataType = "bigint")]
  14. public long Id { get; set; }
  15. [SugarColumn(ColumnName = "tenant_id", ColumnDataType = "bigint")]
  16. public long TenantId { get; set; }
  17. [SugarColumn(ColumnName = "factory_id", ColumnDataType = "bigint")]
  18. public long FactoryId { get; set; }
  19. /// <summary>快照业务键,唯一。t2c seed 首条值固定为 CHAIN_AGGREGATE_BASELINE。</summary>
  20. [SugarColumn(ColumnName = "snapshot_code", Length = 64)]
  21. public string SnapshotCode { get; set; } = string.Empty;
  22. /// <summary>BASELINE_PPT / BASELINE_DEMO。t2c seed 首条值固定为 BASELINE_PPT。</summary>
  23. [SugarColumn(ColumnName = "scope_code", Length = 32)]
  24. public string ScopeCode { get; set; } = string.Empty;
  25. [SugarColumn(ColumnName = "total_orders")]
  26. public int TotalOrders { get; set; }
  27. [SugarColumn(ColumnName = "total_customers")]
  28. public int TotalCustomers { get; set; }
  29. [SugarColumn(ColumnName = "avg_response_minutes", DecimalDigits = 2, Length = 8)]
  30. public decimal AvgResponseMinutes { get; set; }
  31. [SugarColumn(ColumnName = "avg_processing_minutes", DecimalDigits = 2, Length = 8)]
  32. public decimal AvgProcessingMinutes { get; set; }
  33. [SugarColumn(ColumnName = "avg_loss_minutes", DecimalDigits = 2, Length = 8)]
  34. public decimal AvgLossMinutes { get; set; }
  35. /// <summary>5 阶段聚合 JSON。每项含 orderFlowCode/orderFlowName/kpiAvgDays/actualAvgDays/onTimeRate(int %)/green/yellow/red/pending。t2c seed 写入 BASELINE_PPT 真值。</summary>
  36. [SugarColumn(ColumnName = "stage_snapshots_json", ColumnDataType = "longtext")]
  37. public string StageSnapshotsJson { get; set; } = string.Empty;
  38. /// <summary>PPT / DEMO。</summary>
  39. [SugarColumn(ColumnName = "scenario_code", Length = 16)]
  40. public string ScenarioCode { get; set; } = "PPT";
  41. /// <summary>SEED / IMPORT / AGG。</summary>
  42. [SugarColumn(ColumnName = "data_source", Length = 16)]
  43. public string DataSource { get; set; } = "SEED";
  44. [SugarColumn(ColumnName = "created_at")]
  45. public DateTime CreatedAt { get; set; } = DateTime.Now;
  46. [SugarColumn(ColumnName = "updated_at", IsNullable = true)]
  47. public DateTime? UpdatedAt { get; set; }
  48. [SugarColumn(ColumnName = "is_deleted", ColumnDataType = "boolean")]
  49. public bool IsDeleted { get; set; }
  50. }