fujian_water_biz_doc/docs/evidence/rev004-accounting/rev004-prestorage-strict-formal-first-2026-04-17.md
tangweijie 3eccab2cf9 docs: 文档治理统一 — AGENTS.md 生命周期规则 + 模块归档 + DDL 修正
1. AGENTS.md 更新
   - water-docs: 新增 specs/ 与 docs/design/ 生命周期规则章节
   - water-backend: 更新协作引用(建设期/建成后、evidence 模块化)

2. specs/ 重复合并
   - 006-reminder-event-design 合并入 003-rev006-reminder-event-design
   - 001-rev004-accounting 删除冗余 data-model.md + contracts/
   - 002-rev005-invoice-flow 删除冗余 data-model.md + contracts/

3. evidence 按模块归档
   - 35 个 REV-004 文件归入 evidence/rev004-accounting/
   - 7 个通用 bugfix 文件归入 evidence/bugfix/ 和 bugfix/frontend/
   - 新建 rev005-invoice/、rev006-reminder/、rev007-statistics/ 目录

4. guides/ 清理
   - 14 个 REV004_*.md 移入 evidence/rev004-accounting/

5. 遗留文件处理
   - docs/research/ 归档到 Archive/06_Migration_Plans/
   - backend-check detached worktrees 清理

6. 交叉引用修复
   - 006-reminder-event-design → 003-rev006-reminder-event-design
   - docs/guides/REV004_ → docs/evidence/rev004-accounting/REV004_

7. DB 设计文档修正(01_Database_Design.md)
   - biz_invoice 明确为开票配置表,非发票记录表
   - 新增 biz_invoice_record 为发票申请/结果主表
   - 新增 biz_charge_invoice_rel 账单-发票关联说明
   - REV-005 承接口径表名全部修正

8. 发票审计证据
   - 新增 evidence/rev005-invoice/2026-06-16-invoice-document-audit.md
2026-06-16 11:47:16 +08:00

2.9 KiB
Raw Blame History

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

mvn -pl sw-business/sw-business-server -DskipTests compile

结果:PASS

targeted tests

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 mainbiz_prestorage_adjust
  • formal detailbiz_prestorage_adjust_detail
  • attachment refs101,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 / 写路径无变更