Files
ccdi/docs/plans/backend/2026-07-20-bank-statement-counterparty-backend-implementation.md

30 lines
1.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 流水明细对手方聚合查询后端实施计划
## 背景
明细查询需要增加类似 lsfx 对手方页签的聚合视图,按流水 `CUSTOMER_ACCOUNT_NAME` 归集同一项目、同一筛选条件下的交易数据,供前端展示对手方汇总。
## 实施范围
- `ccdi-project` 后端模块。
- 新增对手方聚合分页接口,不新增业务表,不修改已有流水明细查询入参结构。
- 复用 `CcdiBankStatementQueryDTO` 的项目、交易方向、交易时间、本方主体、本方银行、本方账号、金额区间、对方名称、对方账户、摘要和空值匹配筛选。
## 实施步骤
1. 新增 `CcdiBankStatementCounterpartyVO`,返回对手方名称、空值标识、关联账号数、流入/流出金额与笔数、总交易额、总笔数、最近交易时间。
2.`CcdiBankStatementController` 增加 `GET /ccdi/project/bank-statement/counterparty/list`,沿用项目读权限校验和 RuoYi 分页返回结构。
3.`ICcdiBankStatementService``CcdiBankStatementServiceImpl` 增加聚合查询服务方法,统一复用明细查询参数归一化和排序白名单。
4.`CcdiBankStatementMapper` 与 XML 中新增聚合 SQL
-`CUSTOMER_ACCOUNT_NAME``TRIM(IFNULL(..., ''))` 后分组。
-`CASE WHEN AMOUNT >= 0` 统计流入,用 `< 0` 统计流出。
-`ABS(AMOUNT)` 计算流出合计和总交易额,便于前端展示正数合计。
- 最近交易时间复用既有交易时间解析表达式。
5. 补充 Controller 与 Mapper XML 单元测试覆盖接口分页返回、SQL 聚合字段、筛选条件和排序。
## 验证计划
- 运行后端定向单测:
`mvn -pl ccdi-project -am "-Dtest=CcdiBankStatementMapperXmlTest,CcdiBankStatementControllerTest" "-Dsurefire.failIfNoSpecifiedTests=false" test`
- 打包并启动真实后端后,用真实页面请求新接口,确认 `counterparty/list` 返回 200。