fujian_water_biz_doc/docs/evidence/rev004-accounting/rev004-accountprocess-integration-testing-bootstrap-2026-04-13.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

575 lines
29 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# REV004 accountProcess 集成测试方案 bootstrap2026-04-13
## 本轮已落地 bootstrap
- 新增 `AbstractRev004AccountProcessIntegrationTest`:定义真实数据库 + 外部依赖默认替身化的测试基类
- 新增 `Rev004AccountProcessLiveDbReadinessTest`:在提供 `REV004_IT_DB_*` 环境变量时,检查真实数据库所需表是否可见
- 新增 `Rev004AccountProcessIntegrationFixtureAssetsTest`:校验 fixture 资源文件存在
- 新增 `src/test/resources/sql/rev004/accountprocess/*.sql`:为 prestorage/sold/unsold/accountLog 预留 fixture 分层入口
## 当前价值
- 把“真实数据库 + 外部依赖替身化”的执行边界固化到测试骨架
- 把场景矩阵的 fixture 入口落到仓库,便于后续继续实现 query/action/close-loop 场景
- 在未提供真实数据库环境变量时,不强行执行 live DB readiness 测试
## 下一步建议
1.`prestorage` 第 1 条全闭环场景
2.`sold``isHistory` + submit/撤销场景
3.`accountLog` 的 refund/prestorage 二次动作场景
## Canary 补充
- 新增 `Rev004AccountProcessCanaryQueryIntegrationTest`:在提供 `REV004_IT_DB_*` 环境变量时,真正启动 Spring + MockMvc打通 `prestorage-page` 只读 query 作为最小 canary。
- 当前 fixture 仍是 bootstrap 占位,因此该 canary 的目标是“验活骨架”,不是验证完整业务数据闭环。
## Fresh verification
- 执行:`mvn -Dtest='Rev004AccountProcessIntegrationFixtureAssetsTest,Rev004AccountProcessLiveDbReadinessTest,Rev004AccountProcessCanaryQueryIntegrationTest' test`
- 结果BUILD SUCCESS
- 细项:
- Fixture assets: 1 pass
- Live DB readiness: 1 skipped未提供 `REV004_IT_DB_*` 环境变量时跳过)
- Canary query: 1 skipped未提供 `REV004_IT_DB_*` 环境变量时跳过)
## Real DB canary verification
- 执行环境:使用 `application-local.yaml` 中 PostgreSQL 连接参数,以 `REV004_IT_DB_*` 环境变量注入
- 执行:`mvn -Dtest='Rev004AccountProcessIntegrationFixtureAssetsTest,Rev004AccountProcessLiveDbReadinessTest,Rev004AccountProcessCanaryQueryIntegrationTest' test`
- 结果BUILD SUCCESS
- 明细:
- Fixture assets: 1 pass
- Live DB readiness: 1 pass
- Canary query (`/admin-api/business/accounting-adjust/prestorage-page`): 1 pass
- 说明:当前 canary 证明了真实数据库 + Spring context + MockMvc + route wiring 可启动并返回成功包装;但 fixture 仍是最小占位,尚未证明完整业务数据闭环。
## Real DB full bootstrap verification
- 执行环境:使用 `application-local.yaml` 中 PostgreSQL 连接参数,经 `REV004_IT_DB_*` 环境变量注入
- 执行:`mvn -Dtest='Rev004AccountProcessIntegrationFixtureAssetsTest,Rev004AccountProcessLiveDbReadinessTest,Rev004AccountProcessCanaryQueryIntegrationTest' test`
- 结果BUILD SUCCESS
- 明细:
- Fixture assets: 1 pass
- Live DB readiness: 1 pass
- Canary query (`/admin-api/business/accounting-adjust/prestorage-page`): 1 pass
- 说明:当前已经从“资产存在”推进到“真实数据库 + Spring context + MockMvc + canary query 验活成功”。
- 剩余缺口fixture 仍是最小占位,尚未验证完整业务数据闭环。
## First real close-loop scenario
- 场景:`prestorage-submit` 预存退款
- 测试文件:`Rev004AccountProcessCanaryQueryIntegrationTest`
- 使用真实数据库中的独立测试数据(`REV004_IT_SRC` / `biz_account.id=900001`
- 断言:
- `POST /admin-api/business/accounting-adjust/prestorage-submit` 返回成功包装
- 账户余额由 `100.00` 变为 `90.00`
- `biz_operat_log` 写入 1 条 `旧预存调整` 日志
- `biz_operat_log_detail` 中存在与返回 `adjustmentNo` 对应的明细记录
- 执行:`REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test`
- 结果BUILD SUCCESS2 tests / 0 fail / 0 skip
## Sold close-loop scenario
- 场景:`sold-submit` 已销调整申请
- 测试文件:`Rev004AccountProcessCanaryQueryIntegrationTest`
- 使用真实数据库中的独立测试营业账数据(`biz_charge.id=900002``pay_state=1`
- 断言:
- `POST /admin-api/business/accounting-adjust/sold-submit` 返回成功包装
- 返回 `resultStatus = PENDING_APPROVAL`
- `biz_operat_log` 写入 1 条 `旧账务兼容动作` 日志
- `biz_operat_log_detail` 中存在与返回 `adjustmentNo` 对应的明细记录
- 结果:与 prestorage canary 一起执行,`Rev004AccountProcessCanaryQueryIntegrationTest` 当前为 3 tests / 0 fail / 0 skip
## AccountLog close-loop scenario
- 场景:`log-prestorage` 二次动作
- 测试文件:`Rev004AccountProcessCanaryQueryIntegrationTest`
- 使用真实数据库中的独立源记录(`adjustmentNo=REV004-LOG-900003``biz_charge.id=900003`)与目标账户(`REV004_IT_TGT` / `biz_account.id=900004`
- 断言:
- `POST /admin-api/business/accounting-adjust/log-prestorage` 返回成功包装
- 源营业账 `pay_state` 被清为 `0`(未收)
- 目标账户余额增加到 `20.00`
- `biz_operat_log` 写入 1 条 `旧账务兼容动作` 日志
- `biz_operat_log_detail` 中存在与返回 `adjustmentNo` 对应的明细记录
- 结果:与 prestorage/sold 场景一起执行时,`Rev004AccountProcessCanaryQueryIntegrationTest` 当前为 4 tests / 0 fail / 0 skip
## AccountLog process query scenario
- 场景:`log-process` 读取已有调整记录流程摘要
- 测试文件:`Rev004AccountProcessCanaryQueryIntegrationTest`
- 使用真实数据库中的独立源记录(`adjustmentNo=REV004-LOG-900003`
- 断言:
- `GET /admin-api/business/accounting-adjust/log-process` 返回成功包装
- `processState = UPDATED`
- `resultStatus = SUCCESS`
## Current canary suite status
- `Rev004AccountProcessCanaryQueryIntegrationTest` 当前为 5 tests / 0 fail / 0 skip
- 已覆盖query canary、prestorage-submit、sold-submit、log-prestorage、log-process
## 2026-04-13 最新推进accountLog refund 闭环补齐
- 新增 `TransactionApi``@MockBean` 注入到 `AbstractRev004AccountProcessIntegrationTest`,确保真实数据库之外的交易后续流水依赖保持替身化。
- 更新 `40_accountlog_seed.sql`:为 `REV004-LOG-900003` 补入 `originalTranSeq=T-900003``originalSysTranSeq=SYS-900003`,使 `log-refund` 路径具备真实可执行前置数据。
- 新增 canary 闭环用例:`logRefund_shouldClearChargePaymentAndWriteFollowupLog`
### 新增闭环断言
- `POST /admin-api/business/accounting-adjust/log-refund`
- 返回:`resultStatus=SUCCESS``objectType=PREPAID_REFUND``writeBackStatus=UPDATED`
- 数据库断言:
- `biz_charge.id=900003``pay_state` 从已收改为 `0`
- `biz_operat_log` 中新增 1 条 `账务调整` 日志,`operat_content` 含返回的 `adjustmentNo`
- `biz_operat_log_detail` 中存在 `bankTranSeq=RF-900003`
- 替身断言:`TransactionApi.createFollowupTransaction(...)` 被调用
### 本次真实库验证
- 执行 1`REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test`
- 结果 1BUILD SUCCESS
- `Rev004AccountProcessCanaryQueryIntegrationTest`: 7 tests / 0 fail / 0 skip
- 执行 2`REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcess*' test`
- 结果 2BUILD SUCCESS
- `Rev004AccountProcessLiveDbReadinessTest`: 1 pass
- `Rev004AccountProcessIntegrationFixtureAssetsTest`: 1 pass
- `Rev004AccountProcessCanaryQueryIntegrationTest`: 7 pass
- 总计9 tests / 0 fail / 0 skip
### 当前 canary 套件真实覆盖
- `prestorage-page_shouldReturnSuccessEnvelope`
- `prestorageSubmit_shouldChangeBalanceAndWriteOperatLog`
- `soldSubmit_shouldWritePendingOperatLog`
- `logPrestorage_shouldClearChargePaymentAndIncreaseTargetDeposit`
- `logProcess_shouldReturnUpdatedProcessSummary`
- `logAttachments_shouldReturnUnresolvedAttachmentRef`
- `logRefund_shouldClearChargePaymentAndWriteFollowupLog`
### 仍待继续
- `unsold` 五类 happy path 真实库闭环
- `revoke/log-revoke/sold-batch-revoke` 的真实库撤销链验证
- 更高一层的“提交 -> 查询页回看 -> detail/process/attachments 全链联动”场景编排
## 2026-04-13 继续推进:撤销链真实库闭环补齐
- 新增真实库撤销链 canary
- `prestorageRevoke_shouldRestoreBalanceAndWriteRevokeLog`
- `soldBatchRevoke_shouldWriteRevokeLogForPendingSyntheticRecord`
- `logRevoke_shouldRestoreChargePaymentAndRollbackTransferredDeposit`
- 为支持旧兼容动作撤销,本轮同时修正 `AccountingAdjustProcessServiceImpl.findSyntheticSnapshot(...)`
- 改为按 `adjustmentNo` 直接回查 operat_log / operat_log_detail
- 避免旧预存调整 / 旧日志转预存 场景在撤销时误落入 unified snapshot 分支
### 新增闭环断言
1. `prestorage-revoke`
- 先发起 `prestorage-submit`
- 再调用 `POST /admin-api/business/accounting-adjust/prestorage-revoke`
- 断言:
- 返回 `actionType=REVOKE`
- `biz_account.id=900001.deposit``90.00` 恢复到 `100.00`
- 存在 `revokeOfAdjustmentNo=<原adjustmentNo>` 明细
2. `sold-batch-revoke`
- 先发起 `sold-submit`
- 再调用 `POST /admin-api/business/accounting-adjust/sold-batch-revoke`
- 断言:
- `successCount=1`
- 存在 `revokeOfAdjustmentNo=<原adjustmentNo>` 明细
3. `log-revoke`
- 先发起 `log-prestorage`
- 再调用 `POST /admin-api/business/accounting-adjust/log-revoke`
- 断言:
- 返回 `actionType=REVOKE`
- `biz_charge.id=900003.pay_state` 恢复为 `1`
- `charge_method` 恢复为 `2`
- `charge_way` 恢复为 `6`
- `biz_account.id=900004.deposit``20.00` 回退到 `0.00`
- 存在 `revokeOfAdjustmentNo=<原adjustmentNo>` 明细
### 本次真实库验证
- 执行 1`REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test`
- 结果 1BUILD SUCCESS
- `Rev004AccountProcessCanaryQueryIntegrationTest`: 10 tests / 0 fail / 0 skip
- 执行 2`REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcess*' test`
- 结果 2BUILD SUCCESS
- `Rev004AccountProcessLiveDbReadinessTest`: 1 pass
- `Rev004AccountProcessIntegrationFixtureAssetsTest`: 1 pass
- `Rev004AccountProcessCanaryQueryIntegrationTest`: 10 pass
- 总计12 tests / 0 fail / 0 skip
### 当前 canary 套件真实覆盖10 条)
- `prestoragePage_shouldReturnSuccessEnvelope`
- `prestorageSubmit_shouldChangeBalanceAndWriteOperatLog`
- `prestorageRevoke_shouldRestoreBalanceAndWriteRevokeLog`
- `soldSubmit_shouldWritePendingOperatLog`
- `soldBatchRevoke_shouldWriteRevokeLogForPendingSyntheticRecord`
- `logPrestorage_shouldClearChargePaymentAndIncreaseTargetDeposit`
## 2026-06-05 sw-business-server 启动循环修复验证
### 问题现象
- 环境:`root@192.168.10.130`,容器 `sw-business-server`
- 现象容器反复重启Docker healthcheck 一度显示 healthy但应用日志持续出现 `Application run failed`
- 关键异常:
- `Error creating bean with name 'prestorageAdjustBpmApiImpl'`
- `Error creating bean with name 'prestorageBpmCallbackService'`
- `BeanCurrentlyInCreationException: Error creating bean with name 'custServiceImpl'`
- `custServiceImpl` 已以 raw version 注入 `chargeServiceImpl``waterUseSchemeServiceImpl``exceedWaterUseSchemeServiceImpl``custWaterSchemeRelServiceImpl`,随后又被 AOP 包装Spring 拒绝混用 raw bean 与 proxy bean
### 修复策略
- 保留既有 `spring.main.allow-circular-references=true` 配置;该配置只能允许普通循环依赖,不能解决 raw bean 被代理包装后的不一致问题。
- 对异常中明确点名的 4 个 `CustService` 注入点增加 `@Lazy`
- `ChargeServiceImpl.custService`
- `WaterUseSchemeServiceImpl.custService`
- `ExceedWaterUseSchemeServiceImpl.custService`
- `CustWaterSchemeRelServiceImpl.custService`
- 新增回归测试 `CustServiceCircularDependencyContractTest`,约束上述 4 个注入点必须使用 lazy proxy。
### 本次验证
- RED 验证:
- 命令:`mvn -pl sw-business/sw-business-server -am -Dtest=CustServiceCircularDependencyContractTest -Dsurefire.failIfNoSpecifiedTests=false test`
- 结果:测试按预期失败,失败点为 `ChargeServiceImpl.custService must be @Lazy`
- GREEN 验证:
- 命令:`mvn -pl sw-business/sw-business-server -am -Dtest=CustServiceCircularDependencyContractTest -Dsurefire.failIfNoSpecifiedTests=false test`
- 结果BUILD SUCCESS`1 tests / 0 failures / 0 errors / 0 skipped`
- 打包验证:
- 命令:`mvn -pl sw-business/sw-business-server -am -DskipTests package`
- 结果BUILD SUCCESS生成 `sw-business/sw-business-server/target/sw-business-server.jar`
- 远端部署验证:
- 上传 jar 到 `/projects/sw-cloud/sw-business-server/target/sw-business-server.jar`
- 远端执行:`cd /projects/sw-cloud && docker compose build sw-business-server && docker compose up -d sw-business-server`
- 结果:镜像 `sw-cloud-sw-business-server` 重建成功,容器 `sw-business-server` 重新创建并启动
- 远端运行验证:
- 日志出现:`Tomcat started on port 48090``nacos registry, DEFAULT_GROUP business-server 192.168.10.130:48090 register finished``Started BusinessApplication in 42.77 seconds`
- 最近启动日志未再出现 `Application run failed``BeanCurrentlyInCreationException``Error creating bean with name`
- HTTP 验证:`curl http://127.0.0.1:48090/actuator/health` 返回 `{"status":"UP"}`HTTP 200
### 遗留风险
- `docker-compose.yml``sw-business-server` healthcheck 当前检查 `http://localhost:48080`,而业务应用实际监听 `48090`;该 healthcheck 会把其他服务返回的 HTTP 200 / 404 JSON 误判为业务健康。建议后续改为 `http://localhost:48090/actuator/health`
- 当前修复是最小断环修复;长期更优方向是拆分 `CustServiceImpl` 的查询能力与写能力,减少跨业务 service 之间的双向依赖。
- `logRevoke_shouldRestoreChargePaymentAndRollbackTransferredDeposit`
- `logProcess_shouldReturnUpdatedProcessSummary`
- `logAttachments_shouldReturnUnresolvedAttachmentRef`
- `logRefund_shouldClearChargePaymentAndWriteFollowupLog`
## 2026-04-13 继续推进unsold 五类真实库 happy path 补齐
- 新增 `30_unsold_seed.sql` 真实库 fixture
- `biz_cust.id=900005 / code=REV004_IT_UNSOLD`
- `biz_charge.id=900005 / pay_state=0 / bill_amount=120.00 / extended_amount=120.00 / late_fee=30.00`
- 扩展 `00_reset.sql`,纳入 `900005 / REV004_IT_UNSOLD` 清理范围
- 新增 5 条真实库 canary
- `unsoldAdjustSubmit_shouldUpdateAmountsAndWriteOperatLog`
- `unsoldSplitSubmit_shouldCreatePendingApprovalRecord`
- `unsoldLateFeeReduceSubmit_shouldCreatePendingApprovalRecord`
- `unsoldPriceDiffSubmit_shouldCreatePendingApprovalRecord`
- `unsoldBadDebtSubmit_shouldCreatePendingApprovalRecord`
### 新增闭环断言
1. `unsold-adjust-submit`
- 返回 `SUCCESS`
- `biz_charge.id=900005.extended_amount` 更新为 `88.88`
- `bill_amount` 更新为 `80.00`
- `biz_operat_log.operat_content` 含返回 `adjustmentNo`
2. `unsold-split-submit`
- 返回 `PENDING_APPROVAL`
- `objectType=SPLIT_ADJUST`
- `biz_operat_log.operat_content` 含返回 `adjustmentNo`
3. `unsold-late-fee-reduce-submit`
- 返回 `PENDING_APPROVAL`
- `objectType=LATE_FEE_REDUCE`
- `biz_operat_log.operat_content` 含返回 `adjustmentNo`
4. `unsold-price-diff-submit`
- 返回 `PENDING_APPROVAL`
- `objectType=PRICE_DIFF_ADJUST`
- `biz_operat_log.operat_content` 含返回 `adjustmentNo`
5. `unsold-bad-debt-submit`
- 返回 `PENDING_APPROVAL`
- `objectType=BAD_DEBT_RECORD`
- `biz_operat_log.operat_content` 含返回 `adjustmentNo`
### 本次真实库验证
- 执行 1`REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test`
- 结果 1BUILD SUCCESS
- `Rev004AccountProcessCanaryQueryIntegrationTest`: 15 tests / 0 fail / 0 skip
- 执行 2`REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcess*' test`
- 结果 2BUILD SUCCESS
- `Rev004AccountProcessLiveDbReadinessTest`: 1 pass
- `Rev004AccountProcessIntegrationFixtureAssetsTest`: 1 pass
- `Rev004AccountProcessCanaryQueryIntegrationTest`: 15 pass
- 总计17 tests / 0 fail / 0 skip
### 当前 canary 套件真实覆盖15 条)
- `prestoragePage_shouldReturnSuccessEnvelope`
- `prestorageSubmit_shouldChangeBalanceAndWriteOperatLog`
- `prestorageRevoke_shouldRestoreBalanceAndWriteRevokeLog`
- `soldSubmit_shouldWritePendingOperatLog`
- `soldBatchRevoke_shouldWriteRevokeLogForPendingSyntheticRecord`
- `unsoldAdjustSubmit_shouldUpdateAmountsAndWriteOperatLog`
- `unsoldSplitSubmit_shouldCreatePendingApprovalRecord`
- `unsoldLateFeeReduceSubmit_shouldCreatePendingApprovalRecord`
- `unsoldPriceDiffSubmit_shouldCreatePendingApprovalRecord`
- `unsoldBadDebtSubmit_shouldCreatePendingApprovalRecord`
- `logPrestorage_shouldClearChargePaymentAndIncreaseTargetDeposit`
- `logRevoke_shouldRestoreChargePaymentAndRollbackTransferredDeposit`
- `logProcess_shouldReturnUpdatedProcessSummary`
- `logAttachments_shouldReturnUnresolvedAttachmentRef`
- `logRefund_shouldClearChargePaymentAndWriteFollowupLog`
### 剩余待补
- 更高一层的“提交 -> page/stat/detail/process/attachments 联动回看”场景编排
- 若要进一步贴近前端验收,可再补一轮按弹窗功能分组的端到端查询/动作串联用例
## 2026-04-13 继续推进:提交后联动回看场景补齐
- 新增 3 条更贴近前端验收的联动回看 canary
- `prestorageSubmit_thenPageStatAndDetailShouldExposeNewRecord`
- `soldSubmit_thenSoldPageAndStatShouldExposePendingRevokeCapability`
- `logSeed_thenPageStatDetailProcessAndAttachmentsShouldStayConsistent`
### 新增联动断言
1. `prestorage` 提交后联动回看
- 提交 `prestorage-submit`
- 再查:
- `prestorage-page`
- `prestorage-stat`
- `prestorage-detail`
- 断言:
- page 能看到新 `adjustmentNo`
- stat 的 `totalCount=1 / refundCount=1`
- detail 返回 `resultStatus=SUCCESS / writeBackStatus=UPDATED`
2. `sold` 提交后联动回看
- 提交 `sold-submit`
- 再查:
- `sold-page`
- `sold-stat`
- 断言:
- page 仍能看到 `biz_charge.id=900002`
- `canBatchRevoke=true`
- stat 的 `totalCount=1 / totalActualAmount=80.00`
3. `log` 全链回看
- 基于 `40_accountlog_seed.sql` 中的 `REV004-LOG-900003`
- 依次验证:
- `log-page`
- `log-stat`
- `log-detail`
- `log-process`
- `log-attachments`
- 断言:
- page 可见 `adjustmentNo=REV004-LOG-900003`
- stat `completedCount=1`
- detail 包含 `originalTranSeq=T-900003``attachmentRefs[0]=mock-ref-1`
- process `processState=UPDATED`
- attachments 可返回 `mock-ref-1`
### 本次真实库验证
- 执行 1`REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test`
- 结果 1BUILD SUCCESS
- `Rev004AccountProcessCanaryQueryIntegrationTest`: 18 tests / 0 fail / 0 skip
- 执行 2`REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcess*' test`
- 结果 2BUILD SUCCESS
- `Rev004AccountProcessLiveDbReadinessTest`: 1 pass
- `Rev004AccountProcessIntegrationFixtureAssetsTest`: 1 pass
- `Rev004AccountProcessCanaryQueryIntegrationTest`: 18 pass
- 总计20 tests / 0 fail / 0 skip
### 当前真实库 canary 覆盖18 条)
- `prestoragePage_shouldReturnSuccessEnvelope`
- `prestorageSubmit_shouldChangeBalanceAndWriteOperatLog`
- `prestorageRevoke_shouldRestoreBalanceAndWriteRevokeLog`
- `prestorageSubmit_thenPageStatAndDetailShouldExposeNewRecord`
- `soldSubmit_shouldWritePendingOperatLog`
- `soldBatchRevoke_shouldWriteRevokeLogForPendingSyntheticRecord`
- `soldSubmit_thenSoldPageAndStatShouldExposePendingRevokeCapability`
- `unsoldAdjustSubmit_shouldUpdateAmountsAndWriteOperatLog`
- `unsoldSplitSubmit_shouldCreatePendingApprovalRecord`
- `unsoldLateFeeReduceSubmit_shouldCreatePendingApprovalRecord`
- `unsoldPriceDiffSubmit_shouldCreatePendingApprovalRecord`
- `unsoldBadDebtSubmit_shouldCreatePendingApprovalRecord`
- `logPrestorage_shouldClearChargePaymentAndIncreaseTargetDeposit`
- `logRevoke_shouldRestoreChargePaymentAndRollbackTransferredDeposit`
- `logSeed_thenPageStatDetailProcessAndAttachmentsShouldStayConsistent`
- `logProcess_shouldReturnUpdatedProcessSummary`
- `logAttachments_shouldReturnUnresolvedAttachmentRef`
- `logRefund_shouldClearChargePaymentAndWriteFollowupLog`
### 当前剩余缺口
- 若要进一步逼近前端验收,可继续补“弹窗 A/B/C 对应多接口切换”的编排式测试摘要
- 以及基于接口返回字段做一版更面向页面的 contract/assertion matrix
## 2026-04-13 继续推进unsold 查询面真实库回看补齐
- 新增 2 条真实库查询联动 canary
- `unsoldSeed_thenPageAndStatShouldExposeChargeSnapshot`
- `unsoldAdjustSubmit_thenPageAndStatShouldReflectUpdatedAmounts`
### 新增断言
1. `unsold` 初始查询面
- `GET /admin-api/business/accounting-adjust/unsold-page`
- `GET /admin-api/business/accounting-adjust/unsold-stat`
- 断言:
- `biz_charge.id=900005` 可见
- `totalAmount=120.00`
- `billAmount=120.00`
- `penaltyAmount=30.00`
- `canAdjust/canSplit/canLateFeeReduce/canPriceDiffAdjust/canBadDebtAdjust=true`
- stat`sumWaterVolume=5.000 / sumTotalAmount=120.00 / sumBillAmount=120.00 / sumPenaltyAmount=30.00`
2. `unsold-adjust-submit` 后查询面回看
- 先提交 `unsold-adjust-submit`
- 再查 `unsold-page / unsold-stat`
- 断言:
- page 中 `totalAmount=88.88`
- page 中 `billAmount=80.00`
- stat 中 `sumTotalAmount=88.88`
- stat 中 `sumBillAmount=80.00`
### 本次真实库验证
- 执行 1`REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test`
- 结果 1BUILD SUCCESS
- `Rev004AccountProcessCanaryQueryIntegrationTest`: 20 tests / 0 fail / 0 skip
- 执行 2`REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcess*' test`
- 结果 2BUILD SUCCESS
- `Rev004AccountProcessLiveDbReadinessTest`: 1 pass
- `Rev004AccountProcessIntegrationFixtureAssetsTest`: 1 pass
- `Rev004AccountProcessCanaryQueryIntegrationTest`: 20 pass
- 总计22 tests / 0 fail / 0 skip
### 影响
- `prestorage / sold / unsold / log` 四条主查询面现在都至少有一组真实库回看证据
- 剩余未补重点从“主链查询缺口”收敛为“预存页流程/附件链路 + 字典/UI文案展示一致性”
## 2026-04-13 继续推进prestorage process / attachments 真实库补齐
- 新增 canary`prestorageSubmit_thenProcessAndAttachmentsShouldExposeReturnedAdjustmentNo`
-`prestorage-submit` 场景中附带 `attachmentRefs=[pre-proof-2, pre-proof-3]`
- 提交后继续验证:
- `GET /admin-api/business/accounting-adjust/prestorage-process`
- `GET /admin-api/business/accounting-adjust/prestorage-attachments`
### 新增断言
- process
- `adjustmentNo` 与提交返回一致
- `resultStatus=SUCCESS`
- `approvalStatus=NOT_REQUIRED`
- `writeBackStatus=UPDATED`
- `processState=UPDATED`
- `stages[0].message` 存在
- attachments
- 返回两条附件引用
- `ref=pre-proof-2 / pre-proof-3`
- `resolved=false`
### 本次真实库验证
- `Rev004AccountProcessCanaryQueryIntegrationTest`: **21 tests / 0 fail / 0 skip**
- `Rev004AccountProcess*`: **总计 23 tests / 0 fail / 0 skip**
### 影响
- `prestorage` 查询/提交流程/撤销/流程查看/附件查看 这一组链路现在都已有真实库证据
- 剩余缺口进一步收敛到:字典 label / UI 文案一致性、边角筛选条件穷尽、UI 编排级验证
## 2026-06-05 远端启动修复后真实 HTTP/BPM 闭环验证
### 环境
- 后端:`192.168.10.130``sw-business-server` 端口 `48090`gateway 端口 `48080`
- 前端代理:本地 Vite `http://127.0.0.1:18080/admin-api` -> gateway
- 数据库:`192.168.10.130:5436/sw_system`
- 测试数据:`00_reset.sql` + `01_dict_seed.sql` + `10_prestorage_seed.sql`
### 启动与健康检查
- `sw-business-server` 重新构建部署后日志出现 `Started BusinessApplication`
- `curl http://192.168.10.130:48090/actuator/health` 返回 `{"status":"UP"}`
- `curl http://192.168.10.130:48080/actuator/health` 返回 `{"status":"UP"}`
### 真实接口链路
1. 登录
- `POST /admin-api/system/auth/login`
- `tenant-id: 1`
- 返回 `code=0`,获得 `accessToken`
2. 预存退款:保存 -> BPM 审批 -> 自动执行 -> 查询回看
- `POST /admin-api/business/accounting-adjust/prestorage-save`
- 请求核心字段:
- `custCode=REV004_IT_SRC`
- `refundAmount=10.00`
- `applicant=接口闭环测试人`
- `attachmentRefs=[real-api-proof-1]`
- 保存返回:
- `adjustmentNo=REV004-PRF-900001-20260605101623`
- `resultStatus=PENDING_APPROVAL`
- `approvalStatus=PENDING_APPROVAL`
- `writeBackStatus=PENDING`
- `resultObjectNo=8d8af605-6084-11f1-8df9-5ad978d7f8ab`
- BPM 待办:
- `GET /admin-api/bpm/task/list-by-process-instance-id?processInstanceId=8d8af605-6084-11f1-8df9-5ad978d7f8ab`
- taskId=`8da3600e-6084-11f1-8df9-5ad978d7f8ab`
- 审批:
- `PUT /admin-api/bpm/task/approve`
- 返回 `code=0,data=true`
- 回看:
- `GET /admin-api/business/accounting-adjust/prestorage-process`
- `resultStatus=SUCCESS`
- `approvalStatus=APPROVED`
- `writeBackStatus=UPDATED`
- `processState=UPDATED`
- `latestMessage=BPM审批通过后自动执行预存退款`
- DB 断言:
- `biz_account(900001).deposit=90.00`
- `biz_prestorage_adjust.business_status=COMPLETED`
- `biz_prestorage_payment_relation` 写入 `payment_record_id=159`
3. 预存转账:保存 -> BPM 审批 -> 自动执行 -> 查询回看
- `POST /admin-api/business/accounting-adjust/prestorage-save`
- 请求核心字段:
- `custCode=REV004_IT_SRC`
- `targetCustCode=REV004_IT_TGT`
- `transferAmount=30.00`
- `applicant=接口闭环转账人`
- `attachmentRefs=[real-api-transfer-proof]`
- 保存返回:
- `adjustmentNo=REV004-PTR-900001-20260605102121`
- `resultStatus=PENDING_APPROVAL`
- `approvalStatus=PENDING_APPROVAL`
- `writeBackStatus=PENDING`
- `resultObjectNo=3e231762-6085-11f1-8df9-5ad978d7f8ab`
- BPM 审批:
- taskId=`3e2401cb-6085-11f1-8df9-5ad978d7f8ab`
- `PUT /admin-api/bpm/task/approve` 返回 `code=0,data=true`
- 回看:
- `GET /admin-api/business/accounting-adjust/prestorage-process`
- `resultStatus=SUCCESS`
- `approvalStatus=APPROVED`
- `writeBackStatus=UPDATED`
- `latestMessage=BPM审批通过后自动执行预存转账`
- `prestorage-page``workOrderStatus=2 / adjustmentType=2 / targetCustCode=REV004_IT_TGT / remainingAmount=60.00`
- DB 断言:
- `biz_account(900001).deposit=60.00`
- `biz_account(900004).deposit=30.00`
### 本次联调发现并处理的问题
- 首次 BPM 审批退款失败,`/admin-api/bpm/task/approve` 返回 `code=500`
- 服务端根因:
- `ERROR: relation "biz_prestorage_payment_relation_seq" does not exist`
- 表 DDL 使用 `BIGSERIAL`,实际 sequence 为 `biz_prestorage_payment_relation_id_seq`
- Java 实体 `PrestoragePaymentRelationDO` 原标注 `@KeySequence("biz_prestorage_payment_relation_seq")`
- 临时环境修复:
- 远端库补齐兼容 sequence`biz_prestorage_payment_relation_seq`
- 代码修复:
- `PrestoragePaymentRelationDO` 改为 `@KeySequence("biz_prestorage_payment_relation_id_seq")`
- 新增 `PrestoragePaymentRelationSequenceContractTest` 锁定注解与 DDL sequence 名一致
### 本次本地验证
- `mvn -pl sw-business/sw-business-server -am -DskipTests compile`
- 结果BUILD SUCCESS
- `javap` 反射核验:
- `PrestoragePaymentRelationDO` 当前产物中的 `@KeySequence``biz_prestorage_payment_relation_id_seq`
- 受既有测试编译问题影响,单测命令 `mvn -pl sw-business/sw-business-server -Dtest=PrestoragePaymentRelationSequenceContractTest test` 未能进入目标测试:
- 阻塞点:`MeterInOutServiceImplTest` 引用缺失的 `METER_IN_MODEL_CALIBER_MISMATCH``METER_IMPORT_MODEL_CALIBER_MISMATCH_MSG`
### 2026-06-05 本地 targeted contract test 复核
- 命令:
- `mvn -pl sw-business/sw-business-server -am -Dtest=CustServiceCircularDependencyContractTest,PrestoragePaymentRelationSequenceContractTest -Dsurefire.failIfNoSpecifiedTests=false test`
- 结果:
- `BUILD SUCCESS`
- `CustServiceCircularDependencyContractTest`: 1 tests / 0 failures / 0 errors / 0 skipped
- `PrestoragePaymentRelationSequenceContractTest`: 1 tests / 0 failures / 0 errors / 0 skipped
- 说明:
- `-Dsurefire.failIfNoSpecifiedTests=false` 用于 reactor 前置模块无匹配 `-Dtest` 用例时继续执行到 `sw-business-server`
- 本次复核覆盖四处 `CustService` 懒加载注入 contract 与 `biz_prestorage_payment_relation_id_seq` 注解 contract