Document the existing REV-002 backend billing-generation path and preserve a conservative partial-implementation judgment so the design stays aligned with current code evidence. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3.8 KiB
3.8 KiB
Data Model: REV-002 开账计费与账单生成缺口补齐
1. Billing Trigger
Purpose
定义从抄表校验结果进入开账计费流程的正式触发条件。
Key Fields
| Field | Description | Rule |
|---|---|---|
billPeriod |
账期 | 必填 |
readingBatchNo |
抄表批次号 | 可为空 |
meterReadIds |
抄表任务集合 | 至少存在批次或任务范围 |
validatedFlag |
是否已通过校验 | 必填;未校验不得生成 |
dueDate |
应收截止日期 | 必填 |
operatorId |
发起人 | 可为空 |
Relationships
- 来源于
biz_meter_read、biz_reading_data、biz_last_reading - 可触发一个或多个
Billing Result
2. Billing Rule Source
Purpose
定义账单生成过程依赖的价格和费用规则来源。
Key Fields
| Field | Description | Rule |
|---|---|---|
priceCategoryCode |
价格归属编码 | 必填 |
priceTemplateCode |
价格模板编码 | 必填 |
tierRuleRef |
阶梯规则引用 | 可为空;按场景适用 |
costComponentSet |
费用组成集合 | 至少 1 项 |
waterUseSchemeRef |
计划用水方案引用 | 可为空;按场景适用 |
ruleEffectiveFlag |
规则是否完整有效 | 必填;无效时阻断生成 |
Relationships
- 一个
Billing Rule Source可服务多个Billing Trigger - 一个
Billing Rule Source可生成多个Charge Detail
3. Billing Result
Purpose
定义账单生成后的主结果表达。
Key Fields
| Field | Description | Rule |
|---|---|---|
chargeId |
账单主键 | 唯一 |
chargeCode |
账单编号 | 唯一 |
custId |
客户标识 | 必填 |
accountId |
账户标识 | 可为空;按账户体系承接 |
billPeriod |
账期 | 必填 |
totalAmount |
账单总金额 | 必填 |
sourceType |
来源类型 | 必填;普通开账/特殊开账等 |
chargeStatus |
账单状态 | 必填 |
dueDate |
应收截止日期 | 必填 |
Relationships
- 由一个
Billing Trigger触发产生 - 包含多个
Charge Detail - 后续可流转到收费、催缴、发票等下游模块
4. Charge Detail
Purpose
定义营业账明细中的费用组成表达。
Key Fields
| Field | Description | Rule |
|---|---|---|
chargeId |
所属账单 ID | 必填 |
costComponentCode |
费用组成代码 | 必填 |
usageAmount |
用量 | 可为空;按费用项适用 |
unitPrice |
单价 | 可为空;按费用项适用 |
detailAmount |
明细金额 | 必填 |
detailRemark |
明细说明 | 可为空 |
Relationships
- 归属于一个
Billing Result - 引用一个
Billing Rule Source
5. Billing Exception Result
Purpose
定义账单生成失败时的正式异常返回表达。
Key Fields
| Field | Description | Rule |
|---|---|---|
reasonCode |
失败原因编码 | 必填 |
reasonText |
失败说明 | 必填 |
relatedCustomer |
相关客户 | 可为空 |
relatedMeterRead |
相关抄表任务 | 可为空 |
blockingFlag |
是否阻断生成 | 固定为是 |
Relationships
- 与一个
Billing Trigger关联 - 不生成
Billing Result
6. Billing Governance Record
Purpose
用于在治理台账中记录 REV-002 的设计状态、实现评估和后续建议。
Key Fields
| Field | Description | Rule |
|---|---|---|
requirementCode |
对应需求编号 | 固定为 SYS002-REQ-004 |
featureName |
Speckit feature 名称 | 必填 |
designStatus |
设计状态 | 必填;设计收口中/已收口 |
implementationStatus |
实现评估 | 必填;当前为部分实现 |
nextAction |
后续动作 | 必填 |
validationRecord |
校验记录 | 必填 |
Relationships
- 关联
01_Project_Progress.md - 关联
03_Task_Checklist.md - 关联
15_SYS002_Requirement_Breakdown.md