Compare commits

...

19 Commits

Author SHA1 Message Date
53df134759 Clarify payment domain ownership under REV003
Constraint: Keep payment documentation in existing formal docs rather than creating a parallel guide.\nRejected: Treating biz_payment_record as verified production tables | Current evidence only supports target/prototype semantics.\nConfidence: high\nScope-risk: narrow\nDirective: Do not move payment fact ownership into REV004; REV004 should reference REV003/SYS009 payment facts only.\nTested: make validate-file on main touched docs; make check-ai-governance; git diff --check.\nNot-tested: Full export/render pipeline.
2026-04-29 17:23:27 +08:00
1b6fda9c4d Record REV004 regression and fallback-reduction evidence
The evidence captures the new regression scripts, formal-first query
narrowing, and the fresh verification trail used to support the next
round of fallback removal.

Constraint: Evidence must match commands and outcomes actually executed in backend worktree
Rejected: Fold this into an older summary doc | would hide the stepwise proof for fallback reduction
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep appending fresh verification evidence here until the remaining legacy fallback is either removed or explicitly retained
Tested: Evidence cross-checked against backend worktree commands, regression logs, and targeted test outputs
Not-tested: No doc export/render pipeline executed
2026-04-20 15:02:24 +08:00
24761c5df3 Merge PR #16: add REV004 release ops checklist\n\nConstraint: Keep release operations guidance aligned with verified mainline state\nConfidence: high\nScope-risk: narrow\nDirective: Update this checklist only when release-critical reality changes, not for routine doc churn\nTested: PR #16 checklist cross-checked against current summary, truth matrix, and evidence set\nNot-tested: No document export/render pipeline executed at merge time 2026-04-17 18:23:08 +08:00
feb0da254f Add REV004 release ops checklist
This adds an operations-oriented checklist for REV004 covering environment
readiness, rollout order, smoke validation, rollback posture, and fast-path
triage hints for on-call and release engineers.

Constraint: Checklist must stay concise and executable for frontline release use
Rejected: Bury release steps across evidence and design docs only | too slow for runtime operations
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Update this checklist only when release-critical reality changes, not for every minor doc change
Tested: Cross-checked against final summary, go-live checklist, and current evidence set
Not-tested: No document export/render pipeline executed for this checklist
2026-04-17 18:19:47 +08:00
9946fa7572 Merge PR #15: add REV004 go-live and joint-debug checklist\n\nConstraint: Keep the checklist aligned with verified mainline state and evidence set\nConfidence: high\nScope-risk: narrow\nDirective: Update this checklist only when mainline reality or release blockers change materially\nTested: PR #15 checklist cross-checked against final summary, truth matrix, and evidence set\nNot-tested: No document export/render pipeline executed at merge time 2026-04-17 18:15:27 +08:00
74c951641f Add REV004 go-live and joint-debug checklist
This adds a concise operator-facing checklist for REV004 covering current
mainline SHAs, environment prerequisites, smoke order, remaining cautions,
and the evidence index used for release and joint-debug work.

Constraint: Checklist must reflect verified mainline reality and remain short enough for frontline use
Rejected: Keep launch guidance scattered across evidence files only | too slow for release/joint-debug coordination
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Update this checklist only when mainline reality materially changes or a new blocker emerges
Tested: Cross-checked against current mainline summary, truth matrix, and evidence set
Not-tested: No document export/render pipeline executed for this checklist
2026-04-17 18:11:46 +08:00
3741fd597d Merge PR #14: stabilize REV004 final summary docs anchor wording\n\nConstraint: Keep the final summary evergreen instead of self-expiring after each merge\nConfidence: high\nScope-risk: narrow\nDirective: Prefer stable branch-relative wording over self-referential merge SHAs in evergreen handoff docs\nTested: PR #14 wording reviewed against current docs mainline semantics\nNot-tested: No document export/render pipeline executed at merge time 2026-04-17 18:07:20 +08:00
700b8db99c Stabilize REV004 final summary docs anchor wording
This replaces the self-expiring docs latest-merge SHA in the final REV004
summary with a stable wording that points readers to current mainline content,
preventing the summary from going stale immediately after each merge.

Constraint: The top-level handoff summary must remain self-consistent after it is merged into main
Rejected: Keep chasing a concrete docs latest-merge SHA in follow-up patches | creates infinite self-expiring metadata churn
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Prefer stable branch-relative wording over self-referential merge SHAs in evergreen handoff docs
Tested: Reviewed rendered markdown diff for semantic equivalence plus improved stability
Not-tested: No document export/render pipeline executed for this wording-only change
2026-04-17 18:05:05 +08:00
0dd08ec623 Merge PR #13: upgrade redink evidence to full execute closure\n\nConstraint: Keep redink evidence and final summary aligned with the now-verified live execute closure\nConfidence: high\nScope-risk: narrow\nDirective: Remove stale blocker wording immediately once the external dependency closure is verified so handoff docs stay trustworthy\nTested: PR #13 content cross-checked against successful live execute smoke, DB readback, and cleanup results\nNot-tested: No document export/render pipeline executed at merge time 2026-04-17 17:57:42 +08:00
cbedf0aec8 Upgrade redink evidence to full execute closure
This updates the REDINK_RECORD evidence with a successful live execute smoke
run after bringing up business-bank-server locally, and refreshes the final
mainline delivery summary to remove the stale blocker wording.

Constraint: Docs must reflect the newly verified live redink execute closure, not the earlier blocked state
Rejected: Leave the old blocker note in place | factually stale after the successful execute rerun
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: If redink live execute is revalidated again later, append a dated subsection instead of rewriting this successful closure note
Tested: Cross-checked against successful live execute smoke, DB readback, and cleanup results on 2026-04-17
Not-tested: No document export/render pipeline executed for this docs-only refresh
2026-04-17 17:54:37 +08:00
c9b7a135c0 Merge PR #12: refresh REV004 final summary docs-main anchor\n\nConstraint: Keep the final summary internally consistent with current docs mainline\nConfidence: high\nScope-risk: narrow\nDirective: Refresh summary metadata immediately after future summary merges so the handoff page never self-stales\nTested: PR #12 content cross-checked against docs main ab4eec0...\nNot-tested: No document export/render pipeline executed at merge time 2026-04-17 17:38:57 +08:00
6cb590aa13 Refresh REV004 final summary docs-main anchor
This updates the docs-main latest merge anchor inside the REV004 final mainline
summary so the document remains self-consistent after its own merge.

Constraint: The final summary must reference the current docs mainline state, not the pre-summary merge anchor
Rejected: Leave the older docs merge SHA in place | would make the summary internally stale immediately after merge
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Refresh top-level summary anchors whenever the summary itself is merged into main
Tested: Cross-checked against origin/main latest merge ab4eec0...
Not-tested: No document export/render pipeline executed for this one-line metadata refresh
2026-04-17 17:37:42 +08:00
ab4eec0ea8 Merge PR #11: add REV004 final mainline delivery summary\n\nConstraint: Keep the final summary aligned with verified mainline state only\nConfidence: high\nScope-risk: narrow\nDirective: Refresh this summary only when meaningful mainline state changes occur so it remains a stable handoff artifact\nTested: PR #11 summary cross-checked against latest backend/docs mainline commits and evidence set\nNot-tested: No document export/render pipeline executed at merge time 2026-04-17 17:35:36 +08:00
9ac2e9f68e Add REV004 final mainline delivery summary
This adds a one-page summary of the current REV004 mainline delivery state,
including merged backend/docs commits, object truth status, evidence anchors,
and remaining external blockers.

Constraint: Summary must reflect verified mainline truth only, not feature-branch intent
Rejected: Scatter this information across multiple historical evidence files | too costly for frontline consumers to reconstruct delivery status
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep this summary as the top-level operator handoff page and refresh only after meaningful mainline state changes
Tested: Cross-checked against origin/develop and origin/main latest merge commits plus existing evidence set
Not-tested: No document export/render pipeline executed for this summary
2026-04-17 17:33:40 +08:00
415b4cee13 Merge PR #10: land prestorage strict formal-first evidence\n\nConstraint: Preserve reviewed prestorage process/attachments evidence without mixing unrelated docs\nConfidence: high\nScope-risk: narrow\nDirective: Append any future prestorage query verification as follow-up evidence rather than rewriting this closure proof\nTested: PR #10 evidence reviewed against backend PR #80 compile/test/smoke outputs\nNot-tested: No doc export/render pipeline executed at merge time 2026-04-17 17:24:24 +08:00
21aed1f7d7 Capture prestorage strict formal-first evidence for REV004
This records compile/test outputs plus fresh jar smoke proving that
prestorage-process and prestorage-attachments now read formal data first while
retaining fallback behavior.

Constraint: Evidence must stay aligned with the prestorage query-only strict formal-first batch and its application-dev smoke run
Rejected: Fold this note into older prestorage evidence files | reduces traceability for the specific process/attachments closure batch
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Append future prestorage query verification as follow-up evidence rather than overwriting this closure proof
Tested: Cross-checked against backend compile/test output and fresh smoke results on 2026-04-17
Not-tested: No document export/render pipeline executed for this evidence-only commit
2026-04-17 17:20:49 +08:00
89737608b3 Merge PR #9: refresh REV004 current truth matrix with redink\n\nConstraint: Keep the matrix aligned with verified mainline merges only\nConfidence: high\nScope-risk: narrow\nDirective: Refresh this matrix again only after future mainline merges so it stays trustworthy\nTested: PR #9 content cross-checked against backend develop d8596af... and docs main 57763c6...\nNot-tested: No document export/render pipeline executed at merge time 2026-04-17 17:05:58 +08:00
9ca67674a3 Refresh REV004 current truth matrix after redink merge
This updates the current-truth matrix to reflect that REDINK_RECORD is now
an independent formal-table object on the mainline, and refreshes the merge
anchors plus blocker note accordingly.

Constraint: Matrix must match verified mainline truth after PR #79 and docs redink evidence merge
Rejected: Leave REDINK_RECORD as not independent in the matrix | now factually incorrect after mainline merge
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Refresh this matrix only after verified mainline merges so it remains an operator-grade truth artifact
Tested: Cross-checked against origin/develop merge d8596af... and origin/main merge 57763c6...
Not-tested: No document export/render pipeline executed for this matrix refresh
2026-04-17 17:04:02 +08:00
57763c634e Merge PR #8: land REV004 redink evidence\n\nConstraint: Preserve reviewed REDINK_RECORD evidence without mixing unrelated doc drafts\nConfidence: high\nScope-risk: narrow\nDirective: Append a follow-up section when live execute smoke can be rerun with business-bank-server available\nTested: PR #8 evidence reviewed against backend PR #79 verification outputs and blocker trace\nNot-tested: No doc export/render pipeline executed at merge time 2026-04-17 16:56:55 +08:00
19 changed files with 827 additions and 52 deletions

View File

@ -69,6 +69,12 @@
| 业务审查结论回写 | ✅ 已完成 | 2026-03-12 | 审查三项已在周检记录中形成结论 |
| 非关键治理补漏转入维护 | ✅ 已完成 | 2026-03-12 | 后续按周检机制持续跟踪,不再阻塞本阶段收口 |
### 持续维护记录
| 日期 | 事项 | 修订内容 | 影响 |
| ---- | ---- | -------- | ---- |
| 2026-04-29 | REV-003 支付域归属正式回写 | 将业务支付事实目标层(`biz_payment_record` / `biz_payment_record_detail`)正式归入 `REV-003` 营业收费;明确 `SYS-009` 仅承接 `bk_transaction*` 渠道事实;`REV-004` 仅在退款、冲正、账务调整中引用原支付/渠道事实。 | 统一概要、详细、接口、数据库、追溯矩阵和旧表迁移矩阵口径,避免把支付主域误归到 REV-004。 |
## 质量控制检查点
### 技术质量标准

View File

