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
7.6 KiB
7.6 KiB
REV004 账务调整统一标准层 — 第一批代码启动证据(2026-04-15)
本轮新增代码
标准层 helper
sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/accountingadjust/standard/AccountingAdjustSemanticMapper.javasw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/accountingadjust/standard/AccountingAdjustDictResolver.javasw-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.javasw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/dal/dataobject/latefeereducedetail/LateFeeReduceDetailDO.javasw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/dal/mysql/latefeereduce/LateFeeReduceMapper.javasw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/dal/mysql/latefeereducedetail/LateFeeReduceDetailMapper.javasw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/accountingadjust/latefeereduce/LateFeeReduceFormalizationService.java
已接入主链 / 读模型
AccountingAdjustProcessServiceImplAccountingAdjustActionServiceImplAccountingAdjustQueryServiceImplAccountingAdjustLogProcessServiceImplAccountingAdjustProcessRespVOAccountingAdjustDetailRespVOAccountingAdjustLogDetailRespVOAccountingAdjustPageRespVOAccountingAdjustLogPageRespVO
对应测试
AccountingAdjustSemanticMapperTestAccountingAdjustDictResolverTestAccountingAdjustStatusResolverTestLateFeeReduceFormalizationServiceTestAccountingAdjustQueryServiceImplTestAccountingAdjustLogProcessServiceImplTestAccountingAdjustProcessServiceImplTest(定向方法)AccountingAdjustActionServiceImplTest(late-fee approval 定向方法)
本轮目标
- 完成 Task-01 标准层 helper 最小实现
- 将字典/状态 helper 接入 late-fee 相关读模型
- 接入 late-fee reduce formal-table 申请态写入
- 接入审批通过后 formal-table 最小更新闭环
- 补 page / log-page 摘要字段试点
新鲜验证证据
1. 编译
执行:
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. 定向测试
执行:
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 通过
- 定向测试通过
下一步
- 继续推进
lateFeeType=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.sqlsw-business/sw-business-server/src/test/resources/sql/rev004/accountprocess/02_latefee_formal_tables.sqlsw-business/sw-business-server/src/test/resources/sql/rev004/accountprocess/03_latefee_formal_reset.sqlsw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/accountingadjust/latefeereduce/LateFeeReduceFormalizationService.javasw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/accountingadjust/AccountingAdjustQueryServiceImpl.javasw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/charge/ChargeServiceImpl.javasw-business/sw-business-server/src/test/java/cn/com/emsoft/sw/business/integration/rev004/accountprocess/Rev004AccountProcessCanaryQueryIntegrationTest.java
修复点
-
真实库 SQL fixture 兼容性
- 去掉
00_reset.sql中会被 SpringScriptUtils误切分的DO $$ ... $$ - 新增
03_latefee_formal_reset.sql,把 late-fee formal table 的清理独立出来 02_latefee_formal_tables.sql改为无DO $$的约束重建方式
- 去掉
-
formal-table 查询兜底
- 当
AccountingAdjustQueryServiceImpl无法仅从biz_operat_log(_detail)聚合出LATE_FEE_REDUCE详情时, 改为继续从:biz_latefee_reducebiz_latefee_reduce_detail回退构造详情对象
- 当
-
request log 的 adjustmentNo 明细一致性
ChargeServiceImpl#recordAccountingAdjustOperatLog(...)中,adjustmentNo改为以oldValue = null, newValue = adjustmentNo记入日志明细, 避免被“旧值=新值则跳过”逻辑误过滤
新鲜验证
定向编译
mvn -pl sw-business/sw-business-server -DskipTests compile
结果:PASS
定向单测
mvn -pl sw-business/sw-business-server \
-Dtest=AccountingAdjustQueryServiceImplTest,LateFeeReduceFormalizationServiceTest,AccountingAdjustActionServiceImplTest#approve_lateFeeReduceDateModeShouldReduceCurrentLateFeeAndUpdateFormalTable \
test
结果:PASS(8 tests, 0 fail, 0 error)
真实数据库 canary
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 路线。