# 上虞个人利率测算输入参数对齐实施记录

## 实施时间
- 2026-04-09

## 修改内容
- 个人新增弹窗补齐 `loanPurpose`、`loanTerm`
- 个人新增弹窗 `loanTerm` 固定为 `1-6` 年
- 个人新增弹窗 `collType` 选项统一为 `一类/二类/三类`
- 个人新增弹窗开关字段提交值由 `true/false` 调整为 `1/0`
- 个人详情页补齐 `贷款用途` 展示
- 个人与企业详情、模型输出布尔展示兼容 `1/0`
- 后端个人创建 DTO 补齐 `loanPurpose`、`loanTerm`
- 后端个人 DTO 到流程实体映射补齐 `loanPurpose`、`loanTerm`
- 后端模型调用 DTO 补齐 `loanTerm`、`loanLoop`
- 后端个人模型调用前统一将 `bizProof`、`loanLoop`、`collThirdParty` 规范为 `0/1`
- `orgCode` 统一为 `892000`
- `ModelInvokeDTO` 注释、接口文档、SQL 基线和迁移脚本同步统一为 `892000`
- 新增前端源码断言与后端单元测试

## 修改文件
- `ruoyi-ui/src/views/loanPricing/workflow/components/PersonalCreateDialog.vue`
- `ruoyi-ui/src/views/loanPricing/workflow/components/PersonalWorkflowDetail.vue`
- `ruoyi-ui/src/views/loanPricing/workflow/components/ModelOutputDisplay.vue`
- `ruoyi-ui/src/views/loanPricing/workflow/components/CorporateWorkflowDetail.vue`
- `ruoyi-ui/src/views/loanPricing/workflow/components/CorporateCreateDialog.vue`
- `ruoyi-ui/tests/personal-create-input-params.test.js`
- `ruoyi-ui/package.json`
- `ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/domain/dto/PersonalLoanPricingCreateDTO.java`
- `ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/domain/dto/ModelInvokeDTO.java`
- `ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/util/LoanPricingConverter.java`
- `ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/service/LoanPricingModelService.java`
- `ruoyi-loan-pricing/src/test/java/com/ruoyi/loanpricing/service/LoanPricingModelServicePersonalParamsTest.java`
- `doc/api/loan-pricing-workflow-api.md`
- `sql/loan_pricing_workflow.sql`
- `sql/loan_pricing_schema_20260328.sql`
- `sql/loan_pricing_prod_init_20260331.sql`
- `sql/fix_comments.sql`
- `sql/fix_all_comments.sql`
- `sql/update_org_code_default_20260409.sql`
- `doc/2026-04-09-shangyu-retail-input-params-design.md`
- `doc/2026-04-09-shangyu-retail-input-params-frontend-plan.md`
- `doc/implementation-report-2026-04-09-shangyu-retail-input-params.md`

## 数据库处理
1. 执行 `sql/update_org_code_default_20260409.sql`
2. 将 `loan_pricing_workflow.org_code` 默认值修改为 `892000`
3. 将存量 `loan_pricing_workflow.org_code` 非 `892000` 的记录统一更新为 `892000`

## 验证方式
1. 前端源码断言：
   - `npm --prefix ruoyi-ui run test:personal-create-input-params`
   - `npm --prefix ruoyi-ui run test:retail-display-fields`
2. 后端单元测试：
   - `mvn -pl ruoyi-loan-pricing -Dtest=LoanPricingModelServiceTest,LoanPricingModelServicePersonalParamsTest test`
3. 前端构建：
   - `npm --prefix ruoyi-ui run build:prod`
4. 数据库验证：
   - 查询 `loan_pricing_workflow.org_code` 字段默认值
   - 查询存量数据中是否仍存在非 `892000` 记录
5. 接口验证：
   - `/login/test` 获取 token
   - `POST /loanPricing/workflow/create/personal` 正常场景
   - `POST /loanPricing/workflow/create/personal` 缺少 `loanPurpose` 场景
   - `POST /loanPricing/workflow/create/personal` 分支值场景
   - `GET /loanPricing/workflow/{serialNum}` 验证回显
6. 页面验证：
   - 启动前端 dev server
   - 使用浏览器打开流程列表页
   - 校验新增弹窗下拉选项
   - 页面创建个人流程并打开详情页确认回显

## 验证结果
- `npm --prefix ruoyi-ui run test:personal-create-input-params` 通过
- `npm --prefix ruoyi-ui run test:retail-display-fields` 通过
- `mvn -pl ruoyi-loan-pricing -Dtest=LoanPricingModelServiceTest,LoanPricingModelServicePersonalParamsTest test` 通过
- `npm --prefix ruoyi-ui run build:prod` 通过，输出 `Build complete.`
- 数据库验证结果：
  - `loan_pricing_workflow.org_code` 默认值为 `892000`
  - 存量非 `892000` 记录数为 `0`
- 接口验证结果：
  - 正常场景创建成功，返回 `orgCode=892000`，并持久化 `loanPurpose`、`loanTerm`
  - 缺少 `loanPurpose` 时返回 `贷款用途不能为空`
  - 分支场景详情回显 `bizProof=0`、`loanLoop=1`、`collThirdParty=0`
- 页面验证结果：
  - 新增弹窗显示 `贷款用途`
  - 借款期限下拉仅包含 `1-6`
  - 抵质押类型下拉为 `一类/二类/三类`
  - 页面创建流程成功后，详情页展示 `贷款用途=经营`、`借款期限=6`

## 说明
- 浏览器验证使用系统 `Google Chrome.app`
- 本次验证期间启动的后端、前端和浏览器进程已在任务结束前关闭