@ -1,5 +1,15 @@
# 福建水务营收系统文档编写任务清单
## 📌 持续维护任务
### 📋 REV-003 支付域归属正式回写
- [x] **完成 REV-003 业务支付事实层正式文档回写** ✅ (2026-04-29)
- [x] 已在概要、详细、接口、数据库主文档中明确 `biz_payment_record` / `biz_payment_record_detail` 归属 `REV-003` 的目标/原型语义 ✅
- [x] 已明确 `SYS-009` 保持 `bk_transaction*` 渠道事实主责,`REV-004` 仅作为退款、冲正、账务调整引用方 ✅
- [x] 已更新旧表到新对象、字段级映射、试迁校验和 REV-004 追溯矩阵,区分业务支付事实、渠道事实与历史只读投影 ✅
- [x] 已保留“目标/原型、待实现验真”风险说明,避免把未验真实表写成生产事实 ✅
## 🎯 当前冲刺任务 (第一阶段:紧急问题修复)
### 📋 系统架构设计文档 (`water_biz_system_architecture.md`)

View File

@ -27,9 +27,9 @@
| SYS002-REQ-002 | REV-001 | 开票/托收/代扣关系维护 | 维护客户开票资料、托收关系、代扣关系、渠道绑定关系 | SYS-008 / SYS-009 | IF-REV-002 | biz_cust_invoice、biz_cust_collection_rel、biz_cust_withholding_rel、biz_cust_app_binds | Story |
| SYS002-REQ-003 | REV-002 | 抄表任务与数据采集 | 生成抄表任务并提交人工/远传抄表数据 | IoT / SYS-006 | IF-REV-004 / IF-EXT-009 | biz_meter_read、biz_reading_data、biz_last_reading、biz_reading_logs | Story |
| SYS002-REQ-004 | REV-002 | 开账计费与账单生成 | 基于价格模板、阶梯规则、费用组成生成营业账 | - | IF-REV-005 | biz_charge、biz_charge_detail、biz_price_*、biz_cost_component | Story |
| SYS002-REQ-005 | REV-003 | 收费核销处理 | 柜台收费、余额抵扣、多账单组合核销 | SYS-009 | IF-REV-006 | biz_charge、biz_charge_detail、biz_collection | Story |
| SYS002-REQ-006 | REV-003 | 支付下单与结果回写 | 发起支付订单并处理异步回调结果 | SYS-009 | IF-EXT-004 / IF-EXT-005 | bk_transaction、bk_transaction_callback、bk_transaction_exception | Story |
| SYS002-REQ-007 | REV-004 | 账务调整处理 | 支持金额调整、水量调整、退款、冲正、坏账 | - | IF-REV-007 | biz_charge、biz_charge_detail、biz_operat_log、bk_transaction* | Story |
| SYS002-REQ-005 | REV-003 | 收费核销处理 | 柜台收费、余额抵扣、多账单组合核销,并沉淀业务支付事实/分配明细目标语义 | SYS-009 | IF-REV-006 | biz_charge、biz_charge_detail、biz_collection、目标/原型 biz_payment_record、biz_payment_record_detail | Story |
| SYS002-REQ-006 | REV-003 | 支付下单与结果回写 | 发起支付订单并处理异步回调结果;业务结果回写到账单与业务支付事实目标层 | SYS-009 | IF-EXT-004 / IF-EXT-005 | 渠道事实:bk_transaction、bk_transaction_callback、bk_transaction_exception业务事实目标层biz_payment_record、biz_payment_record_detail | Story |
| SYS002-REQ-007 | REV-004 | 账务调整处理 | 支持金额调整、水量调整、退款、冲正、坏账;引用原支付/渠道事实进行校验追溯 | - | IF-REV-007 | biz_charge、biz_charge_detail、biz_operat_log;引用 bk_transaction* 与目标/原型 biz_payment_record* | Story |
| SYS002-REQ-008 | REV-005 | 发票申请受理 | 对已收费未开票账单发起单笔/批量开票申请 | SYS-008 | IF-REV-008 / IF-EXT-006 | biz_invoice、biz_invoice_taxrate、biz_cust_invoice | Story |
| SYS002-REQ-009 | REV-005 | 发票结果查询与补偿 | 按申请单号/受理号查询开票结果并补偿 | SYS-008 | IF-REV-009 | biz_invoice、biz_operat_log | Story |
| SYS002-REQ-010 | REV-005 | 发票结果回写 | 回写开票状态、票号、下载地址、作废/红冲结果 | SYS-008 | IF-EXT-007 | biz_invoice、biz_process_invoice_modifys | Story |

View File

@ -877,7 +877,7 @@ graph TB
| IF-REV-001 | 客户信息查询接口 | 查询客户档案、账户状态、联系人与水表绑定关系 | 柜台/客户渠道/工单 | HTTPS REST | 客户ID、客户编号、手机号、查询类型 | 客户档案、账户信息、联系人列表、水表绑定关系 |
| IF-REV-004 | 抄表数据提交接口 | 提交人工或远传抄表数据并触发校验 | 手机抄表APP/集抄系统 | HTTPS REST | 抄表任务ID、水表ID、读数、图片证据、GPS位置 | 上传结果、校验状态、异常标记 |
| IF-REV-005 | 账单生成接口 | 根据抄表结果、水价模板和费用组成生成账单 | 开账任务/批量任务 | HTTPS REST | 抄表批次、账期、客户范围、应收日期 | 账单结果、失败清单、生成汇总 |
| IF-REV-006 | 缴费处理接口 | 创建收费记录并核销账单 | 柜台/线上渠道 | HTTPS REST | 客户ID、账单ID列表、支付方式、实收金额 | 收费结果、核销状态、交易流水 |
| IF-REV-006 | 缴费处理接口 | 创建收费记录并核销账单,形成业务支付事实与分配明细的目标语义 | 柜台/线上渠道 | HTTPS REST | 客户ID、账单ID列表、支付方式、实收金额 | 收费结果、核销状态、交易流水、业务支付记录 |
| IF-REV-008 | 发票申请接口 | 发起电子发票申请并接收票据状态回写 | 柜台/客户渠道 | HTTPS REST | 客户ID、账单ID列表、开票抬头、税号、邮箱 | 发票申请结果、票据状态、下载地址 |
| IF-REV-011 | 银行代收协同接口 | 发起代扣、回盘、对账、结算协同 | 银行代收模块/SYS-009 | HTTPS REST / 文件交换 | 批次号、渠道编码、账期、账单明细 | 批次状态、回盘结果、对账差异、结算结果 |
| IF-REV-012 | 业务参数配置接口 | 查询和维护价格模板、优惠方案、业务参数配置 | 管理后台/参数管理端 | HTTPS REST | 参数分类、模板编码、站点范围 | 参数明细、模板信息、更新结果 |
@ -1748,8 +1748,8 @@ graph TD
- **客户资料管理**:客户档案建立、信息维护、分组管理
- **抄表开账**:抄表数据录入、复核确认、自动开账
- **营业收费**:柜台收费、移动收费、在线缴费
- **账务处理**:一期先聚焦水量调整、金额调整、退款、冲正、坏账申请,统一经 `IF-REV-007` 承接,并按共性能力先统一、场景能力再分批推进
- **营业收费**:柜台收费、移动收费、在线缴费,并作为业务支付事实层(目标语义:`biz_payment_record` / `biz_payment_record_detail`)的归属模块
- **账务处理**:一期先聚焦水量调整、金额调整、退款、冲正、坏账申请,统一经 `IF-REV-007` 承接;退款、冲正等场景引用 `REV-003` 业务支付事实与 `SYS-009` 渠道交易事实,不再作为支付主域
- **发票管理**:发票开具、查询、重开、作废
- **催缴管理**:欠费统计、催缴通知、停水管理
- **统计分析**:多维度数据统计和报表分析
@ -1804,7 +1804,7 @@ graph TD
| IF-REV-001 | 客户信息查询接口 | 查询客户档案、账户状态、联系人与水表绑定关系 | 柜台/客户渠道/工单 | HTTPS REST | 客户ID、客户编号、手机号、查询类型 | 客户档案、账户信息、联系人列表、水表绑定关系 |
| IF-REV-004 | 抄表数据提交接口 | 提交人工或远传抄表数据并触发校验 | 手机抄表APP/集抄系统 | HTTPS REST | 抄表任务ID、水表ID、读数、图片证据、GPS位置 | 上传结果、校验状态、异常标记 |
| IF-REV-005 | 账单生成接口 | 根据抄表结果、水价模板和费用组成生成账单 | 开账任务/批量任务 | HTTPS REST | 抄表批次、账期、客户范围、应收日期 | 账单结果、失败清单、生成汇总 |
| IF-REV-006 | 缴费处理接口 | 创建收费记录并核销账单 | 柜台/线上渠道 | HTTPS REST | 客户ID、账单ID列表、支付方式、实收金额 | 收费结果、核销状态、交易流水 |
| IF-REV-006 | 缴费处理接口 | 创建收费记录并核销账单,形成业务支付事实与分配明细的目标语义 | 柜台/线上渠道 | HTTPS REST | 客户ID、账单ID列表、支付方式、实收金额 | 收费结果、核销状态、交易流水、业务支付记录 |
| IF-REV-008 | 发票申请接口 | 发起电子发票申请并接收票据状态回写 | 柜台/客户渠道 | HTTPS REST | 客户ID、账单ID列表、开票抬头、税号、邮箱 | 发票申请结果、票据状态、下载地址 |
| IF-REV-011 | 银行代收协同接口 | 发起代扣、回盘、对账、结算协同 | 银行代收模块/SYS-009 | HTTPS REST / 文件交换 | 批次号、渠道编码、账期、账单明细 | 批次状态、回盘结果、对账差异、结算结果 |
| IF-REV-012 | 业务参数配置接口 | 查询和维护价格模板、优惠方案、业务参数配置 | 管理后台/参数管理端 | HTTPS REST | 参数分类、模板编码、站点范围 | 参数明细、模板信息、更新结果 |
@ -1974,8 +1974,8 @@ graph TB
|---|---|---|---|
| REV-001 | 客户资料管理 | 客户档案管理、客户分组、信息变更 | 自行开发 |
| REV-002 | 抄表开账 | 抄表录入、复核开账、异常处理 | 自行开发 |
| REV-003 | 营业收费 | 柜台收费、移动收费、在线缴费 | 自行开发 |
| REV-004 | 账务处理 | 账务调整、退款处理、坏账管理 | 自行开发 |
| REV-003 | 营业收费 | 柜台收费、移动收费、在线缴费、业务支付事实与分配明细(目标语义) | 自行开发 |
| REV-004 | 账务处理 | 账务调整、退款处理、坏账管理;引用收费/支付事实,不拥有支付主域 | 自行开发 |
| REV-005 | 发票管理 | 发票开具、查询管理、电子发票 | 自行开发 |
| REV-006 | 催缴管理 | 欠费催缴、短信通知、停水管理 | 自行开发 |
| REV-007 | 统计分析 | 多维度数据统计和报表分析功能 | 自行开发 |
@ -2254,7 +2254,7 @@ flowchart TD
**功能概述:**
  营业收费模块提供完整的收费业务流程管理,支持多种收费方式和支付渠道。
  营业收费模块提供完整的收费业务流程管理,支持多种收费方式和支付渠道。业务归属上,`REV-003` 承接“账单核销后的业务支付事实”与“支付分配明细”的目标语义;`SYS-009` 继续承接银行、聚合支付、回调、对账、结算等渠道事实。当前文档中的 `biz_payment_record` / `biz_payment_record_detail` 仅表达目标/原型层,不等同于已验真的生产表。
**核心功能:**
@ -2334,7 +2334,7 @@ flowchart TD
**功能概述:**
  负责处理各类复杂的账务调整、退款、坏账等业务,确保账务的准确性和合规性。
  负责处理各类复杂的账务调整、退款、坏账等业务,确保账务的准确性和合规性。`REV-004` 需要引用原收费记录、业务支付事实与渠道交易事实进行校验和追溯,但不重新定义支付主单或渠道流水主模型。
