MdpInboundEntities.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. namespace Admin.NET.Plugin.AiDOP.Entity.DataPlatform;
  2. /// <summary>第三方推数入站授权。不走 CodeFirst,以 UpdateScripts 为唯一建表口径。</summary>
  3. [SugarTable("mdp_inbound_grant", "第三方推数入站授权")]
  4. public class MdpInboundGrant
  5. {
  6. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
  7. public long Id { get; set; }
  8. [SugarColumn(ColumnName = "tenant_id")]
  9. public long TenantId { get; set; }
  10. [SugarColumn(ColumnName = "access_key", Length = 64)]
  11. public string AccessKey { get; set; } = string.Empty;
  12. [SugarColumn(ColumnName = "entity_code", Length = 100)]
  13. public string EntityCode { get; set; } = string.Empty;
  14. [SugarColumn(ColumnName = "factory_id", IsNullable = true)]
  15. public long? FactoryId { get; set; }
  16. [SugarColumn(ColumnName = "source_code", Length = 50)]
  17. public string SourceCode { get; set; } = string.Empty;
  18. [SugarColumn(ColumnName = "rate_limit_per_min")]
  19. public int RateLimitPerMin { get; set; } = 60;
  20. [SugarColumn(ColumnName = "batch_row_limit")]
  21. public int BatchRowLimit { get; set; } = 500;
  22. [SugarColumn(ColumnName = "ip_allowlist", Length = 1000, IsNullable = true)]
  23. public string IpAllowlist { get; set; }
  24. [SugarColumn(ColumnName = "status")]
  25. public int Status { get; set; } = 1;
  26. [SugarColumn(ColumnName = "remark", Length = 500, IsNullable = true)]
  27. public string Remark { get; set; }
  28. [SugarColumn(ColumnName = "create_time")]
  29. public DateTime CreateTime { get; set; }
  30. [SugarColumn(ColumnName = "update_time")]
  31. public DateTime UpdateTime { get; set; }
  32. }
  33. /// <summary>入站请求幂等状态机 + 审计。不走 CodeFirst。</summary>
  34. [SugarTable("mdp_inbound_request", "第三方推数入站请求")]
  35. public class MdpInboundRequest
  36. {
  37. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
  38. public long Id { get; set; }
  39. [SugarColumn(ColumnName = "tenant_id")]
  40. public long TenantId { get; set; }
  41. [SugarColumn(ColumnName = "access_key", Length = 64)]
  42. public string AccessKey { get; set; } = string.Empty;
  43. [SugarColumn(ColumnName = "entity_code", Length = 100)]
  44. public string EntityCode { get; set; } = string.Empty;
  45. [SugarColumn(ColumnName = "idempotency_key", Length = 128)]
  46. public string IdempotencyKey { get; set; } = string.Empty;
  47. [SugarColumn(ColumnName = "request_hash", Length = 64)]
  48. public string RequestHash { get; set; } = string.Empty;
  49. [SugarColumn(ColumnName = "sync_batch_id", Length = 64)]
  50. public string SyncBatchId { get; set; } = string.Empty;
  51. [SugarColumn(ColumnName = "snapshot_id", Length = 64, IsNullable = true)]
  52. public string SnapshotId { get; set; }
  53. [SugarColumn(ColumnName = "status", Length = 16)]
  54. public string Status { get; set; } = "RECEIVED";
  55. [SugarColumn(ColumnName = "http_status")]
  56. public int HttpStatus { get; set; }
  57. [SugarColumn(ColumnName = "result_code")]
  58. public int ResultCode { get; set; }
  59. [SugarColumn(ColumnName = "accepted")]
  60. public int Accepted { get; set; }
  61. [SugarColumn(ColumnName = "rejected")]
  62. public int Rejected { get; set; }
  63. [SugarColumn(ColumnName = "stale_rejected")]
  64. public int StaleRejected { get; set; }
  65. [SugarColumn(ColumnName = "equal_ts_override")]
  66. public int EqualTsOverride { get; set; }
  67. [SugarColumn(ColumnName = "receipt_json", ColumnDataType = "mediumtext", IsNullable = true)]
  68. public string ReceiptJson { get; set; }
  69. [SugarColumn(ColumnName = "error_msg", Length = 1000, IsNullable = true)]
  70. public string ErrorMsg { get; set; }
  71. [SugarColumn(ColumnName = "client_ip", Length = 64, IsNullable = true)]
  72. public string ClientIp { get; set; }
  73. [SugarColumn(ColumnName = "elapsed_ms")]
  74. public int ElapsedMs { get; set; }
  75. [SugarColumn(ColumnName = "create_time")]
  76. public DateTime CreateTime { get; set; }
  77. [SugarColumn(ColumnName = "update_time")]
  78. public DateTime UpdateTime { get; set; }
  79. }
  80. /// <summary>入站原始信封归档。不走 CodeFirst。</summary>
  81. [SugarTable("mdp_inbound_envelope", "入站原始信封归档")]
  82. public class MdpInboundEnvelope
  83. {
  84. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
  85. public long Id { get; set; }
  86. [SugarColumn(ColumnName = "request_id")]
  87. public long RequestId { get; set; }
  88. [SugarColumn(ColumnName = "tenant_id")]
  89. public long TenantId { get; set; }
  90. [SugarColumn(ColumnName = "access_key", Length = 64)]
  91. public string AccessKey { get; set; } = string.Empty;
  92. [SugarColumn(ColumnName = "entity_code", Length = 100)]
  93. public string EntityCode { get; set; } = string.Empty;
  94. [SugarColumn(ColumnName = "path", Length = 300)]
  95. public string Path { get; set; } = string.Empty;
  96. [SugarColumn(ColumnName = "headers_json", ColumnDataType = "text", IsNullable = true)]
  97. public string HeadersJson { get; set; }
  98. [SugarColumn(ColumnName = "body", ColumnDataType = "mediumtext")]
  99. public string Body { get; set; } = string.Empty;
  100. [SugarColumn(ColumnName = "body_sha256", Length = 64)]
  101. public string BodySha256 { get; set; } = string.Empty;
  102. [SugarColumn(ColumnName = "create_time")]
  103. public DateTime CreateTime { get; set; }
  104. }
  105. /// <summary>入站全量快照批次。不走 CodeFirst。</summary>
  106. [SugarTable("mdp_inbound_snapshot", "入站全量快照批次")]
  107. public class MdpInboundSnapshot
  108. {
  109. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
  110. public long Id { get; set; }
  111. [SugarColumn(ColumnName = "snapshot_id", Length = 64)]
  112. public string SnapshotId { get; set; } = string.Empty;
  113. [SugarColumn(ColumnName = "tenant_id")]
  114. public long TenantId { get; set; }
  115. [SugarColumn(ColumnName = "access_key", Length = 64)]
  116. public string AccessKey { get; set; } = string.Empty;
  117. [SugarColumn(ColumnName = "entity_code", Length = 100)]
  118. public string EntityCode { get; set; } = string.Empty;
  119. [SugarColumn(ColumnName = "status", Length = 16)]
  120. public string Status { get; set; } = "OPEN";
  121. [SugarColumn(ColumnName = "last_seq")]
  122. public int LastSeq { get; set; }
  123. [SugarColumn(ColumnName = "row_count")]
  124. public int RowCount { get; set; }
  125. [SugarColumn(ColumnName = "diff_missing", IsNullable = true)]
  126. public int? DiffMissing { get; set; }
  127. [SugarColumn(ColumnName = "diff_ratio", DecimalDigits = 4, IsNullable = true)]
  128. public decimal? DiffRatio { get; set; }
  129. [SugarColumn(ColumnName = "opened_at")]
  130. public DateTime OpenedAt { get; set; }
  131. [SugarColumn(ColumnName = "expire_at")]
  132. public DateTime ExpireAt { get; set; }
  133. [SugarColumn(ColumnName = "committed_at", IsNullable = true)]
  134. public DateTime? CommittedAt { get; set; }
  135. [SugarColumn(ColumnName = "create_time")]
  136. public DateTime CreateTime { get; set; }
  137. [SugarColumn(ColumnName = "update_time")]
  138. public DateTime UpdateTime { get; set; }
  139. }
  140. /// <summary>主数据镜像键冲突待裁决。不走 CodeFirst。</summary>
  141. [SugarTable("mdp_inbound_conflict", "主数据镜像键冲突待裁决")]
  142. public class MdpInboundConflict
  143. {
  144. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
  145. public long Id { get; set; }
  146. [SugarColumn(ColumnName = "tenant_id")]
  147. public long TenantId { get; set; }
  148. [SugarColumn(ColumnName = "entity_code", Length = 100)]
  149. public string EntityCode { get; set; } = string.Empty;
  150. [SugarColumn(ColumnName = "biz_key", Length = 300)]
  151. public string BizKey { get; set; } = string.Empty;
  152. [SugarColumn(ColumnName = "source_system", Length = 50)]
  153. public string SourceSystem { get; set; } = string.Empty;
  154. [SugarColumn(ColumnName = "incoming_raw", ColumnDataType = "mediumtext")]
  155. public string IncomingRaw { get; set; } = string.Empty;
  156. [SugarColumn(ColumnName = "mirror_table", Length = 64)]
  157. public string MirrorTable { get; set; } = string.Empty;
  158. [SugarColumn(ColumnName = "conflict_type", Length = 40)]
  159. public string ConflictType { get; set; } = string.Empty;
  160. [SugarColumn(ColumnName = "status", Length = 16)]
  161. public string Status { get; set; } = "PENDING";
  162. [SugarColumn(ColumnName = "resolution", Length = 500, IsNullable = true)]
  163. public string Resolution { get; set; }
  164. [SugarColumn(ColumnName = "create_time")]
  165. public DateTime CreateTime { get; set; }
  166. [SugarColumn(ColumnName = "update_time")]
  167. public DateTime UpdateTime { get; set; }
  168. }
  169. /// <summary>入站对外契约字段两层映射。与 PULL 的 mdp_field_mapping 不是同一张表。</summary>
  170. [SugarTable("mdp_field_map", "入站对外契约字段两层映射")]
  171. public class MdpFieldMap
  172. {
  173. [SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
  174. public long Id { get; set; }
  175. [SugarColumn(ColumnName = "tenant_id")]
  176. public long TenantId { get; set; }
  177. [SugarColumn(ColumnName = "entity_code", Length = 100)]
  178. public string EntityCode { get; set; } = string.Empty;
  179. [SugarColumn(ColumnName = "access_key", Length = 64)]
  180. public string AccessKey { get; set; } = "*";
  181. [SugarColumn(ColumnName = "contract_field", Length = 200)]
  182. public string ContractField { get; set; } = string.Empty;
  183. [SugarColumn(ColumnName = "raw_key", Length = 200)]
  184. public string RawKey { get; set; } = string.Empty;
  185. [SugarColumn(ColumnName = "is_required")]
  186. public int IsRequired { get; set; }
  187. [SugarColumn(ColumnName = "status")]
  188. public int Status { get; set; } = 1;
  189. [SugarColumn(ColumnName = "create_time")]
  190. public DateTime CreateTime { get; set; }
  191. [SugarColumn(ColumnName = "update_time")]
  192. public DateTime UpdateTime { get; set; }
  193. }