diff --git a/docs/evidence/rev004-accounting/late-fee-start-and-daily-recalculation-2026-06-30.md b/docs/evidence/rev004-accounting/late-fee-start-and-daily-recalculation-2026-06-30.md index fd01087..f7d655b 100644 --- a/docs/evidence/rev004-accounting/late-fee-start-and-daily-recalculation-2026-06-30.md +++ b/docs/evidence/rev004-accounting/late-fee-start-and-daily-recalculation-2026-06-30.md @@ -18,6 +18,7 @@ - `af05601f1 fix: harden late fee recalculation batch` - `3722c54fa fix: paginate late fee recalculation batches` - `d551dba84 fix: handle late fee reversal and batch transactions` +- `bcc635e81 fix: guard late fee recalculation updates` ## Implemented Files @@ -36,6 +37,7 @@ - `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/charge/ChargeServiceImpl.java` - `script/xxl-job-init.sql` +- `sql/rev004/REV004_late_fee_daily_recalculation_index.sql` - Unit tests under `sw-business/sw-business-server/src/test/java/cn/com/emsoft/sw/business/service/charge/latefee/` - `sw-business/sw-business-server/src/test/java/cn/com/emsoft/sw/business/service/charge/ChargeLateFeeBeginDateWiringTest.java` - `sw-business/sw-business-server/src/test/java/cn/com/emsoft/sw/business/service/accountingadjust/pricediff/PriceDiffWriteBackServiceTest.java` @@ -51,6 +53,9 @@ - Focused tests now cover the shared begin-date apply service, keyset pagination across batches, and direct insert path wiring for counter add-reading and special billing. - Price-diff write-back now applies missing `lateFeeBeginDate` before inserting the replacement unpaid charge. - Daily recalculation now keeps the outer pagination loop non-transactional and executes each page through `LateFeeRecalculationBatchService.recalculateBatch(...)` with its own transaction boundary. +- Daily recalculation now updates `lateFee` through a conditional mapper update that still requires `payState=UNPAID` and non-null `lateFeeBeginDate`, so a charge paid after selection is not overwritten or counted. +- `LateFeeDailyCalculator` ignores non-positive penalty coefficients defensively. +- `REV004_late_fee_daily_recalculation_index.sql` adds `idx_biz_charge_late_fee_recalc` on `(tenant_id, pay_state, id)` for the tenant-scoped unpaid keyset scan. ## Verification @@ -65,15 +70,15 @@ mvn -pl sw-business/sw-business-server -am -Dtest=LateFeeBeginDateCalculatorTest Result: PASS - `LateFeeBeginDateApplyServiceTest`: 2 tests, 0 failures, 0 errors, 0 skipped -- `LateFeeRecalculationServiceTest`: 7 tests, 0 failures, 0 errors, 0 skipped +- `LateFeeRecalculationServiceTest`: 8 tests, 0 failures, 0 errors, 0 skipped - `LateFeeConfigResolverTest`: 3 tests, 0 failures, 0 errors, 0 skipped - `LateFeeBeginDateCalculatorTest`: 7 tests, 0 failures, 0 errors, 0 skipped -- `LateFeeDailyCalculatorTest`: 8 tests, 0 failures, 0 errors, 0 skipped +- `LateFeeDailyCalculatorTest`: 9 tests, 0 failures, 0 errors, 0 skipped - `ChargeLateFeeBeginDateWiringTest`: 5 tests, 0 failures, 0 errors, 0 skipped - `PriceDiffWriteBackServiceTest`: 1 test, 0 failures, 0 errors, 0 skipped - `CounterAddReadingApplicationServiceImplTest`: 24 tests, 0 failures, 0 errors, 0 skipped - `SpecialBillingServiceImplTest`: 4 tests, 0 failures, 0 errors, 0 skipped -- Total: 61 tests, 0 failures, 0 errors, 0 skipped +- Total: 63 tests, 0 failures, 0 errors, 0 skipped ### Existing Accounting Regression Tests