yeg
2026-09-18 6c42f8fb5ef1b7778ddd75a2baa02b5af2afb0c8
docs(scratch): 结算记录查询条件的复现与验证脚本

verify-filters.sh 用同一个接口只改一个查询条件,对比返回的商户与条数:修好前四个条件都毫无影响
(这就是「查询是摆设」),修好后商家/类型/电话都会收窄、状态=P 为 0 条。

中文值一律走 `--data-urlencode name@file`:把中文当命令行参数传给 curl 时可能被转成 GBK 字节,
Tomcat 拿到的不是合法 UTF-8,会报「Character decoding failed」而返回 500——那是测法的问题,
不是接口的问题,脚本注释里记了这一点免得下次再踩。
3个文件已添加
43 ■■■■■ 已修改文件
.scratch/settlement-query-failure/value-merchant-name.txt 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.scratch/settlement-query-failure/value-merchant-type.txt 1 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.scratch/settlement-query-failure/verify-filters.sh 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.scratch/settlement-query-failure/value-merchant-name.txt
New file
@@ -0,0 +1 @@
存量商户验证专用
.scratch/settlement-query-failure/value-merchant-type.txt
New file
@@ -0,0 +1 @@
景区服务
.scratch/settlement-query-failure/verify-filters.sh
New file
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
# 验证「财务管理 / 结算记录」页的查询条件真的生效:同一接口只改一个条件,返回的商户/条数必须随之变化。
#
# 用法:bash verify-filters.sh [base-url]       默认 http://localhost:8080
# 中文值一律走 `--data-urlencode name@file`:Shell 传中文命令行参数时可能被转成 GBK 字节,
# 那样通道参数不是合法 UTF-8,Tomcat 会报「Character decoding failed」而返回 500——那是测法的问题,不是接口的问题。
set -u
BASE="${1:-http://localhost:8080}"
URL="$BASE/api/admin/management/merchant-settlement/settlements"
VALUES="$(dirname "$0")"
BEGIN="${BEGIN:-20260819}"
END="${END:-20260918}"
TOKEN=$(curl -s -X POST "$BASE/api/admin/auth/login" -H 'Content-Type: application/json' \
  -d '{"account":"admin","password":"123456"}' | sed -n 's/.*"accessToken":"\([^"]*\)".*/\1/p')
if [ -z "$TOKEN" ]; then
  echo "登录失败:后台账号密码可能已改,请改成本地可用的凭据" >&2
  exit 2
fi
probe() {
  local label="$1"
  shift
  local body
  body=$(curl -s -G "$URL" --data "size=50" --data "beginDate=$BEGIN" --data "endDate=$END" "$@" \
    -H "Authorization: Bearer $TOKEN")
  printf '%-26s 条数=%-4s 商户=%s\n' "$label" \
    "$(printf '%s' "$body" | grep -o 'providerTransactionNo' | wc -l | tr -d ' ')" \
    "$(printf '%s' "$body" | grep -o '"merchantName":"[^"]*"' | sed 's/.*:"//; s/"$//' | sort -u | tr '\n' ' ')"
}
probe "无条件"
probe "商家=存量商户验证专用" --data-urlencode "merchantName@$VALUES/value-merchant-name.txt"
probe "商家类型=景区服务" --data-urlencode "merchantType@$VALUES/value-merchant-type.txt"
probe "状态=已结算(S)" --data "status=S"
probe "状态=处理中(P)" --data "status=P"
echo
echo "期望:商家/商家类型两项的条数与商户都收窄;状态=S 全量、状态=P 为 0(当前没有处理中的流水)。"
echo "无条件那一行仍是全部——它只是基线。"