Files
loan-pricing/doc/implementation-report-2026-04-29-customer-map-selection.md

61 lines
6.7 KiB
Markdown

# 2026-04-29 客户号查询选择客户内码实施记录
## 修改内容
- 后端新增个人/企业客户号映射业务接口:
- `GET /loanPricing/workflow/customer-map/personal?custId=...`
- `GET /loanPricing/workflow/customer-map/corporate?custId=...`
- 后端新增个人/企业客户号映射 mock 接口:
- `GET /rate/pricing/mock/customer-map/personal?cust_id=...`
- `GET /rate/pricing/mock/customer-map/corporate?cust_id=...`
- 配置文件新增 `customer-map` 个人/企业地址,并在 `dev``uat``pro` profile 中统一指向本项目 mock。
- 前端新增客户号查询选择弹窗。
- 客户号查询选择弹窗宽度调整为窗口宽度的 `80%`
- 客户号查询输入值在查询前去除前后空格;后端转发个人/企业客户号映射接口前同步去除前后空格,并对下游 `cust_id` 查询参数做 URI 编码,避免尾随空格进入 request target 触发 TongWeb `HTTP Status 400`
- 选中客户号查询结果后,返回参数 `cust_id` 去除前三位后自动回填到新增弹窗基础信息的 `证件号码` 字段。
- 个人/企业新增流程改为先查询客户号、选择客户内码,再打开新增弹窗。
- 新增弹窗客户内码和客户名称由选中记录自动带入并只读。
## 验证结果
- 后端针对性测试:通过。
- 命令:`mvn -pl ruoyi-loan-pricing -am -Dtest=CustomerMapRecordVOTest,LoanPricingCustomerMapServiceTest,LoanRatePricingMockControllerCustomerMapTest,LoanPricingWorkflowControllerCustomerMapTest -Dsurefire.failIfNoSpecifiedTests=false test`
- 结果:`Tests run: 8, Failures: 0, Errors: 0, Skipped: 0`
- 客户号空格 400 修复补充测试:通过。
- 命令:`mvn -pl ruoyi-loan-pricing -am -Dtest=LoanPricingCustomerMapServiceTest,LoanRatePricingMockControllerCustomerMapTest -Dsurefire.failIfNoSpecifiedTests=false test`
- 结果:`Tests run: 6, Failures: 0, Errors: 0, Skipped: 0`
- 后端打包与启动验证:通过。
- 命令:`mvn -pl ruoyi-admin -am -DskipTests package`
- 命令:`java -jar ruoyi-admin/target/ruoyi-admin.jar --spring.profiles.active=dev`
- 结果:后端以 `dev` profile 启动成功,端口 `63310` 可用。
- 接口验证:通过。
- `GET /rate/pricing/mock/customer-map/personal?cust_id=P001` 返回随机个人客户映射列表,字段为 `cust_id``cust_isn``cust_name``faith_day``balance_avg``loan_count_his``last_loan_date`
- `GET /rate/pricing/mock/customer-map/corporate?cust_id=C001` 返回随机企业客户映射列表,字段同上。
- `GET /rate/pricing/mock/customer-map/personal?cust_id=` 返回 `客户号不能为空`
- 登录后调用 `GET /loanPricing/workflow/customer-map/personal?custId=P001``GET /loanPricing/workflow/customer-map/corporate?custId=C001` 均返回对应映射列表。
- 登录后调用 `GET /loanPricing/workflow/customer-map/personal?custId=` 返回 `客户号不能为空`
- 补充验证:以最新后端临时端口 `63311` 调用 `GET /loanPricing/workflow/customer-map/personal?custId=1w0xc20xb7%20` 返回 `code=200`,返回 `cust_id``1w0xc20xb7`;调用 `GET /loanPricing/workflow/customer-map/corporate?custId=C001%20` 返回 `code=200`,返回 `cust_id``C001`;调用 `GET /loanPricing/workflow/customer-map/personal?custId=%20` 返回 `客户号不能为空`
- 前端针对性测试:通过。
- 命令:`zsh -lic 'nvm use 14.21.3 >/dev/null && node ruoyi-ui/tests/customer-map-selection.test.js && npm --prefix ruoyi-ui run test:personal-create-input-params && npm --prefix ruoyi-ui run test:corporate-create-input-params && node ruoyi-ui/tests/workflow-index-refresh.test.js'`
- 结果:`customer map selection assertions passed``personal create input params assertions passed``corporate create input params assertions passed``workflow-index-refresh test passed`
- 补充命令:`zsh -lic 'nvm use 14.21.3 >/dev/null && node ruoyi-ui/tests/customer-map-selection.test.js'`
- 补充结果:`customer map selection assertions passed`,覆盖客户号去前三位回填证件号码断言。
- 补充回归命令:`zsh -lic 'nvm use 14.21.3 >/dev/null && node ruoyi-ui/tests/customer-map-selection.test.js && npm --prefix ruoyi-ui run test:personal-create-input-params && npm --prefix ruoyi-ui run test:corporate-create-input-params && node ruoyi-ui/tests/id-number-validation-removal.test.js'`
- 补充回归结果:`customer map selection assertions passed``personal create input params assertions passed``corporate create input params assertions passed``id number validation removal assertions passed`
- 前端生产构建:通过。
- 命令:`zsh -lic 'nvm use 14.21.3 >/dev/null && npm --prefix ruoyi-ui run build:prod'`
- 结果:构建成功;输出 2 个既有体积 warning。
- 真实页面验证:通过。
- 启动前端 `http://localhost:18080/`,登录后进入真实页面 `http://localhost:18080/loanPricing/workflow`
- 个人客户:点击 `新增` -> `个人客户` -> 客户号查询输入 `PTEST003` -> 返回多条客户映射 -> 选择首行 -> 打开 `新增个人利率定价流程`,客户内码自动带入 `81000450472`,客户名称自动带入 `个人客户1`,两个字段均为 `readonly`
- 企业客户:点击 `新增` -> `企业客户` -> 客户号查询输入 `CTEST001` -> 返回多条客户映射 -> 选择首行 -> 打开 `新增企业利率定价流程`,客户内码自动带入 `81000448819`,客户名称自动带入 `企业客户1`,两个字段均为 `readonly`
- 弹窗宽度补充验证:点击 `新增` -> `个人客户` 后,`客户号查询` 弹窗 DOM 样式为 `margin-top: 15vh; width: 80%;`
- 客户号空格补充验证:点击 `新增` -> `个人客户`,客户号输入 `1w0xc20xb7 ` 后查询,输入框显示为 `1w0xc20xb7`,列表正常返回客户映射,页面未出现 `400``Bad Request`
- 客户号到证件号码补充验证:点击 `新增` -> `个人客户`,客户号输入 `ABC123456789` 并选择返回行后,新增个人弹窗基础信息的 `证件号码` 自动填入 `123456789`
- 页面验证仅验证查询选择与自动回填链路,未提交新增表单,避免写入额外流程测试数据。
- 回归补充说明:
- `LoanPricingModelServiceTest` 已通过。
- 组合回归命令包含 `LoanPricingWorkflowServiceImplTest` 时,当前本机 Oracle JDK 21 环境下 Mockito inline/Byte Buddy self-attach 失败,属于既有测试环境限制,不是本次客户号映射功能断言失败。
- 进程清理:已关闭本次启动的后端和前端进程。
- 本次宽度与客户号空格补充验证结束后,`18080``63311` 无监听;`63310` 为验证前已存在的后端进程,未处理。