diff --git a/docs/evidence/rev004-accounting/late-fee-daily-recalculation-2026-06-30.md b/docs/evidence/rev004-accounting/late-fee-daily-recalculation-2026-06-30.md deleted file mode 100644 index 9b1895b..0000000 --- a/docs/evidence/rev004-accounting/late-fee-daily-recalculation-2026-06-30.md +++ /dev/null @@ -1,45 +0,0 @@ -# Late Fee Daily Recalculation Evidence (2026-06-30) - -## Scope - -- Backend task: daily recalculation service and XXL job for unpaid charge late fees. -- Worktree: `/Volumes/Dpan/github/water-workspace/worktrees/backend-late-fee-recalc` -- Branch: `feat/late-fee-recalc` - -## Implemented Files - -- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/charge/latefee/LateFeeRecalculationService.java` -- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/job/charge/LateFeeRecalculationJob.java` -- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/config/ClockConfig.java` -- `sw-business/sw-business-server/src/test/java/cn/com/emsoft/sw/business/service/charge/latefee/LateFeeRecalculationServiceTest.java` - -## Verification - -### Targeted Tests - -Command: - -```bash -mvn -pl sw-business/sw-business-server -am -Dtest=LateFeeRecalculationServiceTest,LateFeeDailyCalculatorTest -Dsurefire.failIfNoSpecifiedTests=false test -``` - -Result: PASS - -- `LateFeeRecalculationServiceTest`: 4 tests, 0 failures, 0 errors, 0 skipped -- `LateFeeDailyCalculatorTest`: 8 tests, 0 failures, 0 errors, 0 skipped -- Total: 12 tests, 0 failures, 0 errors, 0 skipped - -### Compile - -Command: - -```bash -mvn -pl sw-business/sw-business-server -am -DskipTests compile -``` - -Result: PASS - -## Notes - -- Maven reported existing effective-model warnings for duplicate/missing plugin declarations in unrelated modules; they did not fail the build. -- Mockito reported the existing dynamic-agent warning during unit tests; it did not fail the test run. 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 new file mode 100644 index 0000000..ddc298b --- /dev/null +++ b/docs/evidence/rev004-accounting/late-fee-start-and-daily-recalculation-2026-06-30.md @@ -0,0 +1,94 @@ +# Late Fee Start Date and Daily Recalculation Evidence (2026-06-30) + +## Scope + +- Backend feature: late-fee start-date calculation for four configured modes, billing-time persistence, and daily recalculation for unpaid charges. +- Backend worktree: `/Volumes/Dpan/github/water-workspace/worktrees/backend-late-fee-recalc` +- Backend branch: `feat/late-fee-recalc` +- Docs branch: `feat/rev004-dict-alignment-docs` + +## Backend Commits + +- `8c2714af2 feat: add late fee begin date calculator` +- `1724f0c3c feat: resolve late fee parameter config` +- `282c327e7 feat: add late fee daily calculator` +- `320e50d73 feat: add late fee recalculation mapper helpers` +- `fd5154f83 feat: save late fee begin date during billing` +- `f7207fe61 feat: add daily late fee recalculation job` +- `af05601f1 fix: harden late fee recalculation batch` + +## Implemented Files + +- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/charge/latefee/LateFeeSettingCodes.java` +- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/charge/latefee/LateFeeConfig.java` +- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/charge/latefee/LateFeeConfigResolver.java` +- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/charge/latefee/LateFeeBeginDateCalculator.java` +- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/charge/latefee/LateFeeDailyCalculator.java` +- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/charge/latefee/LateFeeRecalculationService.java` +- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/job/charge/LateFeeRecalculationJob.java` +- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/config/ClockConfig.java` +- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/dal/mysql/charge/ChargeMapper.java` +- `sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/dal/mysql/paymentrecorddetail/PaymentRecordDetailMapper.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/charge/ChargeServiceImpl.java` +- `script/xxl-job-init.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` + +## Review Fixes + +- Paid late-fee deduction now counts only `PaymentAllocationStatusEnum.APPLIED` late-fee payment details, so reversed positive details are not deducted again. +- The daily recalculation batch now selects unpaid charges with non-null `lateFeeBeginDate`, avoiding repeated starvation behind historical rows that cannot be recalculated. +- `script/xxl-job-init.sql` registers handler `lateFeeDailyRecalculation` for business-server with cron `0 30 3 * * ?`. +- `LateFeeRecalculationServiceTest` includes a defensive scenario where a reversed late-fee detail is returned by the mapper and ignored by aggregation. + +## Verification + +### Focused Late-Fee Tests + +Command: + +```bash +mvn -pl sw-business/sw-business-server -am -Dtest=LateFeeBeginDateCalculatorTest,LateFeeConfigResolverTest,LateFeeDailyCalculatorTest,LateFeeRecalculationServiceTest,ChargeLateFeeBeginDateWiringTest -Dsurefire.failIfNoSpecifiedTests=false test +``` + +Result: PASS + +- `LateFeeRecalculationServiceTest`: 4 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 +- `ChargeLateFeeBeginDateWiringTest`: 5 tests, 0 failures, 0 errors, 0 skipped +- Total: 27 tests, 0 failures, 0 errors, 0 skipped + +### Existing Accounting Regression Tests + +Command: + +```bash +mvn -pl sw-business/sw-business-server -am -Dtest=LateFeeDateModeCalculatorTest,PaymentRecordServiceImplTest,AccountingAdjustActionServiceImplTest,ChargeServiceBillingValidationTest -Dsurefire.failIfNoSpecifiedTests=false test +``` + +Result: PASS + +- `ChargeServiceBillingValidationTest`: 7 tests, 0 failures, 0 errors, 0 skipped +- `LateFeeDateModeCalculatorTest`: 4 tests, 0 failures, 0 errors, 0 skipped +- `AccountingAdjustActionServiceImplTest`: 19 tests, 0 failures, 0 errors, 0 skipped +- `PaymentRecordServiceImplTest`: 18 tests, 0 failures, 0 errors, 0 skipped +- Total: 48 tests, 0 failures, 0 errors, 0 skipped + +### Compile + +Command: + +```bash +mvn -pl sw-business/sw-business-server -am -DskipTests compile +``` + +Result: PASS + +## Known Warnings + +- Maven reports existing effective-model warnings for duplicate or missing plugin declarations in unrelated modules. +- Mockito reports the existing dynamic-agent warning during unit tests. +- These warnings did not fail the executed verification commands.