docs: plan sold adjustment and red flush fixes

This commit is contained in:
tangweijie 2026-07-13 10:56:00 +08:00
parent 8346a0024d
commit a39420d78c
2 changed files with 196 additions and 0 deletions

View File

@ -0,0 +1,151 @@
# 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.

View File

@ -0,0 +1,45 @@
# 已销调整与红冲记录缺陷修复设计
## 目标
修复腾讯文档“测试组测试问题”中无歧义的四组问题:
1. 已销调整默认只展示柜台已结账账单252
2. 已销调整多选筛选参数与后端契约一致195/197
3. 红冲记录收费员筛选改为下拉选择271
4. 红冲记录列表与导出补充操作员、收费时间字段272/273
不实现含义未确认的红冲记录“操作按钮”。
## 设计
### 已销调整
前端继续保留“历史”复选框及默认值 `true`,但 `buildQueryParams()` 必须显式传递 `isHistory`。多选控件分别传递 `collectionMethodList``custTypeList``waterNatureList``meterTypeList`,不再把数组写入后端单值字段。
后端已有 `isHistory=true -> PayStateEnum.SETTLED` 的查询规则,不改变状态模型。补充契约测试,保证前端请求参数和后端 VO 字段一致。
### 红冲记录
收费员筛选复用系统用户精简列表,显示用户名称并以用户 ID 查询。查询接口继续使用 `cashierId`,不改变后端筛选语义。
后端响应新增 `operatorName``chargeTime`
- 已结账红冲:操作员来自结账明细 `procPerson`,收费时间来自原支付记录 `payTime`
- 未结账红冲:操作员优先取反向支付记录收费员,收费时间来自原支付记录 `payTime`
列表和 Excel 导出统一使用同一响应模型字段,避免页面与导出数据口径不同。导出标题继续由现有 Excel 工具生成。
## 测试
- 前端契约测试验证已销调整发送 `isHistory` 和四个 `*List` 参数。
- 后端已销调整单测验证 `isHistory=true` 只查询 `SETTLED`
- 前端红冲记录契约测试验证收费员下拉和新增列。
- 后端红冲服务单测验证已结账、未结账两条映射路径。
- 导出表头测试验证“操作员”“收费时间”。
## 非目标
- 不调整已销调整申请原因、账单名称权威来源或其他旧营收字段。
- 不新增红冲记录操作按钮。
- 不改变柜台结账聚合或红冲业务状态机。