namespace Admin.NET.Plugin.AiDOP.Entity.DataPlatform;
/// 第三方推数入站授权。不走 CodeFirst,以 UpdateScripts 为唯一建表口径。
[SugarTable("mdp_inbound_grant", "第三方推数入站授权")]
public class MdpInboundGrant
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
public long Id { get; set; }
[SugarColumn(ColumnName = "tenant_id")]
public long TenantId { get; set; }
[SugarColumn(ColumnName = "access_key", Length = 64)]
public string AccessKey { get; set; } = string.Empty;
[SugarColumn(ColumnName = "entity_code", Length = 100)]
public string EntityCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "factory_id", IsNullable = true)]
public long? FactoryId { get; set; }
[SugarColumn(ColumnName = "source_code", Length = 50)]
public string SourceCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "rate_limit_per_min")]
public int RateLimitPerMin { get; set; } = 60;
[SugarColumn(ColumnName = "batch_row_limit")]
public int BatchRowLimit { get; set; } = 500;
[SugarColumn(ColumnName = "ip_allowlist", Length = 1000, IsNullable = true)]
public string IpAllowlist { get; set; }
[SugarColumn(ColumnName = "status")]
public int Status { get; set; } = 1;
[SugarColumn(ColumnName = "remark", Length = 500, IsNullable = true)]
public string Remark { get; set; }
[SugarColumn(ColumnName = "create_time")]
public DateTime CreateTime { get; set; }
[SugarColumn(ColumnName = "update_time")]
public DateTime UpdateTime { get; set; }
}
/// 入站请求幂等状态机 + 审计。不走 CodeFirst。
[SugarTable("mdp_inbound_request", "第三方推数入站请求")]
public class MdpInboundRequest
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
public long Id { get; set; }
[SugarColumn(ColumnName = "tenant_id")]
public long TenantId { get; set; }
[SugarColumn(ColumnName = "access_key", Length = 64)]
public string AccessKey { get; set; } = string.Empty;
[SugarColumn(ColumnName = "entity_code", Length = 100)]
public string EntityCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "idempotency_key", Length = 128)]
public string IdempotencyKey { get; set; } = string.Empty;
[SugarColumn(ColumnName = "request_hash", Length = 64)]
public string RequestHash { get; set; } = string.Empty;
[SugarColumn(ColumnName = "sync_batch_id", Length = 64)]
public string SyncBatchId { get; set; } = string.Empty;
[SugarColumn(ColumnName = "snapshot_id", Length = 64, IsNullable = true)]
public string SnapshotId { get; set; }
[SugarColumn(ColumnName = "status", Length = 16)]
public string Status { get; set; } = "RECEIVED";
[SugarColumn(ColumnName = "http_status")]
public int HttpStatus { get; set; }
[SugarColumn(ColumnName = "result_code")]
public int ResultCode { get; set; }
[SugarColumn(ColumnName = "accepted")]
public int Accepted { get; set; }
[SugarColumn(ColumnName = "rejected")]
public int Rejected { get; set; }
[SugarColumn(ColumnName = "stale_rejected")]
public int StaleRejected { get; set; }
[SugarColumn(ColumnName = "equal_ts_override")]
public int EqualTsOverride { get; set; }
[SugarColumn(ColumnName = "receipt_json", ColumnDataType = "mediumtext", IsNullable = true)]
public string ReceiptJson { get; set; }
[SugarColumn(ColumnName = "error_msg", Length = 1000, IsNullable = true)]
public string ErrorMsg { get; set; }
[SugarColumn(ColumnName = "client_ip", Length = 64, IsNullable = true)]
public string ClientIp { get; set; }
[SugarColumn(ColumnName = "elapsed_ms")]
public int ElapsedMs { get; set; }
[SugarColumn(ColumnName = "create_time")]
public DateTime CreateTime { get; set; }
[SugarColumn(ColumnName = "update_time")]
public DateTime UpdateTime { get; set; }
}
/// 入站原始信封归档。不走 CodeFirst。
[SugarTable("mdp_inbound_envelope", "入站原始信封归档")]
public class MdpInboundEnvelope
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
public long Id { get; set; }
[SugarColumn(ColumnName = "request_id")]
public long RequestId { get; set; }
[SugarColumn(ColumnName = "tenant_id")]
public long TenantId { get; set; }
[SugarColumn(ColumnName = "access_key", Length = 64)]
public string AccessKey { get; set; } = string.Empty;
[SugarColumn(ColumnName = "entity_code", Length = 100)]
public string EntityCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "path", Length = 300)]
public string Path { get; set; } = string.Empty;
[SugarColumn(ColumnName = "headers_json", ColumnDataType = "text", IsNullable = true)]
public string HeadersJson { get; set; }
[SugarColumn(ColumnName = "body", ColumnDataType = "mediumtext")]
public string Body { get; set; } = string.Empty;
[SugarColumn(ColumnName = "body_sha256", Length = 64)]
public string BodySha256 { get; set; } = string.Empty;
[SugarColumn(ColumnName = "create_time")]
public DateTime CreateTime { get; set; }
}
/// 入站全量快照批次。不走 CodeFirst。
[SugarTable("mdp_inbound_snapshot", "入站全量快照批次")]
public class MdpInboundSnapshot
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
public long Id { get; set; }
[SugarColumn(ColumnName = "snapshot_id", Length = 64)]
public string SnapshotId { get; set; } = string.Empty;
[SugarColumn(ColumnName = "tenant_id")]
public long TenantId { get; set; }
[SugarColumn(ColumnName = "access_key", Length = 64)]
public string AccessKey { get; set; } = string.Empty;
[SugarColumn(ColumnName = "entity_code", Length = 100)]
public string EntityCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "status", Length = 16)]
public string Status { get; set; } = "OPEN";
[SugarColumn(ColumnName = "last_seq")]
public int LastSeq { get; set; }
[SugarColumn(ColumnName = "row_count")]
public int RowCount { get; set; }
[SugarColumn(ColumnName = "diff_missing", IsNullable = true)]
public int? DiffMissing { get; set; }
[SugarColumn(ColumnName = "diff_ratio", DecimalDigits = 4, IsNullable = true)]
public decimal? DiffRatio { get; set; }
[SugarColumn(ColumnName = "opened_at")]
public DateTime OpenedAt { get; set; }
[SugarColumn(ColumnName = "expire_at")]
public DateTime ExpireAt { get; set; }
[SugarColumn(ColumnName = "committed_at", IsNullable = true)]
public DateTime? CommittedAt { get; set; }
[SugarColumn(ColumnName = "create_time")]
public DateTime CreateTime { get; set; }
[SugarColumn(ColumnName = "update_time")]
public DateTime UpdateTime { get; set; }
}
/// 主数据镜像键冲突待裁决。不走 CodeFirst。
[SugarTable("mdp_inbound_conflict", "主数据镜像键冲突待裁决")]
public class MdpInboundConflict
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
public long Id { get; set; }
[SugarColumn(ColumnName = "tenant_id")]
public long TenantId { get; set; }
[SugarColumn(ColumnName = "entity_code", Length = 100)]
public string EntityCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "biz_key", Length = 300)]
public string BizKey { get; set; } = string.Empty;
[SugarColumn(ColumnName = "source_system", Length = 50)]
public string SourceSystem { get; set; } = string.Empty;
[SugarColumn(ColumnName = "incoming_raw", ColumnDataType = "mediumtext")]
public string IncomingRaw { get; set; } = string.Empty;
[SugarColumn(ColumnName = "mirror_table", Length = 64)]
public string MirrorTable { get; set; } = string.Empty;
[SugarColumn(ColumnName = "conflict_type", Length = 40)]
public string ConflictType { get; set; } = string.Empty;
[SugarColumn(ColumnName = "status", Length = 16)]
public string Status { get; set; } = "PENDING";
[SugarColumn(ColumnName = "resolution", Length = 500, IsNullable = true)]
public string Resolution { get; set; }
[SugarColumn(ColumnName = "create_time")]
public DateTime CreateTime { get; set; }
[SugarColumn(ColumnName = "update_time")]
public DateTime UpdateTime { get; set; }
}
/// 入站对外契约字段两层映射。与 PULL 的 mdp_field_mapping 不是同一张表。
[SugarTable("mdp_field_map", "入站对外契约字段两层映射")]
public class MdpFieldMap
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, IsIdentity = true)]
public long Id { get; set; }
[SugarColumn(ColumnName = "tenant_id")]
public long TenantId { get; set; }
[SugarColumn(ColumnName = "entity_code", Length = 100)]
public string EntityCode { get; set; } = string.Empty;
[SugarColumn(ColumnName = "access_key", Length = 64)]
public string AccessKey { get; set; } = "*";
[SugarColumn(ColumnName = "contract_field", Length = 200)]
public string ContractField { get; set; } = string.Empty;
[SugarColumn(ColumnName = "raw_key", Length = 200)]
public string RawKey { get; set; } = string.Empty;
[SugarColumn(ColumnName = "is_required")]
public int IsRequired { get; set; }
[SugarColumn(ColumnName = "status")]
public int Status { get; set; } = 1;
[SugarColumn(ColumnName = "create_time")]
public DateTime CreateTime { get; set; }
[SugarColumn(ColumnName = "update_time")]
public DateTime UpdateTime { get; set; }
}