{ "schema_version": 1, "diagram_type": "erd", "meta": { "title": "恪澜通运营支撑系统 · 业务对象 / 领域模型", "subtitle": "核心业务实体与关系(各册『数据模型』章为真源)——按域分带,只画跨域主干关系;派生值与禁列不落库", "output": ".archify/domain-model-klt-bos-20261116-163406/klt-bos-domain-model.html", "locale": "zh-CN", "quality_profile": "showcase", "animation": "trace", "repository": { "url": "http://112.124.19.38:8080/klt-bos/klt-bos-service.git", "revision": "f47e4e70876f8debe5518774c0d7410715a4fec4", "link_mode": "local-only" }, "legend": { "mode": "all", "entries": { "pk": { "label": "主键" }, "fk": { "label": "外键" }, "uk": { "label": "唯一键" }, "one": { "label": "一" }, "many": { "label": "多" }, "optional": { "label": "可选" } } } }, "layout": { "mode": "grid", "origin": [ 24, 40 ], "gapX": 22, "gapY": 60, "entityW": 224, "headerH": 40, "rowH": 22 }, "entities": [ { "id": "customer", "label": "客户 customer", "tag": "客户域", "sublabel": "客户主档真源", "row": 0, "col": 0, "width": 244, "sources": [ { "path": "docs/详细设计说明书/02-第2册-客户批量导入与分账号/02-数据模型本域表.md", "label": "客户§2.1" } ], "attributes": [ { "name": "customer_id", "type": "varchar(32)", "key": "pk" }, { "name": "customer_name", "type": "varchar(128)" }, { "name": "subject_type", "type": "varchar(20)" }, { "name": "operator_id", "type": "bigint" }, { "name": "partner_id", "type": "bigint" }, { "name": "acct_status", "type": "varchar(20)" } ] }, { "id": "sub_account", "label": "分账号 sub_account", "tag": "客户域", "sublabel": "登录账号走平台管线", "row": 0, "col": 1, "width": 266, "sources": [ { "path": "docs/详细设计说明书/02-第2册-客户批量导入与分账号/02-数据模型本域表.md", "label": "客户§2.3" } ], "attributes": [ { "name": "sub_account_id", "type": "bigint", "key": "pk" }, { "name": "customer_id", "type": "varchar(32)", "key": "fk", "references": "customer.customer_id" }, { "name": "login_name", "type": "varchar(64)", "key": "uk" }, { "name": "user_id", "type": "bigint" }, { "name": "network_account_name", "type": "varchar(64)" }, { "name": "status", "type": "varchar(16)" } ] }, { "id": "import_batch", "label": "导入批次 import_batch", "tag": "客户域", "sublabel": "续传与按批导出依据", "row": 0, "col": 2, "width": 240, "sources": [ { "path": "docs/详细设计说明书/02-第2册-客户批量导入与分账号/02-数据模型本域表.md", "label": "客户§2.4" } ], "attributes": [ { "name": "batch_id", "type": "varchar(16)", "key": "pk" }, { "name": "importer_user_id", "type": "bigint" }, { "name": "status", "type": "varchar(20)" }, { "name": "total_rows", "type": "int" }, { "name": "success_rows", "type": "int" }, { "name": "failed_rows", "type": "int" } ] }, { "id": "contract", "label": "合同 contract", "tag": "订单域", "sublabel": "可见性继承签约客户", "row": 1, "col": 1, "width": 236, "sources": [ { "path": "docs/详细设计说明书/03-第3册-套餐合同与订单/02-数据模型本域表.md", "label": "订单§2.2" } ], "attributes": [ { "name": "contract_id", "type": "bigint", "key": "pk" }, { "name": "contract_no", "type": "varchar(48)", "key": "uk" }, { "name": "customer_id", "type": "varchar(32)", "key": "fk", "references": "customer.customer_id" }, { "name": "external_no", "type": "varchar(64)" }, { "name": "source", "type": "varchar(16)" }, { "name": "start_date", "type": "date" }, { "name": "end_date", "type": "date" } ] }, { "id": "contract_service_item", "label": "服务构成条目", "tag": "订单域", "sublabel": "contract_service_item", "row": 1, "col": 3, "width": 250, "sources": [ { "path": "docs/详细设计说明书/03-第3册-套餐合同与订单/02-数据模型本域表.md", "label": "订单§2.2" } ], "attributes": [ { "name": "item_id", "type": "bigint", "key": "pk" }, { "name": "contract_id", "type": "bigint", "key": "fk", "references": "contract.contract_id" }, { "name": "item_kind", "type": "varchar(16)" }, { "name": "plan_id", "type": "bigint", "key": "fk", "references": "plan.plan_id" }, { "name": "annual_price_cents", "type": "bigint" }, { "name": "line_exits", "type": "text[]" } ] }, { "id": "plan", "label": "套餐档位 plan", "tag": "订单域", "sublabel": "固定档/自定义档同表", "row": 1, "col": 2, "width": 244, "sources": [ { "path": "docs/详细设计说明书/03-第3册-套餐合同与订单/02-数据模型本域表.md", "label": "订单§2.1" } ], "attributes": [ { "name": "plan_id", "type": "bigint", "key": "pk" }, { "name": "plan_kind", "type": "varchar(16)" }, { "name": "customer_id", "type": "varchar(32)", "key": "fk", "references": "customer.customer_id" }, { "name": "use_category", "type": "varchar(20)" }, { "name": "annual_price_cents", "type": "bigint" }, { "name": "sub_account_quota", "type": "int" } ] }, { "id": "subscription", "label": "订单 subscription", "tag": "订单域", "sublabel": "升降配/叠加同表", "row": 1, "col": 0, "width": 266, "sources": [ { "path": "docs/详细设计说明书/03-第3册-套餐合同与订单/02-数据模型本域表.md", "label": "订单§2.3" } ], "attributes": [ { "name": "subscription_id", "type": "bigint", "key": "pk" }, { "name": "customer_id", "type": "varchar(32)", "key": "fk", "references": "customer.customer_id" }, { "name": "contract_id", "type": "bigint", "key": "fk", "references": "contract.contract_id" }, { "name": "plan_id", "type": "bigint", "key": "fk", "references": "plan.plan_id" }, { "name": "sub_mode", "type": "varchar(16)" }, { "name": "monthly_settle_cents", "type": "bigint" }, { "name": "actual_opened_at", "type": "timestamptz" }, { "name": "replaces_subscription_id", "type": "bigint" } ] }, { "id": "ticket_backfill", "label": "回填批次 ticket_backfill", "tag": "工单域", "sublabel": "一单一行·整体覆盖", "row": 2, "col": 2, "width": 246, "sources": [ { "path": "docs/详细设计说明书/05-第5册-工单与开停交付/02-数据模型本域表.md", "label": "工单§2.4" } ], "attributes": [ { "name": "backfill_id", "type": "bigint", "key": "pk" }, { "name": "ticket_id", "type": "bigint", "key": "fk", "references": "ticket.ticket_id" }, { "name": "exec_conclusion", "type": "varchar(16)" }, { "name": "actual_opened_date", "type": "date" }, { "name": "stop_done_date", "type": "date" }, { "name": "source", "type": "varchar(16)" } ] }, { "id": "ticket", "label": "工单 ticket", "tag": "工单域", "sublabel": "六类工单同表·七状态", "row": 2, "col": 0, "width": 250, "sources": [ { "path": "docs/详细设计说明书/05-第5册-工单与开停交付/02-数据模型本域表.md", "label": "工单§2.1" } ], "attributes": [ { "name": "ticket_id", "type": "bigint", "key": "pk" }, { "name": "ticket_no", "type": "varchar(32)", "key": "uk" }, { "name": "ticket_type", "type": "varchar(20)" }, { "name": "status", "type": "varchar(16)" }, { "name": "customer_id", "type": "varchar(32)", "key": "fk", "references": "customer.customer_id" }, { "name": "subscription_id", "type": "bigint", "key": "fk", "references": "subscription.subscription_id" }, { "name": "assign_team_id", "type": "bigint" }, { "name": "assignee_user_id", "type": "bigint" } ] }, { "id": "ticket_open_stop", "label": "开停记录 ticket_open_stop", "tag": "工单域", "sublabel": "计费事实源·一单一记录", "row": 2, "col": 3, "width": 250, "sources": [ { "path": "docs/详细设计说明书/05-第5册-工单与开停交付/02-数据模型本域表.md", "label": "工单§2.2" } ], "attributes": [ { "name": "open_stop_id", "type": "bigint", "key": "pk" }, { "name": "ticket_id", "type": "bigint", "key": "fk", "references": "ticket.ticket_id" }, { "name": "customer_id", "type": "varchar(32)", "key": "fk", "references": "customer.customer_id" }, { "name": "action", "type": "varchar(16)" }, { "name": "exec_status", "type": "varchar(16)" }, { "name": "exec_date", "type": "date" } ] }, { "id": "ticket_completion", "label": "竣工记录 ticket_completion", "tag": "工单域", "sublabel": "一单一次·回传与回执", "row": 2, "col": 1, "width": 250, "sources": [ { "path": "docs/详细设计说明书/05-第5册-工单与开停交付/02-数据模型本域表.md", "label": "工单§2.5" } ], "attributes": [ { "name": "completion_id", "type": "bigint", "key": "pk" }, { "name": "ticket_id", "type": "bigint", "key": "fk", "references": "ticket.ticket_id" }, { "name": "completion_no", "type": "varchar(32)", "key": "uk" }, { "name": "mode", "type": "varchar(16)" }, { "name": "pushed_at", "type": "date" }, { "name": "receipt_at", "type": "timestamptz" } ] }, { "id": "billing_receivable", "label": "应收结算 billing_receivable", "tag": "对账域", "sublabel": "一条=订单×自然月", "row": 3, "col": 0, "width": 258, "sources": [ { "path": "docs/详细设计说明书/06-第6册-计费与对账出账/02-数据模型本域表.md", "label": "对账§2.1" } ], "attributes": [ { "name": "period", "type": "varchar(7)", "key": "pk" }, { "name": "subscription_id", "type": "bigint", "key": "pk" }, { "name": "customer_id", "type": "bigint" }, { "name": "billing_days", "type": "smallint" }, { "name": "receivable_cents", "type": "bigint" }, { "name": "share_base_cents", "type": "bigint" }, { "name": "cost_snapshot", "type": "jsonb" } ] }, { "id": "bill_detail", "label": "账单明细 bill_detail", "tag": "对账域", "sublabel": "分成方×订单×自然月", "row": 3, "col": 1, "width": 250, "sources": [ { "path": "docs/详细设计说明书/06-第6册-计费与对账出账/02-数据模型本域表.md", "label": "对账§2.3" } ], "attributes": [ { "name": "detail_id", "type": "bigint", "key": "pk" }, { "name": "batch_id", "type": "bigint", "key": "fk", "references": "reconcile_batch.batch_id" }, { "name": "period", "type": "varchar(7)" }, { "name": "holder_type", "type": "varchar(16)" }, { "name": "holder_id", "type": "bigint" }, { "name": "share_amount_cents", "type": "bigint" }, { "name": "status", "type": "varchar(16)" } ] }, { "id": "reconcile_batch", "label": "对账批次 reconcile_batch", "tag": "对账域", "sublabel": "分成方×已结束自然月", "row": 3, "col": 2, "width": 246, "sources": [ { "path": "docs/详细设计说明书/06-第6册-计费与对账出账/02-数据模型本域表.md", "label": "对账§2.4" } ], "attributes": [ { "name": "batch_id", "type": "bigint", "key": "pk" }, { "name": "batch_no", "type": "varchar(24)", "key": "uk" }, { "name": "holder_type", "type": "varchar(16)" }, { "name": "holder_id", "type": "bigint" }, { "name": "period", "type": "varchar(7)" }, { "name": "status", "type": "varchar(16)" }, { "name": "trigger_type", "type": "varchar(16)" } ] }, { "id": "cost_item", "label": "成本项 cost_item", "tag": "分成域", "sublabel": "全局目录·无金额列", "row": 4, "col": 0, "width": 232, "sources": [ { "path": "docs/详细设计说明书/04-第4册-分成与成本规则/02-数据模型本域表.md", "label": "分成§2.1" } ], "attributes": [ { "name": "cost_item_id", "type": "bigint", "key": "pk" }, { "name": "item_name", "type": "varchar(64)", "key": "uk" }, { "name": "category", "type": "varchar(16)" }, { "name": "billing_unit", "type": "varchar(16)" }, { "name": "deduct_from_base", "type": "boolean" } ] }, { "id": "cost_amount", "label": "组合金额 cost_amount", "tag": "分成域", "sublabel": "省份×运营商×成本项", "row": 4, "col": 1, "width": 238, "sources": [ { "path": "docs/详细设计说明书/04-第4册-分成与成本规则/02-数据模型本域表.md", "label": "分成§2.1" } ], "attributes": [ { "name": "id", "type": "bigint", "key": "pk" }, { "name": "province_node_id", "type": "bigint" }, { "name": "operator_id", "type": "varchar(64)" }, { "name": "cost_item_id", "type": "bigint", "key": "fk", "references": "cost_item.cost_item_id" }, { "name": "amount_cents", "type": "bigint" } ] }, { "id": "bos_data_scope", "label": "数据范围 bos_data_scope", "tag": "横切·总则", "sublabel": "判权谓词·并集语义", "row": 5, "col": 0, "width": 250, "sources": [ { "path": "docs/详细设计说明书/00-总则与全局约定/05-数据建模总则与跨域表.md", "label": "总则§5.2" } ], "attributes": [ { "name": "id", "type": "bigint", "key": "pk" }, { "name": "holder_type", "type": "varchar(16)" }, { "name": "holder_id", "type": "bigint" }, { "name": "target_type", "type": "varchar(16)" }, { "name": "target_id", "type": "varchar(64)" } ] }, { "id": "bos_audit_log", "label": "审计日志 bos_audit_log", "tag": "横切·总则", "sublabel": "只追加·保留≥3年", "row": 5, "col": 1, "width": 250, "sources": [ { "path": "docs/详细设计说明书/00-总则与全局约定/05-数据建模总则与跨域表.md", "label": "总则§5.4" } ], "attributes": [ { "name": "audit_id", "type": "bigint", "key": "pk" }, { "name": "occurred_at", "type": "timestamptz" }, { "name": "actor_user_id", "type": "bigint" }, { "name": "action", "type": "varchar(64)" }, { "name": "object_type", "type": "varchar(64)" }, { "name": "object_id", "type": "varchar(64)" } ] } ], "relationships": [ { "id": "customer_sub", "from": "sub_account", "to": "customer", "label": "分账号", "fromCardinality": "many", "toCardinality": "one", "identifying": true }, { "id": "customer_contract", "from": "contract", "to": "customer", "label": "客户", "fromCardinality": "many", "toCardinality": "one", "identifying": true }, { "id": "contract_item", "from": "contract_service_item", "to": "contract", "label": "服务构成", "fromCardinality": "many", "toCardinality": "one", "identifying": true }, { "id": "plan_item", "from": "contract_service_item", "to": "plan", "label": "档位", "fromCardinality": "many", "toCardinality": "one", "identifying": false, "fromOptional": true }, { "id": "customer_order", "from": "subscription", "to": "customer", "label": "订单主体", "fromCardinality": "many", "toCardinality": "one", "identifying": true }, { "id": "contract_order", "from": "subscription", "to": "contract", "label": "合同", "fromCardinality": "many", "toCardinality": "one", "identifying": true }, { "id": "plan_order", "from": "subscription", "to": "plan", "label": "订单挂档位", "fromCardinality": "many", "toCardinality": "one", "identifying": true }, { "id": "costitem_amount", "from": "cost_amount", "to": "cost_item", "label": "定价", "fromCardinality": "many", "toCardinality": "one", "identifying": true }, { "id": "order_ticket", "from": "ticket", "to": "subscription", "label": "订单", "fromCardinality": "many", "toCardinality": "one", "identifying": false, "fromOptional": true }, { "id": "ticket_backfill", "from": "ticket_backfill", "to": "ticket", "label": "回填", "fromCardinality": "one", "toCardinality": "one", "identifying": true }, { "id": "ticket_openstop", "from": "ticket_open_stop", "to": "ticket", "label": "一单一开停记录", "fromCardinality": "one", "toCardinality": "one", "identifying": true }, { "id": "ticket_completion", "from": "ticket_completion", "to": "ticket", "label": "竣工", "fromCardinality": "one", "toCardinality": "one", "identifying": true }, { "id": "receivable_detail", "from": "bill_detail", "to": "billing_receivable", "label": "明细", "fromCardinality": "many", "toCardinality": "one", "identifying": true }, { "id": "batch_detail", "from": "bill_detail", "to": "reconcile_batch", "label": "批次", "fromCardinality": "many", "toCardinality": "one", "identifying": true } ], "cards": [ { "dot": "cyan", "title": "四条主干", "items": [ "客户主数据带:客户 → 分账号 / 合同 / 订单;客户主账号不是新表,是账号绑定表 subject_type=customer 的行。", "商品契约带:档位 + 合同服务构成条目 → 订单;订单一律挂档位,升降配只是新增一行 + replaces 边(自引用未在图中展开)。", "履约带:订单 → 工单 → 开停记录 / 回填 / 竣工;三写同事务改写服务开通状态、实际开通日与工单完成。", "出账带:订单 × 自然月 → 应收 → 账单明细 → 出账批次;账单明细物化以承载『批次覆盖』关系。" ] }, { "dot": "amber", "title": "故意缺列(缺列是设计)", "items": [ "订单无 region_id / ticket_id / billed_amount:区域在资源树、工单与账单各属他册、出账现取。", "应收无 reconcile_status / 分成金额列:出账状态由批次派生,分成金额单源在账单明细。", "成本项定义无任何金额列与归属维度列(A23 黑名单);逐客户分成规则表 share_rule 已作废。", "工单无金额列与流程引擎引用;回填/竣工不存 PIN/CPID 明文与脱敏副本。" ] }, { "dot": "emerald", "title": "关键关系口径", "items": [ "开停记录是第 6 册唯一开停事实源:按分账号×自然日推在期天数,不读工单状态。", "一条应收=一份订单×一个自然月,主键即幂等键;账单明细一条=分成方×订单×自然月。", "虚线为可选/非标识关系;同一订单至多被升降配替代一次(replaces 自引用见卡片说明,未画出以免自环)。" ] } ] }