120 lines
3.9 KiB
Markdown
120 lines
3.9 KiB
Markdown
# REV004 预存调整 prestorage-submit 开发环境调用记录(2026-04-23)
|
||
|
||
- 验证日期:2026-04-23
|
||
- 后端仓基线:`21714d64822268d8dcb7cd1296656b4c19ff95fa`
|
||
- 前端仓基线:`d2698e1f5d107422f64928086d89d4b803cd12ae`
|
||
- 目标环境:`root@192.168.10.130`
|
||
- 服务端口:`sw-gateway -> 127.0.0.1:48080`,`sw-business-server -> 127.0.0.1:48090`
|
||
- 配置依据:
|
||
- `water-backend/sw-gateway/src/main/resources/application-dev.yaml`
|
||
- `water-backend/sw-business/sw-business-server/src/main/resources/application-dev.yaml`
|
||
- 鉴权方式:开发环境 `sw.security.mock-enable=true`,使用 `Authorization: Bearer emsoft1` + `tenant-id: 1`
|
||
|
||
## 1. 实际调用 payload
|
||
|
||
```json
|
||
{
|
||
"applicant": "李四",
|
||
"applyReason": "充值错误",
|
||
"attachmentRefs": [],
|
||
"contactMobile": "19928382738",
|
||
"custCode": "26041011111",
|
||
"refundAmount": 2,
|
||
"remark": "ssa"
|
||
}
|
||
```
|
||
|
||
## 2. 实际调用命令
|
||
|
||
### 2.1 直连 business
|
||
|
||
```bash
|
||
curl -X POST 'http://127.0.0.1:48090/admin-api/business/accounting-adjust/prestorage-submit' \
|
||
-H 'Authorization: Bearer emsoft1' \
|
||
-H 'tenant-id: 1' \
|
||
-H 'Content-Type: application/json' \
|
||
--data '{"applicant":"李四","applyReason":"充值错误","attachmentRefs":[],"contactMobile":"19928382738","custCode":"26041011111","refundAmount":2,"remark":"ssa"}'
|
||
```
|
||
|
||
### 2.2 走 gateway
|
||
|
||
```bash
|
||
curl -X POST 'http://127.0.0.1:48080/admin-api/business/accounting-adjust/prestorage-submit' \
|
||
-H 'Authorization: Bearer emsoft1' \
|
||
-H 'tenant-id: 1' \
|
||
-H 'Content-Type: application/json' \
|
||
--data '{"applicant":"李四","applyReason":"充值错误","attachmentRefs":[],"contactMobile":"19928382738","custCode":"26041011111","refundAmount":2,"remark":"ssa"}'
|
||
```
|
||
|
||
## 3. 调用结果
|
||
|
||
直连 business 与走 gateway 返回一致:
|
||
|
||
```json
|
||
{"code":500,"data":null,"msg":"系统异常"}
|
||
```
|
||
|
||
## 4. 后端日志根因
|
||
|
||
`sw-business-server` 日志显示真实异常为:
|
||
|
||
```text
|
||
java.lang.IllegalArgumentException: 账户预存余额不足
|
||
at cn.com.emsoft.sw.business.service.accountingadjust.accountProcess.AccountingAdjustProcessServiceImpl.createPrestorageAction(AccountingAdjustProcessServiceImpl.java:213)
|
||
```
|
||
|
||
对应代码位置:
|
||
|
||
- `water-backend/sw-business/sw-business-server/src/main/java/cn/com/emsoft/sw/business/service/accountingadjust/accountProcess/AccountingAdjustProcessServiceImpl.java`
|
||
|
||
关键逻辑:
|
||
|
||
- 读取客户与账户
|
||
- 将 `deposit == null` 视为 `0`
|
||
- 校验 `deposit < refundAmount` 时抛出 `IllegalArgumentException("账户预存余额不足")`
|
||
|
||
## 5. 数据库核验
|
||
|
||
开发库(`sw_system`)中当前客户与账户数据:
|
||
|
||
```sql
|
||
select id, code, name, population, address, status, tenant_id
|
||
from biz_cust
|
||
where deleted = 0 and code = '26041011111';
|
||
|
||
select id, cust_id, deposit, uncheck_money, overdraft, status, deleted, tenant_id
|
||
from biz_account
|
||
where cust_id = 67 and deleted = 0;
|
||
```
|
||
|
||
结果:
|
||
|
||
```text
|
||
biz_cust:
|
||
67 | 26041011111 | liao | 3 | 11 | 0 | 1
|
||
|
||
biz_account:
|
||
65 | 67 | null | null | 0.0000 | 0 | 0 | 1
|
||
```
|
||
|
||
结论:当前测试客户 `26041011111` 的 `biz_account.deposit` 为空,业务侧按 `0` 处理,因此退款金额 `2` 会命中“账户预存余额不足”。
|
||
|
||
## 6. 结论
|
||
|
||
本次 `prestorage-submit` 调用链路本身可达,鉴权可用,接口也已命中后端业务逻辑。
|
||
失败原因不是网关/路由/权限,而是当前测试数据不满足退款校验条件:
|
||
|
||
- 客户存在
|
||
- 账户存在
|
||
- 账户预存余额为空(按 0 处理)
|
||
- `refundAmount = 2`,因此提交失败
|
||
|
||
## 7. 后续建议
|
||
|
||
二选一:
|
||
|
||
1. 修正该测试客户的 `biz_account.deposit`,使其大于等于 `2`
|
||
2. 改用当前开发库中预存余额充足的客户进行 `prestorage-submit` 联调
|
||
|
||
附带观察:当前前端收到的是泛化后的 `系统异常`,而非后端真实业务提示 `账户预存余额不足`。如果需要提升联调效率,可后续评估是否将该类参数/业务校验异常以明确业务消息返回前端。
|