**核心功能:**

View File

@ -84,8 +84,8 @@ retrieval_priority: P1
| `UP-004` | 审计监控与运维支撑 | [章节](./11_UP_Detailed.md#mod-up-004) | 操作日志、接口日志、任务日志 | `IF-UP-003`(审计关联) | 运维平台、消息服务 |
| `REV-001` | 客户资料管理 | [章节](./12_REV_Detailed.md#mod-rev-001) | 客户、账户、联系人、绑定关系 | `IF-REV-001` | 客户服务、表务、报装 |
| `REV-002` | 抄表开账 | [章节](./12_REV_Detailed.md#mod-rev-002) | 抄表任务、读数、账单主明细 | `IF-REV-004``IF-REV-005` | 抄表APP、IoT、表务 |
| `REV-003` | 营业收费 | [章节](./12_REV_Detailed.md#mod-rev-003) | 营业账、交易流水、回调记录 | `IF-REV-006` | `SYS-009` 支付结算 |
| `REV-004` | 账务处理 | [章节](./12_REV_Detailed.md#mod-rev-004) | 账单调整、日志、审批留痕 | `IF-REV-007` | 财务、营收后台 |
| `REV-003` | 营业收费 | [章节](./12_REV_Detailed.md#mod-rev-003) | 营业账、业务支付事实/分配明细目标层、渠道交易流水、回调记录 | `IF-REV-006` | `SYS-009` 支付结算`bk_transaction*` 归渠道事实 |
| `REV-004` | 账务处理 | [章节](./12_REV_Detailed.md#mod-rev-004) | 账单调整、日志、审批留痕;引用原支付/渠道事实 | `IF-REV-007` | 财务、营收后台;不拥有支付主域 |
| `REV-005` | 发票与税务处理 | [章节](./12_REV_Detailed.md#mod-rev-005) | 发票主记录、税率、开票信息 | `IF-REV-008` | `SYS-008` 发票服务 |
| `REV-006` | 催缴与通知 | [章节](./12_REV_Detailed.md#mod-rev-006) | 欠费账单、催缴结果 | `IF-REV-009` | `SYS-010` 消息服务 |
| `REV-007` | 统计分析 | [章节](./12_REV_Detailed.md#mod-rev-007) | 客户、抄表、收费、渠道聚合 | `IF-REV-010` | 报表与管理端 |

View File

@ -56,8 +56,8 @@ retrieval_priority: P1
|---|---|---|---|
| REV-001 客户资料管理 | `IF-REV-001` | `biz_cust``biz_account``biz_cust_*` | 客户服务模块、报装模块 |
| REV-002 抄表开账 | `IF-REV-004``IF-REV-005` | `biz_meter_book``biz_meter_read``biz_reading_*``biz_charge*` | 抄表APP、物联网集抄 |
| REV-003 营业收费 | `IF-REV-006` | `biz_charge*``biz_collection``bk_transaction*` | `SYS-009` |
| REV-004 账务处理 | `IF-REV-007` | `biz_charge*``biz_operat_log*` | 财务与营业人员 |
| REV-003 营业收费 | `IF-REV-006` | `biz_charge*``biz_collection`目标/原型 `biz_payment_record*``bk_transaction*` | `SYS-009` |
| REV-004 账务处理 | `IF-REV-007` | `biz_charge*``biz_operat_log*`;引用 `REV-003` 支付事实与 `SYS-009` 渠道事实 | 财务与营业人员 |
| REV-005 发票与税务处理 | `IF-REV-008` | `biz_invoice*``biz_cust_invoice` | `SYS-008` |
| REV-006 催缴与通知 | `IF-REV-013` | `biz_charge*`、催缴结果留痕 | `SYS-010` |
| REV-007 统计分析 | `IF-REV-010` | 客户、抄表、收费、渠道聚合对象 | 统计分析端 |
@ -220,7 +220,7 @@ flowchart TD
### 功能说明
支持柜台收费、预存款/余额抵扣、线上缴费回写、柜面扫码、营业网点收费及收费凭证管理,统一承接营收账单的核销处理。
支持柜台收费、预存款/余额抵扣、线上缴费回写、柜面扫码、营业网点收费及收费凭证管理,统一承接营收账单的核销处理。领域边界上,`REV-003` 是业务支付事实与支付分配明细的归属模块;`SYS-009` 只承接渠道交易、回调、对账和结算事实。
### 业务流程
@ -245,7 +245,7 @@ flowchart TD
1. 一次缴费可对应多个账单或账单明细的组合核销。
2. 收费记录必须保留渠道、流水号、网点、操作员、终端信息。
3. 线上支付必须以回调或查询确认结果为准,不得以发起状态直接记账。
4. 支付能力由 `SYS-009` 提供SYS-002 负责账单核销与业务状态回写。
4. 支付能力由 `SYS-009` 提供SYS-002 负责账单核销、业务支付事实沉淀与业务状态回写;渠道交易事实不替代业务支付分配明细
5. 当前实现侧已确认 `PayCeb` 的欠费查询、缴费处理基础闭环可用,但代理收费对账仍为预留能力;正式文档不得将实时收费对账写成已闭环能力。
### 核心数据
@ -253,6 +253,7 @@ flowchart TD
- `biz_charge``biz_charge_detail`:待缴与已缴账单主明细。
- `biz_collection`:托收/代收主表。
- `biz_withholding`:代扣/托收主表。
- `biz_payment_record``biz_payment_record_detail`:业务支付主单与分配明细的目标/原型对象,承接旧 `PM_PAY_DETAILS` 的实收、实销、滞纳金、红冲关联等核心语义;未完成实现验真前不得表述为已落地生产表。
- `bk_transaction`:渠道交易流水。
- `bk_transaction_callback`:支付回调记录。
- `bk_transaction_exception`:支付异常记录。
@ -277,6 +278,12 @@ flowchart TD
- 当前设计可将红冲视为收费核销后的修正场景,不强制要求独立实体表,但必须提供历史只读查询口径。
- 红冲迁移最小保留信息应包括原收费记录、红冲时间、红冲金额、原因、经办人、关联账单和后续账务状态。
#### 旧支付明细与汇总台账
- 旧 `PM_PAY_DETAILS` 的实收金额、实销金额、滞纳金、收费员、红冲关联等字段应优先映射到 `REV-003` 业务支付事实目标层,而不是直接等同于 `SYS-009` 的渠道交易流水。
- 旧 `PM_PAY_SUBTOTALS``PM_PAY_COLLECTS` 更接近班结/汇总/报表口径,可由 `biz_payment_record*``biz_collection``bk_transaction*` 和历史只读归档共同支撑,不建议为旧汇总表机械复制一套在线主表。
- 旧 `PM_REALTIMES*` 如仅用于实时收费过程日志和历史查询,迁移时按历史只读与操作留痕保留;真正发生业务核销时仍回归 `IF-REV-006` 与业务支付事实目标层。
### 接口映射
- `IF-REV-006`:创建收费记录、执行账单核销并回写状态。
@ -315,7 +322,7 @@ flowchart TD
1. 一期场景严格限定为水量调整、金额调整、退款、冲正、坏账申请,不扩展到其他接口族或独立账务台账重构。
2. 所有场景均以 `biz_charge` / `biz_charge_detail` 为主承接对象,并通过 `biz_operat_log` / `biz_operat_log_detail` 记录处理依据、前后变化和责任归属。
3. 退款、冲正必须联动 `bk_transaction`、`bk_transaction_callback``bk_transaction_exception`原支付流水及渠道状态校验,不允许仅依据账单状态直接处理。
3. 退款、冲正必须联动 `REV-003` 业务支付事实目标层与 `bk_transaction`、`bk_transaction_callback``bk_transaction_exception` 等渠道状态校验,不允许仅依据账单状态直接处理。
4. 接口结果统一返回 `resultStatus``writeBackStatus`,其中 `resultStatus` 表示处理结论,`writeBackStatus` 表示账单状态回写结论,两者不得混用。
5. 审批相关内容一期仅保留 `approvalRequired``PENDING_APPROVAL` 与审批边界说明,不展开完整 BPM 流程、节点、流转规则或审批回写实现细节。
6. 对于当前未见明确独立实体表的特账、跨周期水量、退款账等对象,文档以“业务处理场景”表述,不强行落为已实现表。
@ -323,7 +330,8 @@ flowchart TD
### 核心数据
- `biz_charge``biz_charge_detail`:账务调整的核心对象,承接调整前后账单主明细状态。
- `bk_transaction``bk_transaction_callback``bk_transaction_exception`:退款、冲正场景的原交易校验与异常追溯对象。
- `biz_payment_record``biz_payment_record_detail`:退款、冲正、预存转退等场景引用的业务支付事实目标层,用于追溯原收款与核销分配关系。
- `bk_transaction``bk_transaction_callback``bk_transaction_exception`:退款、冲正场景的渠道交易校验与异常追溯对象。
- 价格调整/优惠相关表:用于重算账单或差额追溯。
- `biz_operat_log``biz_operat_log_detail`:操作与变更留痕,记录字段差异、处理说明、附件依据与责任归属。

View File

@ -75,7 +75,7 @@ retrieval_priority: P0
| SYS-002 基础配置与价格体系 | `biz_community`, `biz_company_*`, `biz_meter_*`, `biz_price_*`, `biz_template_*` | 小区、水司账户、水表参数、价格体系、调价快照、优惠方案、模板关系等 | 已按真实表对齐 |
| SYS-002 客户主数据与账户关系 | `biz_cust*`, `biz_account` | 客户主档、联系人、客户组、水表绑定、开票信息、托收/代扣关系、编号规则等 | 已按真实表对齐 |
| SYS-002 抄表开账与账单 | `biz_meter`, `biz_meter_book`, `biz_meter_read`, `biz_reading_*`, `biz_charge*` | 抄表册本、抄表状态、读数留痕、开账主单与明细 | 已按真实表对齐 |
| SYS-002 收费票据与操作留痕 | `biz_collection`, `biz_withholding`, `biz_invoice*`, `biz_operat_log*` | 收费、托收/代扣、发票、操作留痕与审计支撑 | 已按真实表对齐 |
| SYS-002 收费票据与操作留痕 | `biz_collection`, `biz_withholding`, `biz_invoice*`, `biz_operat_log*`;目标/原型:`biz_payment_record*` | 收费、托收/代扣、业务支付事实目标层、发票、操作留痕与审计支撑 | 真实表已按现状对齐`biz_payment_record*` 需实现验真后升级为已落地 |
| SYS-002 业务办理与资料 | `biz_process*`, `biz_business_*`, `biz_content*` | 业务办理流程、流转、装表资料、附件与扩展数据 | 已按真实表对齐 |
| SYS-002 银行代收与结算 | `bk_*` | 渠道路由、交易回调、代扣签约、批次、对账、结算 | 已按真实表对齐 |
| SYS-003 手机抄表 APP | `mobile_*` | 移动作业缓存、登录日志、离线任务与现场上报 | 保持现稿 |
@ -1072,7 +1072,7 @@ retrieval_priority: P0
| `biz_water_use_scheme_tier` | `scheme_code`, `tier_level`, `start_volume`, `end_volume` | 用水阶梯 |
| `biz_exceed_water_use_scheme` | `scheme_code`, `exceed_type`, `price_rule` | 超计划规则 |
## SYS-002 开账、收费与票据表 (`biz_charge*` / `biz_collection` / `biz_withholding` / `biz_invoice*`)
## SYS-002 开账、收费与票据表 (`biz_charge*` / `biz_collection` / `biz_withholding` / 目标 `biz_payment_record*` / `biz_invoice*`)
### biz_charge (营业账主表)
| 字段名 | 说明 |
@ -1121,6 +1121,23 @@ retrieval_priority: P0
| `biz_collection` | `code`, `cust_id`, `charge_id`, `collection_status` | 托收主表 |
| `biz_withholding` | `code`, `cust_id`, `charge_id`, `withholding_status` | 代扣主表 |
### biz_payment_record / biz_payment_record_detail (业务支付事实目标层)
> 当前口径:`biz_payment_record``biz_payment_record_detail` 用于表达 `REV-003` 下业务支付主单与账单/费用分配明细的目标/原型语义。除非后续 DDL、Mapper、Service 与测试库实表均完成验真,数据库主文档不得将其表述为已确认生产表。
| 表名 | 目标关键字段 | 说明 |
| :--- | :--- | :--- |
| `biz_payment_record` | `payment_no`, `cust_id`, `payment_amount`, `payment_channel`, `payment_time`, `source_transaction_no`, `payment_status` | 业务支付事实主单,表达一次业务收款/核销结果,与 `bk_transaction*` 的渠道交易事实通过交易号或渠道单号关联 |
| `biz_payment_record_detail` | `payment_id`, `charge_id`, `charge_detail_id`, `detail_type`, `allocated_amount`, `late_fee_amount` | 支付分配明细,表达一笔收款对账单、费用组成、本金/违约金等核销对象的分配关系 |
#### REV-003 支付事实分层口径
| 层次 | 主对象 | 归属 | 说明 |
| :--- | :--- | :--- | :--- |
| 账单结果投影 | `biz_charge``biz_charge_detail` | `REV-002` / `REV-003` 联动 | 表达应收、欠费、已缴、核销状态等账单结果,不承载完整支付主单语义 |
| 业务支付事实目标层 | `biz_payment_record``biz_payment_record_detail` | `REV-003` | 表达业务收款事实与分配明细,承接旧 `PM_PAY_DETAILS` 的实收、实销、滞纳金、红冲关联等核心语义 |
| 渠道交易事实 | `bk_transaction*` | `SYS-009` | 表达银行/聚合支付/回调/对账/结算渠道事实,不直接替代业务支付分配明细 |
### biz_invoice / biz_invoice_taxrate (发票主表与税率表)
| 表名 | 关键字段 | 说明 |
| :--- | :--- | :--- |
@ -1153,7 +1170,7 @@ retrieval_priority: P0
| 旧对象/旧菜单 | 当前主口径 | 承接方式 | 数据策略 |
| :--- | :--- | :--- | :--- |
| 开账记录、特殊开账 | `biz_charge``biz_charge_detail``biz_operat_log*` | 统一纳入营业账主表与明细表,特殊开账按来源类型、业务类型、依据说明留痕,不单设平行“特殊开账表” | 在线保留 |
| 柜台收费、实时收费、代收代扣 | `biz_collection``biz_withholding``bk_transaction*``bk_withholding_*` | 统一纳入收费主模型与渠道交易模型,柜台班结/实时收费日志按交易结果和操作留痕归并 | 在线保留 |
| 柜台收费、实时收费、代收代扣 | `biz_collection``biz_withholding`目标/原型 `biz_payment_record*``bk_transaction*``bk_withholding_*` | 统一纳入收费主模型、业务支付事实目标层与渠道交易模型,柜台班结/实时收费日志按交易结果、支付分配和操作留痕归并 | 在线保留 / 目标层待验真 |
| 发票申请、开票结果、票据税率 | `biz_invoice``biz_invoice_taxrate``biz_cust_invoice` | 统一纳入发票主表、税率表和客户开票信息,不为旧“营业账开票表”机械复制新在线表 | 在线保留 |
| 微网厅业务字段、页面配置、微信参数 | `biz_business_types``biz_business_datas``biz_page_settings*``biz_parameter_settings``sys_wechat_app_settings` | 统一归并为业务类型、页面配置和渠道参数模型 | 在线保留 |
| 办理附件、电子档案 | `biz_content``biz_content_attach` | 当前新增与迁移后新增资料统一按资料主表与附件表承接 | 在线保留 |
@ -1174,7 +1191,7 @@ retrieval_priority: P0
| 对账主题 | 最低核对维度 | 主口径来源 | 验收要求 |
| :--- | :--- | :--- | :--- |
| 开账记录 | 客户数、账单数、账期、应收金额 | `biz_charge``biz_charge_detail` + 历史账单来源 | 支持按账期、营业所、客户类型汇总比对 |
| 缴费记录 | 收费笔数、实收金额、渠道、核销状态 | `biz_collection``bk_transaction*` | 支持按渠道、日期、营业所汇总比对 |
| 缴费记录 | 收费笔数、实收金额、渠道、核销状态、分配金额 | `biz_collection`目标/原型 `biz_payment_record*``bk_transaction*` | 支持按渠道、日期、营业所汇总比对,并区分业务支付事实与渠道交易事实 |
| 发票记录 | 开票笔数、金额、状态、票据类型 | `biz_invoice*` + 历史开票关系 | 支持按发票状态、开票日期比对 |
| 红冲与账务调整 | 调整笔数、调整金额、处理结果 | 账务处理结果 + 历史台账 | 支持汇总与单据级差异定位 |
| 催缴与停复水 | 通知笔数、执行结果、停复水状态 | `IF-REV-013` 任务结果 + 历史记录 | 支持按账期、客户、执行状态、处置引用比对 |

View File

@ -95,8 +95,8 @@ retrieval_priority: P0
|---------|----------|-------------|
| REV-001 | 客户资料管理 | 客户、账户、联系人、水表绑定等主数据查询与维护 |
| REV-002 | 抄表开账 | 抄表任务、抄表数据、校验、开账触发 |
| REV-003 | 营业收费 | 收费受理、账单核销、柜台与渠道收款状态回写 |
| REV-004 | 账务处理 | 调整、退款、冲正、坏账等账务处理申请与结果回写 |
| REV-003 | 营业收费 | 收费受理、账单核销、柜台与渠道收款状态回写,并承接业务支付事实与分配明细的目标语义 |
| REV-004 | 账务处理 | 调整、退款、冲正、坏账等账务处理申请与结果回写;仅引用原支付/渠道事实,不拥有支付主域 |
| REV-005 | 发票管理 | 发票申请、开票结果回写、票据状态查询 |
| REV-006 | 催缴管理 | 催缴名单生成、催缴任务下发、通知结果回写 |
| REV-007 | 统计分析 | 营收、抄表、收费、客户、渠道统计查询 |
@ -296,8 +296,8 @@ retrieval_priority: P0
| IF-REV-003 | 抄表任务下发接口 | REV-002 | 按册本、片区、抄表周期生成抄表任务 | `biz_meter_book``biz_meter_read` |
| IF-REV-004 | 抄表数据提交接口 | REV-002 | 提交抄表数据、图片、异常标记并触发校验 | `biz_reading_data``biz_reading_logs``biz_last_reading` |
| IF-REV-005 | 账单生成接口 | REV-002 | 根据抄表结果、价格模板和费用组成生成账单 | `biz_charge``biz_charge_detail``biz_price_template``biz_cost_component` |
| IF-REV-006 | 缴费处理接口 | REV-003 | 创建收费记录、核销账单、回写收款结果 | `biz_collection``biz_charge``bk_transaction` |
| IF-REV-007 | 账务调整接口 | REV-004 | 发起金额调整、退款、冲正、坏账等业务处理 | `biz_charge``biz_charge_detail``biz_operat_log` |
| IF-REV-006 | 缴费处理接口 | REV-003 | 创建收费记录、核销账单、回写收款结果,并形成业务支付事实/分配明细目标语义 | `biz_collection``biz_charge``bk_transaction`;目标/原型:`biz_payment_record``biz_payment_record_detail` |
| IF-REV-007 | 账务调整接口 | REV-004 | 发起金额调整、退款、冲正、坏账等业务处理,按引用关系校验原业务支付事实与渠道流水 | `biz_charge``biz_charge_detail``biz_operat_log`;引用:`bk_transaction*`、目标/原型 `biz_payment_record*` |
| IF-REV-008 | 发票申请接口 | REV-005 | 后台发起单笔/批量开票申请并生成受理主键 | `biz_invoice``biz_invoice_taxrate``biz_cust_invoice` |
| IF-REV-009 | 发票结果查询接口 | REV-005 | 按申请单号/受理号查询开票结果并执行补偿查询 | `biz_invoice``biz_operat_log` |
| IF-REV-013 | 催缴任务生成与结果承接接口 | REV-006 | 生成催缴任务、查询任务结果并承接四态状态回写 | `biz_charge``biz_operat_log`、历史催缴查询口径 |
@ -431,8 +431,8 @@ retrieval_priority: P0
| 归属模块 | REV-003 |
| 请求方式 | POST |
| 请求路径 | `/admin-api/revenue/collection/create` |
| 功能描述 | 处理柜台收费、预存抵扣、渠道收款确认与账单核销 |
| 核心表 | `biz_collection``biz_charge``bk_transaction` |
| 功能描述 | 处理柜台收费、预存抵扣、渠道收款确认与账单核销,并在目标口径下沉淀业务支付主单与账单/费用分配明细 |
| 核心表 | 现状:`biz_collection``biz_charge``bk_transaction`;目标/原型:`biz_payment_record``biz_payment_record_detail` |
### IF-REV-007 账务调整接口
@ -443,11 +443,11 @@ retrieval_priority: P0
| 请求方式 | POST |
| 请求路径 | `/admin-api/revenue/accounting/adjust` |
| 功能描述 | 发起水量调整、金额调整、退款、冲正、坏账申请五类账务处理,并统一返回处理结果、审批边界与账单回写状态 |
| 核心表 | `biz_charge``biz_charge_detail``biz_operat_log``bk_transaction*` |
| 核心表 | `biz_charge``biz_charge_detail``biz_operat_log`;退款/冲正引用 `bk_transaction*` 与目标/原型 `biz_payment_record*` 进行原支付事实追溯 |
边界约束:
- 一期仅覆盖 `USAGE``AMOUNT``REFUND``REVERSE``BAD_DEBT` 五类 `adjustType`
- 退款、冲正必须提供 `sourceTradeNo` 并完成原交易校验;其他场景不得误用支付流水替代业务依据。
- 退款、冲正必须提供 `sourceTradeNo` 并完成原交易校验;涉及业务支付事实时按 `REV-003` 目标口径引用 `biz_payment_record*`其他场景不得误用支付流水替代业务依据。
- 审批相关内容仅保留 `approvalRequired``PENDING_APPROVAL` 与边界说明,不展开 BPM 节点与审批回写实现细节。
- `resultStatus``writeBackStatus` 必须分离表达,前者表示处理结论,后者表示账单状态回写结论。
@ -1544,7 +1544,7 @@ sequenceDiagram
| 客户扩展关系 | `biz_cust_meter``biz_cust_invoice``biz_cust_app_binds``biz_cust_collection_rel``biz_cust_withholding_rel` | 用于客户关联对象查询与服务协同 |
| 抄表与开账 | `biz_meter_book``biz_meter_read``biz_reading_data``biz_last_reading``biz_charge``biz_charge_detail` | 用于抄表任务、账单生成、费用明细查询 |
| 价格与参数 | `biz_price_*``biz_cost_component``biz_parameter_settings``biz_page_settings*` | 用于价格模板、业务参数、页面配置 |
| 收费与票据 | `biz_collection``biz_withholding``biz_invoice``biz_invoice_taxrate` | 用于收费、代扣、发票申请与回写 |
| 收费、业务支付事实与票据 | `biz_collection``biz_withholding`目标/原型 `biz_payment_record``biz_payment_record_detail``biz_invoice``biz_invoice_taxrate` | 用于收费、代扣、业务支付主单/分配明细目标语义、发票申请与回写`biz_payment_record*` 需以实现/DDL 验真后再升级为已落地生产表 |
| 办理与资料 | `biz_process*``biz_business_datas``biz_content*` | 用于业务办理与进度跟踪 |
| 银行代收与结算 | `bk_transaction*``bk_withholding_*``bk_reconcile_*``bk_settlement_batch` | 用于支付流水、批次、回调、对账和结算 |
@ -1739,7 +1739,7 @@ sequenceDiagram
| 查询主题 | 挂靠接口族 | 主要数据来源 | 最低返回要求 | 说明 |
|---------|------------|--------------|--------------|------|
| 历史账单、特殊开账 | `IF-CS-002``IF-REV-005` | `biz_charge*` + 历史账单来源 | 原账单号、新账单号、客户号、账期、金额、状态、来源类型 | 支撑账单迁移核查与客户侧历史查询 |
| 缴费记录、柜台结账、实时收费 | `IF-CS-002``IF-REV-006``IF-REV-011` | `biz_collection``bk_transaction*` + 历史收费记录 | 原流水号、渠道、实收金额、收费时间、柜员/营业所、核销状态 | 支撑渠道对账、柜面核查和历史收据核对 |
| 缴费记录、柜台结账、实时收费 | `IF-CS-002``IF-REV-006``IF-REV-011` | `biz_collection`目标/原型 `biz_payment_record*``bk_transaction*` + 历史收费记录 | 原流水号、渠道、业务支付金额、分配/核销金额、收费时间、柜员/营业所、核销状态 | 支撑渠道对账、柜面核查和历史收据核对;业务支付事实归 `REV-003`,渠道事实归 `SYS-009` |
| 红冲与账务调整 | `IF-REV-007` | 操作留痕、流程结果 + 历史调整台账 | 调整类型、关联原单号、调整金额、原因、审批状态、处理时间 | 支撑预存退款、已销调整、价差调整、分账调整、呆坏账查询 |
| 发票与开票关系 | `IF-REV-008``IF-CS-004` | `biz_invoice*` + 历史开票关系快照 | 发票号、申请单号、关联账单、票据状态、票据类型、文件地址 | 支撑发票结果核查与历史补打定位 |
| 催缴、停复水、预存短信 | `IF-REV-013``IF-METER-002` | 通知结果、流程工单 + 历史催缴记录 | 客户号、账期、催缴方式、消息状态、停复水状态、执行人、执行时间、处置引用 | 支撑催缴处置闭环核查 |

View File

@ -0,0 +1,171 @@
# REV004 自动化回归脚本 + legacy fallback 缩减2026-04-17
## 本轮目标
1. 为 REV004 建立可重复执行的自动化回归脚本入口。
2. 继续缩小 accountProcess 对 legacy fallback 的直接依赖面。
## 后端代码变更
### 1. 新增回归脚本目录
后端新增:`script/rev004-regression/`
- `env.sh`
- `01_prepare_env.sh`
- `02_unit_regression.sh`
- `03_live_db_smoke.sh`
- `04_summary.sh`
- `run_all.sh`
说明:
- unit 回归默认覆盖:`AccountingAdjustQueryServiceImplTest``AccountingAdjustProcessServiceImplTest``AccountingAdjustActionServiceImplTest``ChargeServiceAccountingAdjustTest``PrestorageFormalizationServiceTest`
- live DB smoke 默认覆盖:
- `Rev004AccountProcessLiveDbReadinessTest`
- `Rev004AccountProcessCanaryQueryIntegrationTest`
- `prestoragePage_shouldReturnSuccessEnvelope`
- `prestorageSubmit_shouldChangeBalanceAndWriteOperatLog`
- `prestorageRevoke_shouldRestoreBalanceAndWriteRevokeLog`
- `prestorageSubmit_thenProcessAndAttachmentsShouldExposeReturnedAdjustmentNo`
### 2. 缩减 legacy fallback 使用面
#### `AccountingAdjustProcessServiceImpl`
- `getProcess(...)`:调整为
- prestorage formal 优先
- unified snapshot 次优先
- synthetic snapshot 仅在 unified 缺失时兜底
- `getAttachments(...)`:调整为
- prestorage formal 优先
- unified snapshot 次优先
- synthetic snapshot 仅在 unified 缺失时兜底
#### `AccountingAdjustQueryServiceImpl`
- page 聚合时,先汇总 formal adjustmentNo 集合
- legacy request log 转换出的 request record 若 adjustmentNo 已被 formal 记录覆盖,则不再进入 merged 集合
- 保留 legacy log 的审计/兜底职责,但不再重复参与 formal 已覆盖对象的主结果聚合
## 新增/更新测试
### 单测补强
- `AccountingAdjustProcessServiceImplTest`
- `getProcess_shouldPreferUnifiedSnapshotOverSyntheticFallback`
- `getAttachments_shouldPreferUnifiedSnapshotOverSyntheticFallback`
- `AccountingAdjustQueryServiceImplTest`
- `getAccountingAdjustPage_shouldSkipLegacyRequestRecordWhenFormalRecordExists`
## 验证结果
### 1. unit 回归
执行:
```bash
script/rev004-regression/02_unit_regression.sh
```
结果:
- `Tests run: 68, Failures: 0, Errors: 0, Skipped: 0`
- `BUILD SUCCESS`
### 2. live DB smoke
执行:
```bash
script/rev004-regression/03_live_db_smoke.sh
```
结果:
- `Tests run: 5, Failures: 0, Errors: 0, Skipped: 0`
- `BUILD SUCCESS`
### 3. 一键入口
执行:
```bash
script/rev004-regression/run_all.sh
```
结果:
- unit + live DB smoke 均通过
- 日志目录:
- `.omx/logs/rev004-regression/20260417T110151Z`
## 当前边界
- 当前 live DB smoke 默认仍以 prestorage 稳定链路为主,用来验证真实数据库 + Spring + MockMvc + formal/legacy 协同路径。
- writtenoff / price diff / redink / bad debt 在本轮主要由 targeted unit regression 覆盖;后续可继续补到 live DB fixture。
- `Rev004AccountProcessCanaryQueryIntegrationTest` 中仍有其它更大范围场景未纳入默认 smoke 入口,本轮没有把它们全部收进默认脚本,以避免把未收敛场景误当作回归主入口。
## 结论
本轮已完成:
- REV004 自动化回归脚本首版落地
- 一键执行入口可用
- process / attachments 的 legacy fallback 优先级继续收口
- page 聚合中的 duplicate legacy request 参与面继续缩小
## 追加收口(继续删 fallback
### Query 层进一步收口
- `AccountingAdjustQueryServiceImpl#getAccountingAdjustPage(...)`
- `loadLatestActionMap(...)` 改为只对 legacy request records 构建 action overlay
- formal 记录即使 chargeId 下存在 legacy approval log也不再被 legacy 审批轨迹回填覆盖主状态
### 新增回归测试
- `getAccountingAdjustPage_shouldNotLetLegacyApprovalOverrideFormalRecord`
- 验证formal 已存在时legacy approval log 不再覆盖 formal 的 `approvalStatus/resultStatus/writeBackStatus/message/actionAmount`
### 本次追加验证
执行:
```bash
mvn -pl sw-business/sw-business-server -Dtest=AccountingAdjustQueryServiceImplTest,AccountingAdjustProcessServiceImplTest test
```
结果:
- `Tests run: 32, Failures: 0, Errors: 0, Skipped: 0`
- `BUILD SUCCESS`
### 统计口径锁定
新增测试:
- `getAccountingAdjustStat_shouldIgnoreLegacyApprovalForFormalRecord`
验证:
- formal record 已存在时legacy approval/action 不再把统计口径从 `PENDING_APPROVAL` 误改成 `APPROVED`
- `totalActionAmount` 仍取 formal 金额
执行:
```bash
mvn -pl sw-business/sw-business-server -Dtest=AccountingAdjustQueryServiceImplTest test
```
结果:
- `Tests run: 13, Failures: 0, Errors: 0, Skipped: 0`
- `BUILD SUCCESS`
再次执行:
```bash
script/rev004-regression/run_all.sh
```
结果:
- unit`Tests run: 69, Failures: 0, Errors: 0, Skipped: 0`
- live smoke`Tests run: 5, Failures: 0, Errors: 0, Skipped: 0`
- `BUILD SUCCESS`
### 日志查询口径锁定
新增测试:
- `getAccountingAdjustLogs_shouldReturnSyntheticFormalLogWhenLegacyLogsMissing`
验证:
- formal 对象即使没有 legacy operat_log也能通过 `getAccountingAdjustLogs` 返回一条 synthetic formal log
- 前端日志页不再被 legacy log 是否存在所卡死
执行:
```bash
mvn -pl sw-business/sw-business-server -Dtest=AccountingAdjustQueryServiceImplTest test
```
结果:
- `Tests run: 14, Failures: 0, Errors: 0, Skipped: 0`
- `BUILD SUCCESS`
### action-only 日志补齐
新增测试:
- `getAccountingAdjustLogs_shouldPrependSyntheticFormalLogWhenOnlyActionLogExists`
验证:
- formal 对象若只有 legacy action log、没有 legacy request log
- 日志列表会自动在前面补一条 synthetic formal log再保留 legacy action log
- 前端日志时间线可同时看到 formal 主记录和 legacy 审批动作
执行:
```bash
mvn -pl sw-business/sw-business-server -Dtest=AccountingAdjustQueryServiceImplTest test
```
结果:
- `Tests run: 15, Failures: 0, Errors: 0, Skipped: 0`
- `BUILD SUCCESS`

View File

@ -0,0 +1,94 @@
# REV004 prestorage process/attachments strict formal-first2026-04-17
## 目标
收口:
- `GET /admin-api/business/accounting-adjust/prestorage-process`
- `GET /admin-api/business/accounting-adjust/prestorage-attachments`
使其优先读取 prestorage formal-table而不是继续主要依赖 legacy/unified fallback。
## 代码变更
核心变更位于:
- `AccountingAdjustProcessServiceImpl`
- `AccountingAdjustProcessServiceImplTest`
策略:
1. `getProcess(adjustmentNo)` 先尝试 `PrestorageFormalizationService.getView(adjustmentNo)`
2. 命中 formal view 时,直接组装 `AccountingAdjustProcessRespVO`
3. `getAttachments(adjustmentNo)` 先尝试读取 formal `attachmentRefs`
4. 仅在 formal 不存在时才回退到 synthetic / unified 口径
## 验证
### compile
```bash
mvn -pl sw-business/sw-business-server -DskipTests compile
```
结果:**PASS**
### targeted tests
```bash
mvn -pl sw-business/sw-business-server -Dtest=AccountingAdjustProcessServiceImplTest,AccountingAdjustPrestorageProcessServiceImplTest test
```
结果:**PASS**
- Tests run: 23
- Failures: 0
- Errors: 0
## fresh jar smokeport 48098
### health
- `GET /actuator/health` -> `{"status":"UP"}`
### smoke 数据
手工 seed
- `adjustmentNo = REV004-PTR-993001-SEED`
- formal main`biz_prestorage_adjust`
- formal detail`biz_prestorage_adjust_detail`
- attachment refs`101,proof-raw`
### process
调用:
- `GET /admin-api/business/accounting-adjust/prestorage-process?adjustmentNo=REV004-PTR-993001-SEED`
结果:**PASS**
返回关键字段:
- `objectType = LEGACY_PRESTORAGE_TRANSFER`
- `adjustType = TRANSFER`
- `actionAmount = 20.0`
- `resultStatus = SUCCESS`
- `approvalStatus = NOT_REQUIRED`
- `writeBackStatus = UPDATED`
- `attachmentRefs = ["101", "proof-raw"]`
- `applicant = 王五`
- `contactMobile = 13700000000`
- `latestMessage = 预存转账成功,目标户号=C-993002`
说明process 已命中 formal main而不是再走 unified detail 兜底。
### attachments
调用:
- `GET /admin-api/business/accounting-adjust/prestorage-attachments?adjustmentNo=REV004-PTR-993001-SEED`
结果:**PASS**
返回:
- ref=`101` -> 数值 ID 解析,当前附件实体不存在,返回 `resolved=false, message=附件不存在`
- ref=`proof-raw` -> 非数值引用,返回 `resolved=false, message=附件引用不是数值ID保留原始引用`
说明attachments 已优先读取 formal `attachmentRefs`,并保留现有解析策略。
## 清理
已删除:
- `biz_prestorage_adjust / detail` seed 数据
回读结果:
- `prestorage_main_left=0`
- `prestorage_detail_left=0`
运行态:
- `48098` 已停止
## 当前结论
本轮 prestorage 剩余查询缺口已完成 strict formal-first 收口:
1. `prestorage-process` 优先命中 formal
2. `prestorage-attachments` 优先命中 formal attachment refs
3. formal 缺失时仍可继续 fallback
4. 主链路 schema / 写路径无变更

View File

@ -138,3 +138,75 @@ REDINK_RECORD 当前依赖原交易定位 / bank follow-up 逻辑;本轮先采
- fresh query smoke
但“真实 redink 执行成功后自动落 formal”的端到端 smoke 仍需在 `business-bank-server` 可用时补跑。
## live execute smoke 成功补证2026-04-17 17:51 +08:00
在本轮额外启动本地 `business-bank-server`dev profile, port `48092`)并向测试库预置原交易后,重新完成了 REDINK_RECORD 的真实端到端执行 smoke。
### 前置
- 本地启动 `business-bank-server`,并成功注册到 Nacos dev`business-bank-server 192.168.9.109:48092 register finished`
- 向 `bk_transaction` seed 原交易:
- `tran_seq = T-REDINK-NOPE`
- `sys_tran_seq = SYS-REDINK-NOPE`
- `tran_type = PAY`
- `status = SUCCESS`
- `contract_no = 992306`
- `amount = 12000`
- 准备已收费营业账:`chargeId = 992306`
### execute 请求
`POST /admin-api/business/charge/accounting-adjust`
```json
{
"chargeId": 992306,
"objectType": "REDINK_RECORD",
"reasonCode": "1",
"reason": "redink execute smoke",
"originalTranSeq": "T-REDINK-NOPE"
}
```
### execute 响应
结果:**PASS**
返回:
- `adjustmentNo = REV004-992306-20260417175109`
- `objectType = REDINK_RECORD`
- `resultStatus = SUCCESS`
- `approvalStatus = NOT_REQUIRED`
- `writeBackStatus = UPDATED`
- `message = 冲正处理成功bank流水号=RV9923062026041717511073C805`
### DB 回读
`biz_redink_record`
- `adjustment_no = REV004-992306-20260417175109`
- `approval_status = NOT_REQUIRED`
- `execute_status = UPDATED`
- `result_status = SUCCESS`
- `bank_tran_seq = RV9923062026041717511073C805`
- `original_tran_seq = T-REDINK-NOPE`
`biz_redink_record_detail`
- `detail_status = SUCCESS`
- `proc_type = EXECUTE`
- `pay_state_before = 1`
- `pay_state_after = 0`
- `redink_amount = 120.00`
`biz_charge`
- `pay_state = 0`
- 支付信息已清空为红冲后的未收费态
`bk_transaction`
- 原交易 `T-REDINK-NOPE` 状态变为 `REVERSED`
- 新增 follow-up
- `tran_seq = RV9923062026041717511073C805`
- `tran_type = PAY_INVALID`
- `status = SUCCESS`
- `original_tran_seq = T-REDINK-NOPE`
### 查询回读
- `GET /admin-api/business/accounting-adjust/get?adjustmentNo=REV004-992306-20260417175109` -> formal-first 返回成功
- `GET /admin-api/business/accounting-adjust/page?...objectType=REDINK_RECORD` -> formal-first 返回成功
说明至此REDINK_RECORD 已补齐“真实执行 -> 自动落 formal -> formal-first 查询”的完整闭环证据。

View File

@ -15,7 +15,7 @@
| 违约金减免 | `LATE_FEE_REDUCE` | 已独立 | `biz_latefee_reduce` / `biz_latefee_reduce_detail` | 已接线 | 主链路完成 |
| 分账调整 | `SPLIT_ADJUST` | 已独立 | `biz_split_adjust` / `biz_split_adjust_detail` | 已接线 | 专属接口完成 |
| 价差调整 | `PRICE_DIFF_ADJUST` | 已独立 | `biz_price_diff_adjust` / `biz_price_diff_adjust_detail` | 已接线 | 主链路完成 |
| 红冲记录 | `REDINK_RECORD` | 未独立 | 无 | 兼容接口 | 未完成 |
| 红冲记录 | `REDINK_RECORD` | 已独立 | `biz_redink_record` / `biz_redink_record_detail` | 已接线 | 主链路完成(执行链路受外部依赖阻塞补证) |
## 二、已独立对象明细
@ -86,22 +86,30 @@
## 三、未独立对象
### 1. 红冲记录 `REDINK_RECORD`
- 当前未见独立 formal-table 主线
- 仍属于兼容口径对象
- DDL`sql/rev004/REV004_redink_formal_tables_deploy.sql`
- 表:`biz_redink_record``biz_redink_record_detail`
- 当前判断:
- REDINK_RECORD 成功执行结果已落结果型 formal 主从表
- `get/page` 已接入 formal-first
- 保留 legacy `operat_log` 兼容轨迹
- 真实 live execute smoke 仍受 `business-bank-server` 无可用实例阻塞,已在 evidence 中记录精确异常
## 四、当前最适合的后续优先级
1. prestorage `process / attachments` strict formal-first 收口
2. `REDINK_RECORD` 是否 formal-table 化
3. 统一补一版“对象 → 表 → 接口 → 真值口径”对外联调说明
2. 对外联调版“对象 → 表 → 接口 → 真值口径”说明
3. `business-bank-server` 可用后补 redink live execute 完整 smoke
## 五、证据锚点
- backend 已合入:
- PR #77 -> `9462f3a12728b83bfe31e0b74c526f4256f5b361`writtenoff
- PR #78 -> `1964c7823291cd4972c72c50ffcad154f3a74b4c`price-diff
- PR #79 -> `d8596af47479ef28664b83200d86f7770c8b9bd4`redink
- docs 已合入:
- `b5efa3b2480b1a0b8a00b728ac434f833787b6b4`(前一轮矩阵基线)
- `c741164fa48dd79f4c43ffb15e3b093933dc642c`price-diff evidence
- `57763c634e0e6733d0861051f6b78c5dcdb9022f`redink evidence
- fresh smoke evidence
- `docs/evidence/rev004-writtenoff-formal-table-dev-db-apply-2026-04-17.md`
- `docs/evidence/rev004-price-diff-formal-table-dev-db-apply-2026-04-17.md`
- `docs/evidence/rev004-redink-formal-table-dev-db-apply-2026-04-17.md`
- formal-table 状态矩阵:`docs/guides/REV004_FORMAL_TABLE_STATUS_MATRIX.md`

View File

@ -0,0 +1,100 @@
# REV004 最终主线验收 / 联调交付总表
## 1. 当前主线基线
### backend
- repo`emsoft-IF/sw-system-cloud`
- branch`develop`
- latest merge`ea159faa3bae2b7491d4e60cbe79e392e77e7345`
### docs
- repo`tangweijie/fujian_water_biz_doc`
- branch`main`
- latest mainline content以当前 `main` 分支最新提交为准(此处不再固化 commit sha避免总表在自我合并后立即过期
---
## 2. 已完成的 REV004 主对象真值恢复
| 对象 | objectType / 域 | 主表 | 当前主线状态 | 备注 |
|---|---|---|---|---|
| 预存调整 | prestorage | `biz_prestorage_adjust` / `biz_prestorage_adjust_detail` | 已完成 | process/attachments 也已 strict formal-first 收口 |
| 坏账调整 | `BAD_DEBT_RECORD` | `biz_bad_debt_adjust` / `biz_bad_debt_adjust_detail` | 已完成 | formal-first |
| 已销调整 / 核销 | `WRITTENOFF_ADJUST` | `biz_writtenoff_adjust` / `biz_writtenoff_adjust_detail` | 已完成 | formal-first |
| 违约金减免 | `LATE_FEE_REDUCE` | `biz_latefee_reduce` / `biz_latefee_reduce_detail` | 已完成 | formal-first |
| 分账调整 | `SPLIT_ADJUST` | `biz_split_adjust` / `biz_split_adjust_detail` | 已完成 | 专属对象域 |
| 价差调整 | `PRICE_DIFF_ADJUST` | `biz_price_diff_adjust` / `biz_price_diff_adjust_detail` | 已完成 | formal-first |
| 红冲记录 | `REDINK_RECORD` | `biz_redink_record` / `biz_redink_record_detail` | 已完成 | 结果型 formal-table已补齐 live execute 闭环证据 |
---
## 3. 本轮已合入主线的 PR / merge sha
### backend develop
- PR #77writtenoff formal-table
- merge sha`9462f3a12728b83bfe31e0b74c526f4256f5b361`
- PR #78price-diff formal-table
- merge sha`1964c7823291cd4972c72c50ffcad154f3a74b4c`
- PR #79redink formal-table
- merge sha`d8596af47479ef28664b83200d86f7770c8b9bd4`
- PR #80prestorage process/attachments strict formal-first
- merge sha`ea159faa3bae2b7491d4e60cbe79e392e77e7345`
### docs main
- price-diff evidence merge`c741164fa48dd79f4c43ffb15e3b093933dc642c`
- current truth matrix含 price-diffmerge`692ac419f6fab7da63e90e74e06d200e427580fa`
- redink evidence merge`57763c634e0e6733d0861051f6b78c5dcdb9022f`
- current truth matrix含 redinkmerge`89737608b356dcc3dd40e40d90cf9064059ca467`
- prestorage strict formal-first evidence merge`415b4cee1303f51c7a3aeb0a58722873e852452c`
---
## 4. 已有 evidence 文档
- `docs/evidence/rev004-prestorage-formal-table-dev-db-apply-2026-04-16.md`
- `docs/evidence/rev004-bad-debt-formal-table-dev-db-apply-2026-04-17.md`
- `docs/evidence/rev004-writtenoff-formal-table-dev-db-apply-2026-04-17.md`
- `docs/evidence/rev004-price-diff-formal-table-dev-db-apply-2026-04-17.md`
- `docs/evidence/rev004-redink-formal-table-dev-db-apply-2026-04-17.md`
- `docs/evidence/rev004-prestorage-strict-formal-first-2026-04-17.md`
---
## 5. 当前仍需说明的残留点
### 5.1 redink
- formal-table 已落主线
- compile / targeted tests / DDL / query smoke / live execute smoke 已完成
- 已确认:
- 自动创建 follow-up bank 交易
- 原交易状态更新为 `REVERSED`
- formal main/detail 自动落表
### 5.2 其他对象
- 当前主线里最明显未独立 formal-table 的核心对象已经大幅减少
- 如果继续扩展,下一步更适合做:
- 对外联调说明收口
- 或处理外部依赖类 blocker 补证
---
## 6. 给联调方的可直接口径
### 对前端
当前 REV004 主线可按独立对象化口径使用:
- prestorage
- bad debt
- writtenoff
- late fee reduce
- split adjust
- price diff
- redink
其中:
- prestorage 的 `process / attachments` 已 formal-first
- redink 已独立,且 live execute 闭环证据已补齐
### 对测试
优先参考对应 evidence 文档回归:
- 表结构是否存在
- DDL 是否幂等
- compile / targeted tests 是否通过
- fresh smoke 是否通过
- cleanup 是否完成
### 对产品 / 管理
REV004 本轮已基本完成主对象 formal-table 恢复与主线收口;后续重点已从“建模缺失”转向“外部依赖补证 + 联调说明完善”。

View File

@ -0,0 +1,114 @@
# REV004 上线前检查清单 / 联调问题清单
## 1. 当前基线
### backend
- branch: `develop`
- latest verified merge: `ea159faa3bae2b7491d4e60cbe79e392e77e7345`
### docs
- branch: `main`
- latest verified merge: `3741fd597df21c54356a1a09778074a8450c73cc`
---
## 2. 已完成对象(当前可联调)
- prestorage
- bad debt
- writtenoff
- late fee reduce
- split adjust
- price diff
- redink
说明:以上对象均已有主线 evidence 文档,可作为联调准入依据。
---
## 3. 上线前必查项
### A. 代码 / 构建
- [ ] backend 当前部署分支确认包含:`ea159faa...` 及之后需要上线的提交
- [ ] `mvn -pl sw-business/sw-business-server -DskipTests compile` 通过
- [ ] 目标对象对应 targeted tests 通过
- [ ] 关键接口 OpenAPI/Controller 路由与前端调用地址一致
### B. 数据库 / DDL
- [ ] 以下表在目标环境已存在:
- `biz_prestorage_adjust`
- `biz_prestorage_adjust_detail`
- `biz_bad_debt_adjust`
- `biz_bad_debt_adjust_detail`
- `biz_writtenoff_adjust`
- `biz_writtenoff_adjust_detail`
- `biz_latefee_reduce`
- `biz_latefee_reduce_detail`
- `biz_price_diff_adjust`
- `biz_price_diff_adjust_detail`
- `biz_redink_record`
- `biz_redink_record_detail`
- `biz_split_adjust`
- `biz_split_adjust_detail`
- [ ] 对应 deploy SQL 在目标环境幂等可重放
- [ ] 字典已对齐前端绑定(尤其 `account_adjust_*``price_reason``redink_reason` 等)
### C. 外部依赖
- [ ] `business-bank-server` 可用redink / refund 真实链路)
- [ ] Nacos 注册正常
- [ ] Redis 可用
- [ ] 目标环境数据库可写
- [ ] 如涉及 XXL/定时组件,端口与注册不会冲突
### D. 联调 smoke
- [ ] prestoragesubmit / revoke / page / detail / process / attachments
- [ ] bad debtsubmit / approve / reject / page / detail
- [ ] writtenoffsubmit / approve / reject / page / detail
- [ ] late fee reducesubmit / batch submit / page / detail
- [ ] splitsubmit / page / detail / result
- [ ] price diffsubmit / approve / reject / page / detail
- [ ] redinkexecute / get / page
### E. 清理
- [ ] 测试数据已清理
- [ ] 临时端口实例已停止
- [ ] evidence 已回写文档
---
## 4. 联调问题清单(当前已知)
### 4.1 当前已闭环
- prestorage `process / attachments` 已 strict formal-first
- redink 已补齐 live execute 成功补证
### 4.2 当前仍需关注
- redink / refund 一旦切到真实环境,需确认 `business-bank-server` 服务实例与原交易数据确实可用
- split 的 deploy SQL 来源需继续保持环境一致性(当前代码/对象域已独立,但表结构不在本轮 `sql/rev004` 内新增)
- 若未来要移除 legacy fallback需先做历史数据兼容评估
---
## 5. 推荐联调顺序
1. 字典与页面下拉/标签校验
2. prestorage 全链路
3. writtenoff / bad debt / price diff 审批链路
4. redink live execute
5. split / late fee reduce 补充场景
---
## 6. 对外沟通口径(可直接复用)
> 当前 REV004 主线已经完成主要账务对象的 formal-table 恢复与查询真值收口,包含预存、坏账、已销/核销、违约金减免、分账、价差、红冲。\
> 联调阶段请优先按各 evidence 文档验证目标环境的表结构、接口返回、fresh smoke 与清理结果;如涉及红冲/退款真实链路,请同时确认 `business-bank-server` 与原交易数据可用。
---
## 7. 证据索引
- `docs/guides/REV004_FINAL_MAINLINE_DELIVERY_SUMMARY.md`
- `docs/guides/REV004_CURRENT_TRUTH_MATRIX.md`
- `docs/evidence/rev004-prestorage-formal-table-dev-db-apply-2026-04-16.md`
- `docs/evidence/rev004-prestorage-strict-formal-first-2026-04-17.md`
- `docs/evidence/rev004-bad-debt-formal-table-dev-db-apply-2026-04-17.md`
- `docs/evidence/rev004-writtenoff-formal-table-dev-db-apply-2026-04-17.md`
- `docs/evidence/rev004-price-diff-formal-table-dev-db-apply-2026-04-17.md`
- `docs/evidence/rev004-redink-formal-table-dev-db-apply-2026-04-17.md`
- `docs/evidence/rev004-latefee-formal-table-dev-db-apply-2026-04-15.md`

View File

@ -0,0 +1,164 @@
# REV004 上线实施步骤清单 / 环境巡检清单
## 1. 适用范围
用于 REV004 账务处理对象主线恢复完成后的:
- 上线前环境核查
- 上线实施步骤
- 上线后核验
- 异常回滚与补证
当前主线基线:
- backend `develop``ea159faa3bae2b7491d4e60cbe79e392e77e7345`
- docs `main``9946fa75722eb4d13e213763ff2f0c9f8e1cb509`
---
## 2. 上线前环境巡检
### A. 服务注册
- [ ] `business-server` 正常注册到 Nacos
- [ ] `business-bank-server` 正常注册到 Nacos
- [ ] `system-server` / `infra-server` 可发现
- [ ] 不存在端口冲突(尤其 XXL executor 端口)
### B. 数据库
- [ ] PostgreSQL 连接正常
- [ ] 目标 schema 可写
- [ ] 下列表存在:
- `biz_prestorage_adjust`
- `biz_prestorage_adjust_detail`
- `biz_bad_debt_adjust`
- `biz_bad_debt_adjust_detail`
- `biz_writtenoff_adjust`
- `biz_writtenoff_adjust_detail`
- `biz_latefee_reduce`
- `biz_latefee_reduce_detail`
- `biz_price_diff_adjust`
- `biz_price_diff_adjust_detail`
- `biz_redink_record`
- `biz_redink_record_detail`
- `biz_split_adjust`
- `biz_split_adjust_detail`
- [ ] DDL 可幂等重放
### C. 中间件
- [ ] Redis 正常
- [ ] Nacos 正常
- [ ] RocketMQ / Rabbit / Kafka如环境需要状态符合部署要求
- [ ] XXL Admin 可访问,且不会因不可达阻断核心业务启动
### D. 外部依赖
- [ ] `business-bank-server` 能处理:
- `get-by-tran-seq`
- `createFollowupTransaction`
- [ ] 原交易测试数据可用redink/refund
---
## 3. 上线实施步骤
### Step 1 — 代码版本确认
- [ ] backend 部署目标包含 `ea159faa...` 之后所有需要上线提交
- [ ] docs 主线已可供联调/运维参考
### Step 2 — DDL 执行
按对象顺序执行/确认以下脚本:
- [ ] `REV004_prestorage_formal_tables_deploy.sql`
- [ ] `REV004_bad_debt_formal_tables_deploy.sql`
- [ ] `REV004_writtenoff_formal_tables_deploy.sql`
- [ ] `REV004_latefee_formal_tables_deploy.sql`
- [ ] `REV004_price_diff_formal_tables_deploy.sql`
- [ ] `REV004_redink_formal_tables_deploy.sql`
### Step 3 — 服务启动
建议顺序:
1. 基础依赖Nacos / Redis / DB
2. `business-bank-server`
3. `business-server`
4. 其余依赖服务
### Step 4 — 上线后即时 smoke
- [ ] `actuator/health`
- [ ] prestorage `process / attachments`
- [ ] writtenoff get/page
- [ ] bad debt get/page
- [ ] price diff get/page
- [ ] redink get/page
- [ ] redink execute若环境允许
---
## 4. 推荐联调顺序
1. 字典 / 下拉 / label 核对
2. prestorage 全链路
3. writtenoff / bad debt / price diff 审批链路
4. redink 执行链路
5. split / late fee reduce 补充场景
---
## 5. 上线后核验
### 数据核验
- [ ] 新请求是否优先落 formal 表
- [ ] `get/page` 是否优先命中 formal 数据
- [ ] fallback 仅在 formal 缺失时触发
### redink 特别核验
- [ ] 原交易状态是否转为 `REVERSED`
- [ ] follow-up bank 交易是否创建成功
- [ ] formal main/detail 是否同步落表
### prestorage 特别核验
- [ ] `prestorage-process` 返回 formal-first
- [ ] `prestorage-attachments` 返回 formal attachment refs
---
## 6. 回滚 / 降级思路
### 可逆项
- 查询口径改动可回滚为 legacy-fallback 优先
- formal 表为增量对象表,保留不影响旧日志骨架
### 不建议直接回滚项
- 已执行过的 DDL 不建议删除
- 已落表业务数据不应物理删除作为“回滚”手段
### 建议做法
- 保留 schema
- 回退服务代码到上一个稳定版本
- 用 evidence 文档确认受影响对象与链路
---
## 7. 现场问题快速定位
### 若 `get/page` 没命中 formal
检查:
- formal main/detail 是否已落表
- objectType 是否匹配
- adjustmentNo 是否一致
- fallback 是否被触发
### 若 redink execute 报错
检查:
- `business-bank-server` 是否可用
- Nacos 是否注册成功
- 原交易是否存在
- follow-up transaction 是否可写入 `bk_transaction`
### 若 prestorage process/attachments 异常
检查:
- `biz_prestorage_adjust` 是否存在该 adjustmentNo
- `attachmentRefs` 是否为空/格式异常
- ContentAttach 是否存在对应 ID
---
## 8. 对运维 / 测试的简版口径
> REV004 当前主线已完成主要账务对象 formal-table 恢复与查询收口。上线前请优先确认 formal 表结构、Nacos 注册、business-bank-server 可用性,以及对应 evidence 文档中的 smoke 范围。若 redink/refund 需走真实链路,请同时准备原交易测试数据。
---
## 9. 配套文档
- `REV004_FINAL_MAINLINE_DELIVERY_SUMMARY.md`
- `REV004_GO_LIVE_CHECKLIST.md`
- `REV004_CURRENT_TRUTH_MATRIX.md`
- `docs/evidence/rev004-*-formal-table-*.md`
- `docs/evidence/rev004-prestorage-strict-formal-first-2026-04-17.md`

View File

@ -10,7 +10,7 @@
|--------------|--------------|--------------|------------|------|
| 一期纳入范围:水量调整/金额调整/退款/冲正/坏账申请 | `12_REV_Detailed.md` REV-004 场景表 | `03_Interface_Design.md` `IF-REV-007` | `biz_charge*``biz_operat_log*` | 五类场景统一纳入一期,排除独立账务细表扩围 |
| 统一接口入口 | REV-004 接口映射 | `IF-REV-007` 请求/响应定义 | 账单与日志对象 | 不扩展到 `IF-REV-008``IF-REV-011` 等其他接口族 |
| 原交易校验 | REV-004 关键规则 | `sourceTradeNo` 字段 | `bk_transaction*` | 退款/冲正必须联动原交易主状态、回调结果与异常处理状态 |
| 原交易校验 | REV-004 关键规则 | `sourceTradeNo` 字段 | `bk_transaction*`;业务支付事实目标层 `biz_payment_record*` | 退款/冲正必须联动原业务支付事实、渠道交易主状态、回调结果与异常处理状态;支付主域归 `REV-003`/`SYS-009`REV-004 仅引用 |
| 处理结果回写 | REV-004 业务流程/关键规则 | `writeBackStatus``resultStatus` | `biz_charge` 状态承接 | `resultStatus``writeBackStatus` 必须分离表达 |
| 审批边界 | 审批留痕要求 | `approvalRequired``PENDING_APPROVAL` | 仅能力位,无独立审批表要求 | 一期不强接 BPM仅保留边界说明 |
| 留痕与依据 | 操作日志与审批留痕 | `remark``attachmentList` | `biz_operat_log` / `biz_operat_log_detail` | 必须覆盖处理类型、原交易引用、前后差异与附件依据 |

View File

@ -121,12 +121,23 @@
- 处理方式
- 原始处理痕迹
### 4.3 当前仍需进一步核实的字段
### 4.3 支付字段分层补充
旧支付域字段需要区分“业务支付事实”和“渠道交易事实”:
| 旧字段/语义 | REV-003 目标承接 | SYS-009 渠道承接 | 说明 |
|---|---|---|---|
| `PM_PAY_DETAILS.ActualMoney` 实收金额 | `biz_payment_record.payment_amount``biz_payment_record_detail.allocated_amount` | `bk_transaction*` 的渠道实付金额 | 业务实收与渠道到账可同值但语义不同,迁移校验需分别比对 |
| `PM_PAY_DETAILS.SoldMoney` 实销/核销金额 | `biz_payment_record_detail.allocated_amount` | - | 用于表达收款分配到账单/费用组成的核销结果 |
| 滞纳金/违约金金额 | `biz_payment_record_detail.detail_type = LATE_FEE` 或等价分类字段 | - | 不应只落入渠道交易总额,需能追溯本金与违约金分配 |
| 原流水号/渠道单号 | `biz_payment_record.source_transaction_no` | `bk_transaction*` 主交易号/渠道单号 | REV-003 保存业务引用SYS-009 保存渠道事实 |
### 4.4 当前仍需进一步核实的字段
以下字段建议进入下一轮字段核实清单:
- `CT_ACCOUNTS.Deposit / UnCheckMoney / Overdraft` 在当前 backend 的精确落点
- `PM_PAY_DETAILS.ActualMoney``bk_transaction*` 的最终字段承接方式
- `PM_PAY_DETAILS.ActualMoney``biz_payment_record.payment_amount` / `biz_payment_record_detail.allocated_amount``bk_transaction*` 的最终分层承接方式
- `IV_INVOICE_INFOS.SerialNo` 与当前发票协同请求号 / 受理号的对应关系
- `IV_INVOICE_INFOS.CndnCode / CndnNumber` 在当前新模型中的正式字段名

View File

@ -24,10 +24,10 @@
| `AT_CHARGE_DETAILS` | 营业账明细 | 账单费用组成、水量、金额、开票状态 | `ChargeAggregate` | `biz_charge_detail` | `online-main` | `implemented` | `reuse` | 明细层已存在稳定承接对象 |
| `CT_ACCOUNTS` | 账户信息 | 预存余额、未到账金额、透支额度 | `AccountBalance` | `biz_account` / 账户相关对象 | `online-main` | `partial` | `extend` | 需进一步确认与旧 `CT_ACCOUNTS` 字段对齐程度 |
| `CT_ACCOUNT_LOGS` | 账户流水 | 预存进出、余额变化、暂收流水 | `AccountTransaction` | `legacy_account_log_mapping` + 账户流水承接对象 | `mapping-layer` + `history-readonly` | `partial` | `extend` | 当前 `REV-004` 正式主口径未把账户流水建成核心在线对象 |
| `PM_PAY_COLLECTS` | 收费汇总 | 结账周期、收费总笔数、总金额、柜员/网点汇总 | `CollectionSummary` | `biz_collection` + 汇总查询结果 | `online-main` + `history-readonly` | `partial` | `extend` | 汇总语义可承接,旧统计台账宜只读保留 |
| `PM_PAY_SUBTOTALS` | 收费小计 | 按渠道、收费类型、收退标识的小计结果 | `CollectionSummary` | `biz_collection` + 汇总查询结果 | `history-readonly` | `readonly` | `retain-readonly` | 不建议为旧小计表单独在线重建 |
| `PM_PAY_DETAILS` | 收费明细 | 实收、实销、滞纳金、红冲关联、收费员 | `Transaction` / `CollectionDetail` | `bk_transaction*` + 收费结果关系 | `online-main` + `mapping-layer` | `partial` | `extend` | 需补旧收费明细到新交易对象的映射关系 |
| `AT_REFUNDS` | 退款账 | 退款金额、退款状态、退款时间、退款人 | `AccountingRequest` / `Transaction` | `IF-REV-007` 退款场景 + `bk_transaction*` | `online-main` + `mapping-layer` | `partial` | `extend` | 退款语义已有,旧退款账未见独立在线对象 |
| `PM_PAY_COLLECTS` | 收费汇总 | 结账周期、收费总笔数、总金额、柜员/网点汇总 | `CollectionSummary` | `biz_collection` + 目标/原型 `biz_payment_record*` + 汇总查询结果 | `online-main` + `history-readonly` | `partial` | `extend` | 汇总语义可由 REV-003 支付事实目标层和报表承接,旧统计台账宜只读保留 |
| `PM_PAY_SUBTOTALS` | 收费小计 | 按渠道、收费类型、收退标识的小计结果 | `CollectionSummary` | 目标/原型 `biz_payment_record*` + `biz_collection` + 汇总查询结果 | `history-readonly` / target-projection | `partial` | `retain-readonly` | 不建议为旧小计表单独在线重建;新发生业务应从 REV-003 支付事实目标层汇总生成 |
| `PM_PAY_DETAILS` | 收费明细 | 实收、实销、滞纳金、红冲关联、收费员 | `PaymentRecord` / `PaymentRecordDetail` / `Transaction` | REV-003 目标/原型 `biz_payment_record``biz_payment_record_detail` + SYS-009 `bk_transaction*` | `online-main` + `mapping-layer` | `partial` | `extend` | 业务支付事实和分配明细优先映射到 REV-003渠道流水仅承接支付渠道事实 |
| `AT_REFUNDS` | 退款账 | 退款金额、退款状态、退款时间、退款人 | `AccountingRequest` / `PaymentRecord` / `Transaction` | `IF-REV-007` 退款场景 + REV-003 目标/原型 `biz_payment_record*` + `bk_transaction*` | `online-main` + `mapping-layer` | `partial` | `extend` | 退款由 REV-004 发起处理,但原支付事实来自 REV-003渠道退款/原流水来自 SYS-009 |
| `PM_ACCOUNT_RECORDS` | 预存退款汇总 | 预存退款申请单、申请人、流程审批信息 | `AccountingRequest` | `legacy_finance_record_mapping` | `mapping-layer` + `history-readonly` | `partial` | `extend` | 在线保留申请语义,旧审批字段按只读保留 |
| `PM_ACCOUNT_RECORD_DETAILS` | 预存退款详情 | 客户、退款金额、原流水、目标流水、处理方式 | `AccountingEvidence` / `Transaction` | `legacy_finance_record_mapping` + `bk_transaction*` | `mapping-layer` + `history-readonly` | `partial` | `extend` | 需要重点保留原流水、目标流水和退款金额映射 |
| `PM_AMOUNT_RECORDS` | 调整减免汇总 | 水量/金额调整申请、原因、流程审批 | `AccountingRequest` | `IF-REV-007` 调整场景 + `legacy_finance_record_mapping` | `mapping-layer` + `history-readonly` | `partial` | `extend` | 新系统已有统一入口,但旧申请单结构未一对一承接 |
@ -35,7 +35,7 @@
| `PM_PRICE_RECORDS` | 价差调整汇总 | 调价差额修正申请、调价号、原因、审批 | `AccountingRequest` | `legacy_finance_record_mapping` | `mapping-layer` + `history-readonly` | `partial` | `extend` | 汇总申请宜按迁移映射保留 |
| `PM_PRICE_RECORD_DETAILS` | 价差调整明细 | 原账单、新账单、调价前后金额、滞纳金差额 | `ChargeAggregate` / `AccountingEvidence` | `biz_charge` / `biz_charge_detail` + 映射层 | `online-main` + `mapping-layer` | `partial` | `extend` | 语义已部分被账单重算能力承接 |
| `PM_PAYMENT_RECORDS` | 已销调整汇总 | 已收费后修正申请单、原因、流程 | `AccountingRequest` | `legacy_finance_record_mapping` | `mapping-layer` + `history-readonly` | `partial` | `extend` | 不建议按旧汇总表在线重建 |
| `PM_PAYMENT_RECORD_DETAILS` | 已销调整明细 | 原账单、新账单、实收金额、抵扣金额、退款人员 | `AccountingEvidence` / `Transaction` | `IF-REV-007` 冲正场景 + `bk_transaction*` + 映射层 | `online-main` + `mapping-layer` | `partial` | `extend` | 与冲正、退款、原交易校验强相关 |
| `PM_PAYMENT_RECORD_DETAILS` | 已销调整明细 | 原账单、新账单、实收金额、抵扣金额、退款人员 | `AccountingEvidence` / `PaymentRecordDetail` / `Transaction` | `IF-REV-007` 冲正场景 + REV-003 目标/原型 `biz_payment_record_detail` + `bk_transaction*` + 映射层 | `online-main` + `mapping-layer` | `partial` | `extend` | 与冲正、退款、原交易校验强相关REV-004 引用支付明细但不拥有支付主域 |
| `PM_KNOTTY_RECORDS` | 呆坏账汇总 | 坏账申请单、申请原因、审批流程 | `AccountingRequest` | `IF-REV-007` 坏账场景 + `legacy_finance_record_mapping` | `mapping-layer` + `history-readonly` | `partial` | `extend` | 坏账申请语义已有,旧流程单需映射保留 |
| `PM_KNOTTY_RECORD_DETAILS` | 呆坏账明细 | 账单、账期、坏账金额、处理人、处理时间 | `AccountingEvidence` / `AccountingResult` | `biz_charge` + `biz_operat_log*` + 映射层 | `online-main` + `mapping-layer` | `partial` | `extend` | 需保留账龄、原因、结果和核销状态 |
| `PM_LATEFEE_RECORDS` | 违约金减免汇总 | 滞纳金减免申请、原因、审批 | `AccountingRequest` | `legacy_finance_record_mapping` | `mapping-layer` + `history-readonly` | `readonly` | `retain-readonly` | 当前一期不建议独立在线化 |

View File

@ -45,21 +45,21 @@
### 3.1 数量校验
- [ ] `PM_PAY_COLLECTS``PM_PAY_SUBTOTALS``PM_PAY_DETAILS` 迁移或承接数量已核对
- [ ] 旧收费明细与新交易对象 / 收费承接对象数量差异已解释
- [ ] `PM_PAY_COLLECTS``PM_PAY_SUBTOTALS``PM_PAY_DETAILS` 迁移或承接数量已核对,并区分 REV-003 业务支付事实目标层、SYS-009 渠道交易事实与历史只读投影
- [ ] 旧收费明细与新业务支付事实目标对象 / 渠道交易对象 / 收费承接对象数量差异已解释
- [ ] 实时收费日志如仅保留历史只读,其归档记录数已校对
### 3.2 金额校验
- [ ] 旧收费明细 `ActualMoney` 汇总与新交易金额汇总一致
- [ ] 旧收费明细 `SoldMoney` 汇总与核销金额汇总一致,或差异已解释
- [ ] 旧收费明细 `ActualMoney` 汇总与 REV-003 业务支付金额、SYS-009 渠道交易金额分别核对一致,或差异已解释
- [ ] 旧收费明细 `SoldMoney` 汇总与 REV-003 支付分配/核销金额汇总一致,或差异已解释
- [ ] 旧收费汇总 `TotalMoney` 与新汇总结果一致
- [ ] 第三方交易流水涉及的金额抽样与新交易对象一致
### 3.3 关系校验
- [ ] 每笔收费明细都能追到原账单或新账单映射
- [ ] 每笔收费明细的重要流水号都能追到新交易对象
- [ ] 每笔收费明细都能追到原账单或新账单映射,并能追到 REV-003 业务支付事实目标对象或历史只读投影
- [ ] 每笔收费明细的重要流水号都能追到 SYS-009 新交易对象,且与 REV-003 业务支付记录引用关系一致
- [ ] 若存在红冲引用,原收费记录与后续记录链条未断裂
### 3.4 抽样校验