Record REV004 late-fee formal-table deployment and canary evidence
This documents that the formal-table deploy SQL has been applied to the application-dev database, that the previous real-db blocker is resolved, and that the date-mode late-fee reduce canary now passes against the test database. Constraint: Evidence must match the verified dev database and latest canary output Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep evidence updates aligned with the exact environment and command outputs used for verification Tested: Evidence cross-checked against psql deployment output and fresh canary pass Not-tested: No additional business flow beyond the documented late-fee date-mode canary
This commit is contained in:
parent
d0ee1cbc17
commit
35f2f9b76c
@ -0,0 +1,162 @@
|
|||||||
|
# REV004 账务调整统一标准层 — 第一批代码启动证据(2026-04-15)
|
||||||
|
|
||||||
|
## 本轮新增代码
|
||||||
|
### 标准层 helper
|
||||||
|
- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/accountingadjust/standard/AccountingAdjustSemanticMapper.java`
|
||||||
|
- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/accountingadjust/standard/AccountingAdjustDictResolver.java`
|
||||||
|
- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/accountingadjust/standard/AccountingAdjustStatusResolver.java`
|
||||||
|
|
||||||
|
### late-fee reduce formal-table 申请态/审批态基础
|
||||||
|
- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/dal/dataobject/latefeereduce/LateFeeReduceDO.java`
|
||||||
|
- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/dal/dataobject/latefeereducedetail/LateFeeReduceDetailDO.java`
|
||||||
|
- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/dal/mysql/latefeereduce/LateFeeReduceMapper.java`
|
||||||
|
- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/dal/mysql/latefeereducedetail/LateFeeReduceDetailMapper.java`
|
||||||
|
- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/accountingadjust/latefeereduce/LateFeeReduceFormalizationService.java`
|
||||||
|
|
||||||
|
### 已接入主链 / 读模型
|
||||||
|
- `AccountingAdjustProcessServiceImpl`
|
||||||
|
- `AccountingAdjustActionServiceImpl`
|
||||||
|
- `AccountingAdjustQueryServiceImpl`
|
||||||
|
- `AccountingAdjustLogProcessServiceImpl`
|
||||||
|
- `AccountingAdjustProcessRespVO`
|
||||||
|
- `AccountingAdjustDetailRespVO`
|
||||||
|
- `AccountingAdjustLogDetailRespVO`
|
||||||
|
- `AccountingAdjustPageRespVO`
|
||||||
|
- `AccountingAdjustLogPageRespVO`
|
||||||
|
|
||||||
|
### 对应测试
|
||||||
|
- `AccountingAdjustSemanticMapperTest`
|
||||||
|
- `AccountingAdjustDictResolverTest`
|
||||||
|
- `AccountingAdjustStatusResolverTest`
|
||||||
|
- `LateFeeReduceFormalizationServiceTest`
|
||||||
|
- `AccountingAdjustQueryServiceImplTest`
|
||||||
|
- `AccountingAdjustLogProcessServiceImplTest`
|
||||||
|
- `AccountingAdjustProcessServiceImplTest`(定向方法)
|
||||||
|
- `AccountingAdjustActionServiceImplTest`(late-fee approval 定向方法)
|
||||||
|
|
||||||
|
## 本轮目标
|
||||||
|
1. 完成 Task-01 标准层 helper 最小实现
|
||||||
|
2. 将字典/状态 helper 接入 late-fee 相关读模型
|
||||||
|
3. 接入 late-fee reduce formal-table 申请态写入
|
||||||
|
4. 接入审批通过后 formal-table 最小更新闭环
|
||||||
|
5. 补 page / log-page 摘要字段试点
|
||||||
|
|
||||||
|
## 新鲜验证证据
|
||||||
|
### 1. 编译
|
||||||
|
执行:
|
||||||
|
```bash
|
||||||
|
rm -rf sw-business/sw-business-server/target/generated-sources \
|
||||||
|
sw-business/sw-business-server/target/generated-test-sources
|
||||||
|
mkdir -p sw-business/sw-business-server/target/generated-sources/annotations
|
||||||
|
mvn -pl sw-business/sw-business-server -DskipTests compile
|
||||||
|
```
|
||||||
|
结果:**PASS**
|
||||||
|
|
||||||
|
### 2. 定向测试
|
||||||
|
执行:
|
||||||
|
```bash
|
||||||
|
mvn -pl sw-business/sw-business-server \
|
||||||
|
-Dtest=AccountingAdjustQueryServiceImplTest,AccountingAdjustLogProcessServiceImplTest,AccountingAdjustProcessServiceImplTest#createUnsoldLateFeeReduce_shouldPassDateModeFieldsToUnifiedChargeService+createUnsoldLateFeeReduce_shouldRejectMixedAmountAndDateMode+batchCreateUnsoldLateFeeReduce_shouldMergeBatchOuterFieldsIntoItems+getProcess_shouldExposeLateFeeDisplayFieldsFromUnifiedSnapshot,AccountingAdjustActionServiceImplTest#approve_lateFeeReduceShouldOnlyUpdateLateFee,LateFeeReduceFormalizationServiceTest,AccountingAdjustSemanticMapperTest,AccountingAdjustDictResolverTest,AccountingAdjustStatusResolverTest \
|
||||||
|
test
|
||||||
|
```
|
||||||
|
结果:**PASS(24 tests, 0 fail, 0 error)**
|
||||||
|
|
||||||
|
## 当前结论
|
||||||
|
本轮已把第一批试点推进到:
|
||||||
|
- helper 已落地
|
||||||
|
- helper 已接入 late-fee 相关读模型
|
||||||
|
- late-fee formal-table 申请态写入已接入提交主链
|
||||||
|
- 审批通过后 formal-table 最小更新闭环已接入
|
||||||
|
- page / log-page 摘要字段试点已补
|
||||||
|
- compile 通过
|
||||||
|
- 定向测试通过
|
||||||
|
|
||||||
|
## 下一步
|
||||||
|
1. 继续推进 `lateFeeType=2` 按日期模式真正计算闭环
|
||||||
|
2. 补 formal-table 中 `before/reduce/after` 的更精确计算与状态更新
|
||||||
|
|
||||||
|
|
||||||
|
## 追加说明(date-mode 精确计算规则)
|
||||||
|
### 当前实现口径
|
||||||
|
- 使用 `LateFeeDateModeCalculator`
|
||||||
|
- 所有未缴费用项参与计算
|
||||||
|
- 逐项通过 `ChargeDetailDO.costComponentCode -> CostComponentDO.penaltyCoefficient` 取系数
|
||||||
|
- `penaltyCoefficient = 0` 的费用项自然贡献 0
|
||||||
|
- 每项先四舍五入到分,最后汇总
|
||||||
|
- `lateFeeBefore` / `lateFeeAfter` 使用区间口径,而不是整账单总值口径
|
||||||
|
|
||||||
|
### 已覆盖边界测试
|
||||||
|
- 多费用项逐项计算并汇总
|
||||||
|
- 起算日晚于用户选择开始日时自动裁剪有效区间
|
||||||
|
- 0 系数费用项混合场景
|
||||||
|
- 计算结果大于当前 `lateFee` 时,`reduceAmount` 按当前 `lateFee` 封顶
|
||||||
|
- 截止日早于有效起算日时返回 0
|
||||||
|
|
||||||
|
## 2026-04-15 补充进展:真实库 canary 拉绿
|
||||||
|
### 本轮补充代码
|
||||||
|
- `sw-business/sw-business-server/src/test/resources/sql/rev004/accountprocess/00_reset.sql`
|
||||||
|
- `sw-business/sw-business-server/src/test/resources/sql/rev004/accountprocess/02_latefee_formal_tables.sql`
|
||||||
|
- `sw-business/sw-business-server/src/test/resources/sql/rev004/accountprocess/03_latefee_formal_reset.sql`
|
||||||
|
- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/accountingadjust/latefeereduce/LateFeeReduceFormalizationService.java`
|
||||||
|
- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/accountingadjust/AccountingAdjustQueryServiceImpl.java`
|
||||||
|
- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/charge/ChargeServiceImpl.java`
|
||||||
|
- `sw-business/sw-business-server/src/test/java/cn/com/emsoft/sw/business/integration/rev004/accountprocess/Rev004AccountProcessCanaryQueryIntegrationTest.java`
|
||||||
|
|
||||||
|
### 修复点
|
||||||
|
1. **真实库 SQL fixture 兼容性**
|
||||||
|
- 去掉 `00_reset.sql` 中会被 Spring `ScriptUtils` 误切分的 `DO $$ ... $$`
|
||||||
|
- 新增 `03_latefee_formal_reset.sql`,把 late-fee formal table 的清理独立出来
|
||||||
|
- `02_latefee_formal_tables.sql` 改为无 `DO $$` 的约束重建方式
|
||||||
|
|
||||||
|
2. **formal-table 查询兜底**
|
||||||
|
- 当 `AccountingAdjustQueryServiceImpl` 无法仅从 `biz_operat_log(_detail)` 聚合出 `LATE_FEE_REDUCE` 详情时,
|
||||||
|
改为继续从:
|
||||||
|
- `biz_latefee_reduce`
|
||||||
|
- `biz_latefee_reduce_detail`
|
||||||
|
回退构造详情对象
|
||||||
|
|
||||||
|
3. **request log 的 adjustmentNo 明细一致性**
|
||||||
|
- `ChargeServiceImpl#recordAccountingAdjustOperatLog(...)` 中,
|
||||||
|
`adjustmentNo` 改为以 `oldValue = null, newValue = adjustmentNo` 记入日志明细,
|
||||||
|
避免被“旧值=新值则跳过”逻辑误过滤
|
||||||
|
|
||||||
|
### 新鲜验证
|
||||||
|
#### 定向编译
|
||||||
|
```bash
|
||||||
|
mvn -pl sw-business/sw-business-server -DskipTests compile
|
||||||
|
```
|
||||||
|
结果:**PASS**
|
||||||
|
|
||||||
|
#### 定向单测
|
||||||
|
```bash
|
||||||
|
mvn -pl sw-business/sw-business-server \
|
||||||
|
-Dtest=AccountingAdjustQueryServiceImplTest,LateFeeReduceFormalizationServiceTest,AccountingAdjustActionServiceImplTest#approve_lateFeeReduceDateModeShouldReduceCurrentLateFeeAndUpdateFormalTable \
|
||||||
|
test
|
||||||
|
```
|
||||||
|
结果:**PASS(8 tests, 0 fail, 0 error)**
|
||||||
|
|
||||||
|
#### 真实数据库 canary
|
||||||
|
```bash
|
||||||
|
REV004_IT_DB_URL=jdbc:postgresql://192.168.10.130:5436/sw_system \
|
||||||
|
REV004_IT_DB_USERNAME=sw_system \
|
||||||
|
REV004_IT_DB_PASSWORD='Em@123456' \
|
||||||
|
mvn -pl sw-business/sw-business-server clean \
|
||||||
|
-Dtest=Rev004AccountProcessCanaryQueryIntegrationTest#unsoldLateFeeReduceDateModeApprove_shouldPersistFormalTableSummary \
|
||||||
|
test
|
||||||
|
```
|
||||||
|
结果:**PASS**
|
||||||
|
|
||||||
|
### canary 覆盖到的链路
|
||||||
|
- 未销违约金减免(按日期)提交
|
||||||
|
- request log 写入 `adjustmentNo`
|
||||||
|
- `biz_latefee_reduce` / `biz_latefee_reduce_detail` 申请态落单
|
||||||
|
- 审批通过
|
||||||
|
- formal table 主表 / 明细表更新为成功态
|
||||||
|
|
||||||
|
### 当前结论更新
|
||||||
|
REV004 late-fee date-mode 这条最小闭环已从:
|
||||||
|
- **代码与单测通过**
|
||||||
|
推进到:
|
||||||
|
- **真实库 canary 通过**
|
||||||
|
|
||||||
|
当前剩余风险已不再是“缺表阻塞”,而是后续是否要把更多对象(坏账 / 核销 / 价差)也迁移到 formal-table 路线。
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
# REV004 late-fee formal-table 真实库阻塞说明(2026-04-15)
|
||||||
|
|
||||||
|
> 状态更新:**该阻塞已于 2026-04-15 当天解除,本文保留为阻塞发生记录。**
|
||||||
|
|
||||||
|
## 结论
|
||||||
|
当前 late-fee reduce 代码侧与定向单测已通过,但真实数据库集成验证被环境缺表阻塞,阻塞点不是代码逻辑,而是目标库未部署 formal-table。
|
||||||
|
|
||||||
|
## 已通过的验证
|
||||||
|
### 编译
|
||||||
|
```bash
|
||||||
|
rm -rf sw-business/sw-business-server/target/generated-sources \
|
||||||
|
sw-business/sw-business-server/target/generated-test-sources
|
||||||
|
mkdir -p sw-business/sw-business-server/target/generated-sources/annotations
|
||||||
|
mvn -pl sw-business/sw-business-server -DskipTests compile
|
||||||
|
```
|
||||||
|
结果:**PASS**
|
||||||
|
|
||||||
|
### 定向测试
|
||||||
|
```bash
|
||||||
|
mvn -pl sw-business/sw-business-server \
|
||||||
|
-Dtest=AccountingAdjustActionServiceImplTest#approve_lateFeeReduceShouldOnlyUpdateLateFee+approve_lateFeeReduceDateModeShouldReduceCurrentLateFeeAndUpdateFormalTable,LateFeeReduceFormalizationServiceTest,AccountingAdjustQueryServiceImplTest,AccountingAdjustLogProcessServiceImplTest,AccountingAdjustProcessServiceImplTest#createUnsoldLateFeeReduce_shouldPassDateModeFieldsToUnifiedChargeService+createUnsoldLateFeeReduce_shouldRejectMixedAmountAndDateMode+batchCreateUnsoldLateFeeReduce_shouldMergeBatchOuterFieldsIntoItems+getProcess_shouldExposeLateFeeDisplayFieldsFromUnifiedChargeService,AccountingAdjustSemanticMapperTest,AccountingAdjustDictResolverTest,AccountingAdjustStatusResolverTest \
|
||||||
|
test
|
||||||
|
```
|
||||||
|
结果:**PASS(24 tests, 0 fail, 0 error)**
|
||||||
|
|
||||||
|
## 真实 DB 阻塞验证
|
||||||
|
### 执行命令
|
||||||
|
```bash
|
||||||
|
REV004_IT_DB_URL=jdbc:postgresql://192.168.10.130:5436/sw_system \
|
||||||
|
REV004_IT_DB_USERNAME=sw_system \
|
||||||
|
REV004_IT_DB_PASSWORD='Em@123456' \
|
||||||
|
mvn -pl sw-business/sw-business-server \
|
||||||
|
-Dtest=Rev004AccountProcessCanaryQueryIntegrationTest#unsoldLateFeeReduceDateModeApprove_shouldPersistFormalTableSummary \
|
||||||
|
test
|
||||||
|
```
|
||||||
|
|
||||||
|
### 失败原因
|
||||||
|
报错核心:
|
||||||
|
- `relation "biz_latefee_reduce_detail" does not exist`
|
||||||
|
|
||||||
|
在测试前置 / 后置 SQL `sql/rev004/accountprocess/00_reset.sql` 中,已经尝试执行:
|
||||||
|
- `DELETE FROM biz_latefee_reduce_detail ...`
|
||||||
|
- `DELETE FROM biz_latefee_reduce ...`
|
||||||
|
|
||||||
|
这说明:
|
||||||
|
- 代码侧已经按 formal-table 路径推进
|
||||||
|
- 测试脚本也已经按 formal-table 假设编写
|
||||||
|
- 但真实库中尚未存在这些表
|
||||||
|
|
||||||
|
## 当前判断
|
||||||
|
1. 代码逻辑不是当前 blocker。
|
||||||
|
2. 真实 DB 环境未部署 `biz_latefee_reduce` / `biz_latefee_reduce_detail` 是当前 canary 唯一主要阻塞。
|
||||||
|
3. 在部署 formal-table 之前,真实库层面的 late-fee canary 无法拉绿。
|
||||||
|
|
||||||
|
## 建议下一步
|
||||||
|
1. 先确认真实库是否允许部署:
|
||||||
|
- `biz_latefee_reduce`
|
||||||
|
- `biz_latefee_reduce_detail`
|
||||||
|
2. 若允许部署,再重跑 canary。
|
||||||
|
3. 若暂不允许部署,则当前阶段只能以 compile + unit/integration mock/local 证据为主,明确标注“真实库阻塞未消除”。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 后续结果回写(阻塞已解除)
|
||||||
|
### 已完成动作
|
||||||
|
1. 补充并执行 `sql/rev004/REV004_latefee_formal_tables_deploy.sql`
|
||||||
|
2. 修复测试 SQL fixture:
|
||||||
|
- `00_reset.sql`
|
||||||
|
- `02_latefee_formal_tables.sql`
|
||||||
|
- `03_latefee_formal_reset.sql`
|
||||||
|
3. 补充 late-fee formal-table 查询兜底与 request log `adjustmentNo` 明细一致性
|
||||||
|
|
||||||
|
### 解除阻塞后的真实库验证
|
||||||
|
```bash
|
||||||
|
REV004_IT_DB_URL=jdbc:postgresql://192.168.10.130:5436/sw_system \
|
||||||
|
REV004_IT_DB_USERNAME=sw_system \
|
||||||
|
REV004_IT_DB_PASSWORD='Em@123456' \
|
||||||
|
mvn -pl sw-business/sw-business-server clean \
|
||||||
|
-Dtest=Rev004AccountProcessCanaryQueryIntegrationTest#unsoldLateFeeReduceDateModeApprove_shouldPersistFormalTableSummary \
|
||||||
|
test
|
||||||
|
```
|
||||||
|
结果:**PASS**
|
||||||
|
|
||||||
|
### 更新后的结论
|
||||||
|
- `biz_latefee_reduce` / `biz_latefee_reduce_detail` 缺表阻塞已消除
|
||||||
|
- REV004 late-fee date-mode 最小真实库闭环已验证通过
|
||||||
|
- 本文档现仅作为“阻塞曾发生过”的历史记录,不再代表当前状态
|
||||||
@ -0,0 +1,73 @@
|
|||||||
|
# REV004 late-fee formal table 已应用到 application-dev 测试库(2026-04-15)
|
||||||
|
|
||||||
|
## 目标库
|
||||||
|
依据:
|
||||||
|
- `sw-business/sw-business-server/src/main/resources/application-dev.yaml`
|
||||||
|
|
||||||
|
解析结果:
|
||||||
|
- Host:`192.168.10.130`
|
||||||
|
- Port:`5436`
|
||||||
|
- DB:`sw_system`
|
||||||
|
- User:`sw_system`
|
||||||
|
|
||||||
|
即当前 `application-dev` 指向的测试数据库为:
|
||||||
|
`jdbc:postgresql://192.168.10.130:5436/sw_system`
|
||||||
|
|
||||||
|
## 已执行脚本
|
||||||
|
- `sql/rev004/REV004_latefee_formal_tables_deploy.sql`
|
||||||
|
|
||||||
|
执行命令:
|
||||||
|
```bash
|
||||||
|
PGPASSWORD='Em@123456' \
|
||||||
|
psql -h 192.168.10.130 -p 5436 -U sw_system -d sw_system \
|
||||||
|
-v ON_ERROR_STOP=1 \
|
||||||
|
-f sql/rev004/REV004_latefee_formal_tables_deploy.sql
|
||||||
|
```
|
||||||
|
|
||||||
|
## 执行结果
|
||||||
|
结果:**PASS**
|
||||||
|
|
||||||
|
执行输出显示:
|
||||||
|
- sequence 已存在时跳过
|
||||||
|
- table 已存在时跳过
|
||||||
|
- 索引继续补齐/确认
|
||||||
|
- 外键创建逻辑执行成功
|
||||||
|
|
||||||
|
说明该脚本已成功应用到测试库,且具备幂等重放能力。
|
||||||
|
|
||||||
|
## 回读校验
|
||||||
|
### 表
|
||||||
|
已确认存在:
|
||||||
|
- `biz_latefee_reduce`
|
||||||
|
- `biz_latefee_reduce_detail`
|
||||||
|
|
||||||
|
### 序列
|
||||||
|
已确认存在:
|
||||||
|
- `biz_latefee_reduce_seq`
|
||||||
|
- `biz_latefee_reduce_detail_seq`
|
||||||
|
|
||||||
|
### 索引
|
||||||
|
已确认存在:
|
||||||
|
- `uk_biz_latefee_reduce_no`
|
||||||
|
- `idx_biz_latefee_reduce_case`
|
||||||
|
- `idx_biz_latefee_reduce_status`
|
||||||
|
- `idx_biz_latefee_reduce_type`
|
||||||
|
- `idx_biz_latefee_reduce_detail_main`
|
||||||
|
- `idx_biz_latefee_reduce_detail_charge`
|
||||||
|
- `idx_biz_latefee_reduce_detail_cust`
|
||||||
|
- `idx_biz_latefee_reduce_detail_bill_month`
|
||||||
|
|
||||||
|
### 外键
|
||||||
|
已确认存在:
|
||||||
|
- `fk_biz_latefee_reduce_detail_main`
|
||||||
|
- `biz_latefee_reduce_detail(latefee_reduce_id) -> biz_latefee_reduce(id)`
|
||||||
|
|
||||||
|
## 当前结论
|
||||||
|
`application-dev` 指向的测试数据库现在已经具备 REV004 late-fee formal-table 结构,可直接用于:
|
||||||
|
1. 未销违约金减免申请态落单
|
||||||
|
2. 审批态 formal-table 更新
|
||||||
|
3. accountProcess 真实库 canary / 联调验证
|
||||||
|
|
||||||
|
## 建议后续
|
||||||
|
1. 继续保留 `REV004_latefee_formal_tables_deploy.sql` 作为测试库 / 联调库初始化脚本
|
||||||
|
2. 若后续坏账 / 核销 / 价差也迁移 formal-table,应沿用相同“独立 deploy SQL + 回读校验”的方式推进
|
||||||
Loading…
x
Reference in New Issue
Block a user