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
29 KiB
29 KiB
REV004 accountProcess 集成测试方案 bootstrap(2026-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 测试
下一步建议
- 补
prestorage第 1 条全闭环场景 - 补
sold的isHistory+ submit/撤销场景 - 补
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 SUCCESS(2 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 = UPDATEDresultStatus = 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从已收改为0biz_operat_log中新增 1 条账务调整日志,operat_content含返回的adjustmentNobiz_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 - 结果 1:BUILD 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 - 结果 2:BUILD SUCCESS
Rev004AccountProcessLiveDbReadinessTest: 1 passRev004AccountProcessIntegrationFixtureAssetsTest: 1 passRev004AccountProcessCanaryQueryIntegrationTest: 7 pass- 总计:9 tests / 0 fail / 0 skip
当前 canary 套件真实覆盖
prestorage-page_shouldReturnSuccessEnvelopeprestorageSubmit_shouldChangeBalanceAndWriteOperatLogsoldSubmit_shouldWritePendingOperatLoglogPrestorage_shouldClearChargePaymentAndIncreaseTargetDepositlogProcess_shouldReturnUpdatedProcessSummarylogAttachments_shouldReturnUnresolvedAttachmentReflogRefund_shouldClearChargePaymentAndWriteFollowupLog
仍待继续
unsold五类 happy path 真实库闭环revoke/log-revoke/sold-batch-revoke的真实库撤销链验证- 更高一层的“提交 -> 查询页回看 -> detail/process/attachments 全链联动”场景编排
2026-04-13 继续推进:撤销链真实库闭环补齐
- 新增真实库撤销链 canary:
prestorageRevoke_shouldRestoreBalanceAndWriteRevokeLogsoldBatchRevoke_shouldWriteRevokeLogForPendingSyntheticRecordlogRevoke_shouldRestoreChargePaymentAndRollbackTransferredDeposit
- 为支持旧兼容动作撤销,本轮同时修正
AccountingAdjustProcessServiceImpl.findSyntheticSnapshot(...):- 改为按
adjustmentNo直接回查 operat_log / operat_log_detail - 避免旧预存调整 / 旧日志转预存 场景在撤销时误落入 unified snapshot 分支
- 改为按
新增闭环断言
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>明细
- 返回
sold-batch-revoke
- 先发起
sold-submit - 再调用
POST /admin-api/business/accounting-adjust/sold-batch-revoke - 断言:
successCount=1- 存在
revokeOfAdjustmentNo=<原adjustmentNo>明细
log-revoke
- 先发起
log-prestorage - 再调用
POST /admin-api/business/accounting-adjust/log-revoke - 断言:
- 返回
actionType=REVOKE biz_charge.id=900003.pay_state恢复为1charge_method恢复为2charge_way恢复为6biz_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 - 结果 1:BUILD 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 - 结果 2:BUILD SUCCESS
Rev004AccountProcessLiveDbReadinessTest: 1 passRev004AccountProcessIntegrationFixtureAssetsTest: 1 passRev004AccountProcessCanaryQueryIntegrationTest: 10 pass- 总计:12 tests / 0 fail / 0 skip
当前 canary 套件真实覆盖(10 条)
prestoragePage_shouldReturnSuccessEnvelopeprestorageSubmit_shouldChangeBalanceAndWriteOperatLogprestorageRevoke_shouldRestoreBalanceAndWriteRevokeLogsoldSubmit_shouldWritePendingOperatLogsoldBatchRevoke_shouldWriteRevokeLogForPendingSyntheticRecordlogPrestorage_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.custServiceWaterUseSchemeServiceImpl.custServiceExceedWaterUseSchemeServiceImpl.custServiceCustWaterSchemeRelServiceImpl.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重新创建并启动
- 上传 jar 到
- 远端运行验证:
- 日志出现:
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-serverhealthcheck 当前检查http://localhost:48080,而业务应用实际监听48090;该 healthcheck 会把其他服务返回的 HTTP 200 / 404 JSON 误判为业务健康。建议后续改为http://localhost:48090/actuator/health。- 当前修复是最小断环修复;长期更优方向是拆分
CustServiceImpl的查询能力与写能力,减少跨业务 service 之间的双向依赖。 logRevoke_shouldRestoreChargePaymentAndRollbackTransferredDepositlogProcess_shouldReturnUpdatedProcessSummarylogAttachments_shouldReturnUnresolvedAttachmentReflogRefund_shouldClearChargePaymentAndWriteFollowupLog
2026-04-13 继续推进:unsold 五类真实库 happy path 补齐
- 新增
30_unsold_seed.sql真实库 fixture:biz_cust.id=900005 / code=REV004_IT_UNSOLDbiz_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_shouldUpdateAmountsAndWriteOperatLogunsoldSplitSubmit_shouldCreatePendingApprovalRecordunsoldLateFeeReduceSubmit_shouldCreatePendingApprovalRecordunsoldPriceDiffSubmit_shouldCreatePendingApprovalRecordunsoldBadDebtSubmit_shouldCreatePendingApprovalRecord
新增闭环断言
unsold-adjust-submit
- 返回
SUCCESS biz_charge.id=900005.extended_amount更新为88.88bill_amount更新为80.00biz_operat_log.operat_content含返回adjustmentNo
unsold-split-submit
- 返回
PENDING_APPROVAL objectType=SPLIT_ADJUSTbiz_operat_log.operat_content含返回adjustmentNo
unsold-late-fee-reduce-submit
- 返回
PENDING_APPROVAL objectType=LATE_FEE_REDUCEbiz_operat_log.operat_content含返回adjustmentNo
unsold-price-diff-submit
- 返回
PENDING_APPROVAL objectType=PRICE_DIFF_ADJUSTbiz_operat_log.operat_content含返回adjustmentNo
unsold-bad-debt-submit
- 返回
PENDING_APPROVAL objectType=BAD_DEBT_RECORDbiz_operat_log.operat_content含返回adjustmentNo
本次真实库验证
- 执行 1:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test - 结果 1:BUILD 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 - 结果 2:BUILD SUCCESS
Rev004AccountProcessLiveDbReadinessTest: 1 passRev004AccountProcessIntegrationFixtureAssetsTest: 1 passRev004AccountProcessCanaryQueryIntegrationTest: 15 pass- 总计:17 tests / 0 fail / 0 skip
当前 canary 套件真实覆盖(15 条)
prestoragePage_shouldReturnSuccessEnvelopeprestorageSubmit_shouldChangeBalanceAndWriteOperatLogprestorageRevoke_shouldRestoreBalanceAndWriteRevokeLogsoldSubmit_shouldWritePendingOperatLogsoldBatchRevoke_shouldWriteRevokeLogForPendingSyntheticRecordunsoldAdjustSubmit_shouldUpdateAmountsAndWriteOperatLogunsoldSplitSubmit_shouldCreatePendingApprovalRecordunsoldLateFeeReduceSubmit_shouldCreatePendingApprovalRecordunsoldPriceDiffSubmit_shouldCreatePendingApprovalRecordunsoldBadDebtSubmit_shouldCreatePendingApprovalRecordlogPrestorage_shouldClearChargePaymentAndIncreaseTargetDepositlogRevoke_shouldRestoreChargePaymentAndRollbackTransferredDepositlogProcess_shouldReturnUpdatedProcessSummarylogAttachments_shouldReturnUnresolvedAttachmentReflogRefund_shouldClearChargePaymentAndWriteFollowupLog
剩余待补
- 更高一层的“提交 -> page/stat/detail/process/attachments 联动回看”场景编排
- 若要进一步贴近前端验收,可再补一轮按弹窗功能分组的端到端查询/动作串联用例
2026-04-13 继续推进:提交后联动回看场景补齐
- 新增 3 条更贴近前端验收的联动回看 canary:
prestorageSubmit_thenPageStatAndDetailShouldExposeNewRecordsoldSubmit_thenSoldPageAndStatShouldExposePendingRevokeCapabilitylogSeed_thenPageStatDetailProcessAndAttachmentsShouldStayConsistent
新增联动断言
prestorage提交后联动回看
- 提交
prestorage-submit - 再查:
prestorage-pageprestorage-statprestorage-detail
- 断言:
- page 能看到新
adjustmentNo - stat 的
totalCount=1 / refundCount=1 - detail 返回
resultStatus=SUCCESS / writeBackStatus=UPDATED
- page 能看到新
sold提交后联动回看
- 提交
sold-submit - 再查:
sold-pagesold-stat
- 断言:
- page 仍能看到
biz_charge.id=900002 canBatchRevoke=true- stat 的
totalCount=1 / totalActualAmount=80.00
- page 仍能看到
log全链回看
- 基于
40_accountlog_seed.sql中的REV004-LOG-900003 - 依次验证:
log-pagelog-statlog-detaillog-processlog-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
- page 可见
本次真实库验证
- 执行 1:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test - 结果 1:BUILD 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 - 结果 2:BUILD SUCCESS
Rev004AccountProcessLiveDbReadinessTest: 1 passRev004AccountProcessIntegrationFixtureAssetsTest: 1 passRev004AccountProcessCanaryQueryIntegrationTest: 18 pass- 总计:20 tests / 0 fail / 0 skip
当前真实库 canary 覆盖(18 条)
prestoragePage_shouldReturnSuccessEnvelopeprestorageSubmit_shouldChangeBalanceAndWriteOperatLogprestorageRevoke_shouldRestoreBalanceAndWriteRevokeLogprestorageSubmit_thenPageStatAndDetailShouldExposeNewRecordsoldSubmit_shouldWritePendingOperatLogsoldBatchRevoke_shouldWriteRevokeLogForPendingSyntheticRecordsoldSubmit_thenSoldPageAndStatShouldExposePendingRevokeCapabilityunsoldAdjustSubmit_shouldUpdateAmountsAndWriteOperatLogunsoldSplitSubmit_shouldCreatePendingApprovalRecordunsoldLateFeeReduceSubmit_shouldCreatePendingApprovalRecordunsoldPriceDiffSubmit_shouldCreatePendingApprovalRecordunsoldBadDebtSubmit_shouldCreatePendingApprovalRecordlogPrestorage_shouldClearChargePaymentAndIncreaseTargetDepositlogRevoke_shouldRestoreChargePaymentAndRollbackTransferredDepositlogSeed_thenPageStatDetailProcessAndAttachmentsShouldStayConsistentlogProcess_shouldReturnUpdatedProcessSummarylogAttachments_shouldReturnUnresolvedAttachmentReflogRefund_shouldClearChargePaymentAndWriteFollowupLog
当前剩余缺口
- 若要进一步逼近前端验收,可继续补“弹窗 A/B/C 对应多接口切换”的编排式测试摘要
- 以及基于接口返回字段做一版更面向页面的 contract/assertion matrix
2026-04-13 继续推进:unsold 查询面真实库回看补齐
- 新增 2 条真实库查询联动 canary:
unsoldSeed_thenPageAndStatShouldExposeChargeSnapshotunsoldAdjustSubmit_thenPageAndStatShouldReflectUpdatedAmounts
新增断言
unsold初始查询面
GET /admin-api/business/accounting-adjust/unsold-pageGET /admin-api/business/accounting-adjust/unsold-stat- 断言:
biz_charge.id=900005可见totalAmount=120.00billAmount=120.00penaltyAmount=30.00canAdjust/canSplit/canLateFeeReduce/canPriceDiffAdjust/canBadDebtAdjust=true- stat:
sumWaterVolume=5.000 / sumTotalAmount=120.00 / sumBillAmount=120.00 / sumPenaltyAmount=30.00
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
- page 中
本次真实库验证
- 执行 1:
REV004_IT_DB_URL=... REV004_IT_DB_USERNAME=... REV004_IT_DB_PASSWORD=... mvn -Dtest='Rev004AccountProcessCanaryQueryIntegrationTest' test - 结果 1:BUILD 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 - 结果 2:BUILD SUCCESS
Rev004AccountProcessLiveDbReadinessTest: 1 passRev004AccountProcessIntegrationFixtureAssetsTest: 1 passRev004AccountProcessCanaryQueryIntegrationTest: 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-processGET /admin-api/business/accounting-adjust/prestorage-attachments
新增断言
- process:
adjustmentNo与提交返回一致resultStatus=SUCCESSapprovalStatus=NOT_REQUIREDwriteBackStatus=UPDATEDprocessState=UPDATEDstages[0].message存在
- attachments:
- 返回两条附件引用
ref=pre-proof-2 / pre-proof-3resolved=false
本次真实库验证
Rev004AccountProcessCanaryQueryIntegrationTest: 21 tests / 0 fail / 0 skipRev004AccountProcess*: 总计 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 BusinessApplicationcurl http://192.168.10.130:48090/actuator/health返回{"status":"UP"}curl http://192.168.10.130:48080/actuator/health返回{"status":"UP"}
真实接口链路
- 登录
POST /admin-api/system/auth/logintenant-id: 1- 返回
code=0,获得accessToken
- 预存退款:保存 -> BPM 审批 -> 自动执行 -> 查询回看
POST /admin-api/business/accounting-adjust/prestorage-save- 请求核心字段:
custCode=REV004_IT_SRCrefundAmount=10.00applicant=接口闭环测试人attachmentRefs=[real-api-proof-1]
- 保存返回:
adjustmentNo=REV004-PRF-900001-20260605101623resultStatus=PENDING_APPROVALapprovalStatus=PENDING_APPROVALwriteBackStatus=PENDINGresultObjectNo=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-processresultStatus=SUCCESSapprovalStatus=APPROVEDwriteBackStatus=UPDATEDprocessState=UPDATEDlatestMessage=BPM审批通过后自动执行预存退款
- DB 断言:
biz_account(900001).deposit=90.00biz_prestorage_adjust.business_status=COMPLETEDbiz_prestorage_payment_relation写入payment_record_id=159
- 预存转账:保存 -> BPM 审批 -> 自动执行 -> 查询回看
POST /admin-api/business/accounting-adjust/prestorage-save- 请求核心字段:
custCode=REV004_IT_SRCtargetCustCode=REV004_IT_TGTtransferAmount=30.00applicant=接口闭环转账人attachmentRefs=[real-api-transfer-proof]
- 保存返回:
adjustmentNo=REV004-PTR-900001-20260605102121resultStatus=PENDING_APPROVALapprovalStatus=PENDING_APPROVALwriteBackStatus=PENDINGresultObjectNo=3e231762-6085-11f1-8df9-5ad978d7f8ab
- BPM 审批:
- taskId=
3e2401cb-6085-11f1-8df9-5ad978d7f8ab PUT /admin-api/bpm/task/approve返回code=0,data=true
- taskId=
- 回看:
GET /admin-api/business/accounting-adjust/prestorage-processresultStatus=SUCCESSapprovalStatus=APPROVEDwriteBackStatus=UPDATEDlatestMessage=BPM审批通过后自动执行预存转账prestorage-page中workOrderStatus=2 / adjustmentType=2 / targetCustCode=REV004_IT_TGT / remainingAmount=60.00
- DB 断言:
biz_account(900001).deposit=60.00biz_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
- 远端库补齐兼容 sequence:
- 代码修复:
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 SUCCESSCustServiceCircularDependencyContractTest: 1 tests / 0 failures / 0 errors / 0 skippedPrestoragePaymentRelationSequenceContractTest: 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