fujian_water_biz_doc/superpowers/plans/2026-07-13-sold-adjustment-red-flush-fix-plan.md

152 lines
6.9 KiB
Markdown

# Sold Adjustment and Red Flush Fix Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Make sold adjustment query settled charges with correct multi-select parameters and complete red-flush record filtering, list, and export fields.
**Architecture:** Keep the existing backend status model and API routes. Correct the frontend request contract for sold adjustment, then extend the red-flush response projection with operator and original charge time while reusing the existing system-user option API for filtering.
**Tech Stack:** Vue 3, TypeScript, Element Plus, Node test runner, Spring Boot, MyBatis Plus, JUnit 5, Mockito.
---
### Task 1: Sold adjustment request contract
**Files:**
- Modify: `water-frontend/src/views/accountProcess/soldAdjustment/sold-adjustment.contract.test.mjs`
- Modify: `water-frontend/src/views/accountProcess/soldAdjustment/index.vue`
- Modify: `water-frontend/src/api/accountProcess/soldAdjustment/index.ts`
- [ ] **Step 1: Write failing contract tests**
Add assertions that `buildQueryParams()` contains `isHistory: queryParams.isHistory` and maps the four arrays to `collectionMethodList`, `custTypeList`, `waterNatureList`, and `meterTypeList`. Assert the request interface declares those fields.
- [ ] **Step 2: Verify the tests fail**
Run: `node --test src/views/accountProcess/soldAdjustment/sold-adjustment.contract.test.mjs`
Expected: FAIL because `isHistory` and `*List` request mappings are missing.
- [ ] **Step 3: Implement the minimal request mapping**
Update `buildQueryParams()` to emit:
```ts
isHistory: queryParams.isHistory,
collectionMethodList: queryParams.collectionMethod.length ? queryParams.collectionMethod : undefined,
custTypeList: queryParams.custType.length ? queryParams.custType.map(String) : undefined,
waterNatureList: queryParams.waterNature.length ? queryParams.waterNature : undefined,
meterTypeList: queryParams.meterType.length ? queryParams.meterType.map(String) : undefined
```
Remove the array assignments to the single-value fields and add matching optional properties to `SoldAdjustmentPageReqVO`.
- [ ] **Step 4: Verify the contract tests pass**
Run: `node --test src/views/accountProcess/soldAdjustment/sold-adjustment.contract.test.mjs`
Expected: 0 failures.
- [ ] **Step 5: Commit frontend batch 1**
```bash
git add src/views/accountProcess/soldAdjustment/index.vue \
src/views/accountProcess/soldAdjustment/sold-adjustment.contract.test.mjs \
src/api/accountProcess/soldAdjustment/index.ts
git commit -m "fix: align sold adjustment settled query"
```
### Task 2: Red-flush frontend filter and columns
**Files:**
- Modify: `water-frontend/src/views/operatingCharges/redReversalRecord/payment-no-filter.contract.test.mjs`
- Modify: `water-frontend/src/views/operatingCharges/redReversalRecord/index.vue`
- Modify: `water-frontend/src/api/business/charge/counterSettle.ts`
- [ ] **Step 1: Write failing frontend contract tests**
Assert that the cashier field uses `el-select`, loads system simple-user options, and that columns/types include `operatorName` and `chargeTime`.
- [ ] **Step 2: Verify the tests fail**
Run: `node --test src/views/operatingCharges/redReversalRecord/payment-no-filter.contract.test.mjs`
Expected: FAIL because the cashier is an input and the new fields do not exist.
- [ ] **Step 3: Implement the filter and columns**
Replace the cashier input with a filterable clearable select backed by the existing system simple-user API. Add list columns “操作员” and “收费时间”, using the existing date formatter.
Extend `CounterRedFlushRecordRespVO` with:
```ts
operatorName?: string
chargeTime?: string
```
- [ ] **Step 4: Verify frontend tests pass**
Run the red-flush contract test and the related revenue display contract tests.
- [ ] **Step 5: Commit frontend batch 2**
```bash
git add src/views/operatingCharges/redReversalRecord \
src/api/business/charge/counterSettle.ts
git commit -m "feat: complete red flush record fields"
```
### Task 3: Red-flush backend projection and export
**Files:**
- Modify: `water-backend/sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/controller/admin/charge/vo/CounterRedFlushRecordRespVO.java`
- Modify: `water-backend/sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/countersettle/CounterSettleApplicationServiceImpl.java`
- Modify: `water-backend/sw-business/sw-business-server/src/test/java/cn/com/emsoft/sw/business/service/countersettle/CounterSettleApplicationServiceImplTest.java`
- Modify: `water-backend/sw-business/sw-business-server/src/test/java/cn/com/emsoft/sw/business/controller/admin/charge/vo/CounterChargeExportHeaderTest.java`
- [ ] **Step 1: Write failing backend tests**
Add assertions that settled red-flush rows use detail `procPerson` and original payment `payTime`, and unsettled rows expose the original payment time. Add Excel-header assertions for “操作员” and “收费时间”.
- [ ] **Step 2: Verify the tests fail**
Run the two targeted Maven tests using the repository-supported JDK and reactor options.
Expected: compilation/test failure because the response fields are absent.
- [ ] **Step 3: Implement the response projection**
Add Excel-enabled fields:
```java
@ExcelProperty("操作员")
private String operatorName;
@ExcelProperty("收费时间")
private LocalDateTime chargeTime;
```
Populate them in both `toRedFlushRecordResp` and `toUnsettledRedFlushRecordResp` without changing red-flush state transitions.
- [ ] **Step 4: Verify backend tests pass**
Run targeted service and export-header tests. If the repository-wide pre-existing compilation issue prevents Maven from reaching the tests, run the available contract tests and report the blocker explicitly.
- [ ] **Step 5: Commit backend changes**
```bash
git add sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/controller/admin/charge/vo/CounterRedFlushRecordRespVO.java \
sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/countersettle/CounterSettleApplicationServiceImpl.java \
sw-business/sw-business-server/src/test/java/cn/com/emsoft/sw/business/service/countersettle/CounterSettleApplicationServiceImplTest.java \
sw-business/sw-business-server/src/test/java/cn/com/emsoft/sw/business/controller/admin/charge/vo/CounterChargeExportHeaderTest.java
git commit -m "feat: expose red flush operator and charge time"
```
### Task 4: Final verification
- [ ] Run all changed frontend contract tests.
- [ ] Run TypeScript type checking or the narrowest repository-supported check covering changed files.
- [ ] Run targeted backend tests or document the pre-existing build blocker.
- [ ] Inspect `git diff --check` and final repository statuses.
- [ ] Report commit hashes and any remaining environment-only verification gap.