fujian_water_biz_doc/docs/evidence/rev004-writtenoff-formal-table-dev-db-apply-2026-04-17.md
tangweijie fccb3a7cf8 Capture writtenoff formal-table dev-db evidence for REV004
This evidence snapshot records the application-dev target database, DDL apply
and replay status, targeted verification commands, fresh-jar smoke outcomes,
and cleanup proof for the writtenoff formal-table batch.

Constraint: Evidence must remain aligned with the backend writtenoff formal-table batch and the actual application-dev database
Rejected: Fold evidence into unrelated doc updates already present in this branch | would mix scopes and obscure traceability
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Update this evidence if later writtenoff smoke is rerun on a different port or with different seeded IDs
Tested: Reviewed against backend compile/test results and direct psql cleanup verification on 2026-04-17
Not-tested: No additional doc rendering/export pipeline run for this evidence-only change
2026-04-17 14:50:06 +08:00

3.3 KiB
Raw Blame History

REV004 writtenoff formal-table 已应用到 application-dev 测试库2026-04-17

目标库

依据:

  • sw-business/sw-business-server/src/main/resources/application-dev.yaml

解析结果:

  • Host192.168.10.130
  • Port5436
  • DBsw_system
  • Usersw_system

已执行脚本

  • sql/rev004/REV004_writtenoff_formal_tables_deploy.sql

DDL 执行结果

结果:PASS

已确认存在:

  • biz_writtenoff_adjust
  • biz_writtenoff_adjust_detail
  • biz_writtenoff_adjust_seq
  • biz_writtenoff_adjust_detail_seq

已确认幂等重放通过:

  • second apply 输出 already exists, skipping
  • 无重复约束/重复索引异常

代码验证

compile

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

结果:PASS

targeted tests

mvn -pl sw-business/sw-business-server \
  -Dtest=AccountingAdjustSoldProcessServiceImplTest,AccountingAdjustActionServiceImplTest,AccountingAdjustProcessServiceImplTest,AccountingAdjustQueryServiceImplTest,WrittenoffFormalizationServiceTest test

结果:PASS

  • Tests run: 41
  • Failures: 0
  • Errors: 0

HTTP smokefresh jar, port 48093

submit

  • sold-submit on charge 992005REV004-SLD-992005-20260417143622
  • sold-submit on charge 992006REV004-SLD-992006-20260417143623
  • 返回统一为:
    • objectType = WRITTENOFF_ADJUST
    • approvalStatus = PENDING_APPROVAL
    • resultStatus = PENDING_APPROVAL
    • writeBackStatus = PENDING

DB 回读

biz_writtenoff_adjust_detail

  • submit 后 detail 进入 PENDING_APPROVAL / SUBMIT

query

  • GET /admin-api/business/accounting-adjust/get?adjustmentNo=... 对 writtenoff 已返回 formal detail
  • GET /admin-api/business/accounting-adjust/page?...objectType=WRITTENOFF_ADJUST 已返回 formal-first 列表

approve / reject

  • approve/admin-api/business/accounting-adjust/approve
    • 返回 APPROVED/SUCCESS/UPDATED
    • 账单 extended_amount 归零、discount_money 累加、pay_state=SETTLED(2)
  • reject/admin-api/business/accounting-adjust/reject
    • 返回 REJECTED/FAIL/SKIPPED
    • 账单保持原值,不执行核销回写

测试数据清理

smoke 完成后已删除:

  • biz_operat_log / detailidentify_value = 992005, 992006
  • biz_writtenoff_adjust / detail
  • biz_charge992005, 992006
  • biz_custREV004_WO_SMOKE_A, REV004_WO_SMOKE_B

回读结果:

  • writtenoff_main_left=0
  • operat_log_left=0
  • charge_left=0
  • cust_left=0

运行态清理

用于 fresh-jar HTTP smoke 的临时实例:

  • port 48093

已停止,当前无残留 LISTEN 进程。

当前结论

本轮 writtenoff formal-table 已达到:

  1. DDL 可落库且可幂等重放;
  2. sold submit 能落 pending formal main/detail
  3. approve/reject 会同步 formal 状态;
  4. detail/page 对 WRITTENOFF_ADJUST 已能返回 formal-first 结果;
  5. sold submit 已补事务边界,避免 operat_log 与 formal-table 半成功;
  6. 审批/驳回缺失 formal 主记录时将显式报错,避免静默漏更新。

当前未完成

  • writtenoff formal-first 目前仍是最小实现,后续仍可优化 page 查询性能(避免 listAll + getView N+1
  • 若需要更细的 charge_detail 差异映射到 formal 明细,可在后续补强。