补充测算利率列表前后端实施计划
This commit is contained in:
215
doc/2026-03-28-workflow-calculate-rate-list-backend-plan.md
Normal file
215
doc/2026-03-28-workflow-calculate-rate-list-backend-plan.md
Normal file
@@ -0,0 +1,215 @@
|
||||
# 流程列表测算利率展示后端实施计划
|
||||
|
||||
> **For agentic workers:** REQUIRED: Use superpowers:executing-plans to implement this plan in this repository. Do not use subagents. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** 让流程列表接口通过联表 SQL 一次返回测算利率 `calculateRate` 和执行利率 `executeRate`。
|
||||
|
||||
**Architecture:** 后端为流程列表新增列表专用返回对象,替换当前直接返回 `LoanPricingWorkflow` 实体分页的方式。Mapper 层新增联表 SQL,以 `loan_pricing_workflow` 为主表,左连接个人和企业模型输出表,并统一产出 `calculateRate` 字段供前端直接消费。
|
||||
|
||||
**Tech Stack:** Spring Boot、MyBatis Plus、Lombok、Maven、XML Mapper
|
||||
|
||||
---
|
||||
|
||||
### Task 1: 建立流程列表专用返回对象
|
||||
|
||||
**Files:**
|
||||
- Create: `ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/domain/vo/LoanPricingWorkflowListVO.java`
|
||||
- Modify: `ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/service/ILoanPricingWorkflowService.java`
|
||||
- Modify: `ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/controller/LoanPricingWorkflowController.java`
|
||||
|
||||
- [ ] **Step 1: 写一个失败测试,约束列表返回对象需要包含测算利率**
|
||||
|
||||
Create/Test: `ruoyi-loan-pricing/src/test/java/com/ruoyi/loanpricing/domain/vo/LoanPricingWorkflowListVOTest.java`
|
||||
|
||||
测试示例:
|
||||
|
||||
```java
|
||||
@Test
|
||||
void shouldExposeCalculateRateAndExecuteRateFields() throws Exception {
|
||||
LoanPricingWorkflowListVO vo = new LoanPricingWorkflowListVO();
|
||||
vo.setCalculateRate("6.15");
|
||||
vo.setExecuteRate("5.80");
|
||||
|
||||
assertEquals("6.15", vo.getCalculateRate());
|
||||
assertEquals("5.80", vo.getExecuteRate());
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 运行测试确认在对象未创建前失败**
|
||||
|
||||
Run: `mvn -pl ruoyi-loan-pricing -Dtest=LoanPricingWorkflowListVOTest test`
|
||||
Expected: FAIL,提示 `LoanPricingWorkflowListVO` 不存在或缺少字段。
|
||||
|
||||
- [ ] **Step 3: 新增列表专用 VO**
|
||||
|
||||
创建 `LoanPricingWorkflowListVO`,至少包含:
|
||||
|
||||
```java
|
||||
private String serialNum;
|
||||
private String custName;
|
||||
private String custType;
|
||||
private String guarType;
|
||||
private String applyAmt;
|
||||
private String calculateRate;
|
||||
private String executeRate;
|
||||
private Date createTime;
|
||||
private String createBy;
|
||||
```
|
||||
|
||||
- [ ] **Step 4: 修改 Service 接口与 Controller 返回类型**
|
||||
|
||||
将列表分页返回从:
|
||||
|
||||
```java
|
||||
IPage<LoanPricingWorkflow>
|
||||
```
|
||||
|
||||
调整为:
|
||||
|
||||
```java
|
||||
IPage<LoanPricingWorkflowListVO>
|
||||
```
|
||||
|
||||
并同步更新 Controller 列表接口使用的新分页结果类型。
|
||||
|
||||
- [ ] **Step 5: 再次运行测试确认返回对象字段已可用**
|
||||
|
||||
Run: `mvn -pl ruoyi-loan-pricing -Dtest=LoanPricingWorkflowListVOTest test`
|
||||
Expected: PASS
|
||||
|
||||
- [ ] **Step 6: 提交这一小步**
|
||||
|
||||
Run: `git add ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/domain/vo/LoanPricingWorkflowListVO.java ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/service/ILoanPricingWorkflowService.java ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/controller/LoanPricingWorkflowController.java ruoyi-loan-pricing/src/test/java/com/ruoyi/loanpricing/domain/vo/LoanPricingWorkflowListVOTest.java && git commit -m "新增流程列表测算利率返回对象"`
|
||||
Expected: 生成仅包含 VO 与接口调整的中文提交。
|
||||
|
||||
### Task 2: 新增联表 SQL 返回统一测算利率
|
||||
|
||||
**Files:**
|
||||
- Modify: `ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/mapper/LoanPricingWorkflowMapper.java`
|
||||
- Create: `ruoyi-loan-pricing/src/main/resources/mapper/loanpricing/LoanPricingWorkflowMapper.xml`
|
||||
- Modify: `ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/service/impl/LoanPricingWorkflowServiceImpl.java`
|
||||
- Test: `ruoyi-loan-pricing/src/test/java/com/ruoyi/loanpricing/service/impl/LoanPricingWorkflowServiceImplTest.java`
|
||||
|
||||
- [ ] **Step 1: 写一个失败测试,约束服务层返回的列表对象要透传 `calculateRate`**
|
||||
|
||||
Create/Test: `ruoyi-loan-pricing/src/test/java/com/ruoyi/loanpricing/service/impl/LoanPricingWorkflowServiceImplTest.java`
|
||||
|
||||
测试示例:
|
||||
|
||||
```java
|
||||
@Test
|
||||
void shouldReturnPagedWorkflowListWithCalculateRate() {
|
||||
Page<LoanPricingWorkflowListVO> page = new Page<>(1, 10);
|
||||
LoanPricingWorkflow query = new LoanPricingWorkflow();
|
||||
LoanPricingWorkflowListVO row = new LoanPricingWorkflowListVO();
|
||||
row.setCalculateRate("6.15");
|
||||
|
||||
when(loanPricingWorkflowMapper.selectWorkflowPageWithRates(any(), any())).thenReturn(new Page<LoanPricingWorkflowListVO>().setRecords(List.of(row)));
|
||||
|
||||
IPage<LoanPricingWorkflowListVO> result = service.selectLoanPricingPage(page, query);
|
||||
|
||||
assertEquals("6.15", result.getRecords().get(0).getCalculateRate());
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 运行测试确认在方法未接入前失败**
|
||||
|
||||
Run: `mvn -pl ruoyi-loan-pricing -Dtest=LoanPricingWorkflowServiceImplTest test`
|
||||
Expected: FAIL,提示方法签名不匹配或 Mapper 自定义方法不存在。
|
||||
|
||||
- [ ] **Step 3: 在 Mapper 接口声明列表专用分页方法**
|
||||
|
||||
在 `LoanPricingWorkflowMapper` 中新增类似方法:
|
||||
|
||||
```java
|
||||
IPage<LoanPricingWorkflowListVO> selectWorkflowPageWithRates(
|
||||
Page<LoanPricingWorkflowListVO> page,
|
||||
@Param("query") LoanPricingWorkflow query);
|
||||
```
|
||||
|
||||
- [ ] **Step 4: 在 XML 中实现联表 SQL**
|
||||
|
||||
创建 `LoanPricingWorkflowMapper.xml`,编写列表专用查询,关键逻辑至少包含:
|
||||
|
||||
```xml
|
||||
SELECT
|
||||
lpw.serial_num AS serialNum,
|
||||
lpw.cust_name AS custName,
|
||||
lpw.cust_type AS custType,
|
||||
lpw.guar_type AS guarType,
|
||||
lpw.apply_amt AS applyAmt,
|
||||
CASE
|
||||
WHEN lpw.cust_type = '个人' THEN mr.calculate_rate
|
||||
WHEN lpw.cust_type = '企业' THEN mc.calculate_rate
|
||||
ELSE NULL
|
||||
END AS calculateRate,
|
||||
lpw.execute_rate AS executeRate,
|
||||
lpw.create_time AS createTime,
|
||||
lpw.create_by AS createBy
|
||||
FROM loan_pricing_workflow lpw
|
||||
LEFT JOIN model_retail_output_fields mr ON lpw.model_output_id = mr.id
|
||||
LEFT JOIN model_corp_output_fields mc ON lpw.model_output_id = mc.id
|
||||
```
|
||||
|
||||
并保留当前筛选条件和按更新时间倒序。
|
||||
|
||||
- [ ] **Step 5: 在 ServiceImpl 中改为调用联表分页方法**
|
||||
|
||||
将列表分页实现从:
|
||||
|
||||
```java
|
||||
return loanPricingWorkflowMapper.selectPage(page, wrapper);
|
||||
```
|
||||
|
||||
切换为调用新的 Mapper 联表分页方法,保留查询参数透传。
|
||||
|
||||
- [ ] **Step 6: 运行服务层测试确认通过**
|
||||
|
||||
Run: `mvn -pl ruoyi-loan-pricing -Dtest=LoanPricingWorkflowServiceImplTest test`
|
||||
Expected: PASS
|
||||
|
||||
- [ ] **Step 7: 如需补充 XML 级验证,再运行模块测试**
|
||||
|
||||
Run: `mvn -pl ruoyi-loan-pricing test`
|
||||
Expected: 至少本次新增测试通过;若存在其他失败,需先区分是否为既有问题。
|
||||
|
||||
- [ ] **Step 8: 提交这一小步**
|
||||
|
||||
Run: `git add ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/mapper/LoanPricingWorkflowMapper.java ruoyi-loan-pricing/src/main/resources/mapper/loanpricing/LoanPricingWorkflowMapper.xml ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/service/impl/LoanPricingWorkflowServiceImpl.java ruoyi-loan-pricing/src/test/java/com/ruoyi/loanpricing/service/impl/LoanPricingWorkflowServiceImplTest.java && git commit -m "新增流程列表测算利率联表查询"`
|
||||
Expected: 生成包含联表 SQL 与服务切换的中文提交。
|
||||
|
||||
### Task 3: 完成后端留档与接口验证
|
||||
|
||||
**Files:**
|
||||
- Create: `doc/implementation-report-2026-03-28-workflow-calculate-rate-list-backend.md`
|
||||
|
||||
- [ ] **Step 1: 补充后端实施记录**
|
||||
|
||||
实施记录至少写明:
|
||||
|
||||
```markdown
|
||||
- 列表接口返回类型已调整为列表专用 VO
|
||||
- 后端通过联表 SQL 一次返回 `calculateRate` 与 `executeRate`
|
||||
- 个人客户测算利率来自 `model_retail_output_fields.calculate_rate`
|
||||
- 企业客户测算利率来自 `model_corp_output_fields.calculate_rate`
|
||||
```
|
||||
|
||||
- [ ] **Step 2: 验证列表接口返回结构**
|
||||
|
||||
Run: 按项目现有方式启动后端后,请求 `/loanPricing/workflow/list`
|
||||
Expected: 返回行数据中包含 `calculateRate` 和 `executeRate`。
|
||||
|
||||
- [ ] **Step 3: 核对个人和企业记录的测算利率来源**
|
||||
|
||||
Run: 使用已有测试数据各抽取一条个人和企业记录,对比接口返回与模型输出表数据。
|
||||
Expected: 个人记录取自零售模型输出表,企业记录取自对公模型输出表。
|
||||
|
||||
- [ ] **Step 4: 如果为验证启动了后端进程,结束对应进程**
|
||||
|
||||
Run: `ps -ef | rg 'RuoYiApplication|java'`
|
||||
Expected: 对本次验证启动的后端进程执行停止;对非本次启动进程不做处理。
|
||||
|
||||
- [ ] **Step 5: 提交后端实施记录**
|
||||
|
||||
Run: `git add doc/implementation-report-2026-03-28-workflow-calculate-rate-list-backend.md && git commit -m "补充测算利率列表后端实施记录"`
|
||||
Expected: 生成仅包含后端留档内容的中文提交。
|
||||
95
doc/2026-03-28-workflow-calculate-rate-list-frontend-plan.md
Normal file
95
doc/2026-03-28-workflow-calculate-rate-list-frontend-plan.md
Normal file
@@ -0,0 +1,95 @@
|
||||
# 流程列表测算利率展示前端实施计划
|
||||
|
||||
> **For agentic workers:** REQUIRED: Use superpowers:executing-plans to implement this plan in this repository. Do not use subagents. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||
|
||||
**Goal:** 在流程列表页新增“测算利率(%)”列,并与“执行利率(%)”同时展示。
|
||||
|
||||
**Architecture:** 前端只消费后端列表接口新增返回的 `calculateRate` 字段,不在页面自行判断客户类型或拼接数据来源。页面层仅新增一列并保持现有查询、查看详情和执行利率展示逻辑不变。
|
||||
|
||||
**Tech Stack:** Vue 2、Element UI、RuoYi 前端工程、npm
|
||||
|
||||
---
|
||||
|
||||
### Task 1: 为流程列表页新增测算利率列
|
||||
|
||||
**Files:**
|
||||
- Modify: `ruoyi-ui/src/views/loanPricing/workflow/index.vue`
|
||||
- Test: 手工页面验证流程列表页
|
||||
|
||||
- [ ] **Step 1: 查看当前流程列表页列顺序**
|
||||
|
||||
Run: `sed -n '45,70p' ruoyi-ui/src/views/loanPricing/workflow/index.vue`
|
||||
Expected: 能看到当前表格列中已有“执行利率(%)”列,且其前面还没有“测算利率(%)”列。
|
||||
|
||||
- [ ] **Step 2: 在“执行利率(%)”前新增“测算利率(%)”列**
|
||||
|
||||
将列表表格中的利率区域调整为如下结构:
|
||||
|
||||
```vue
|
||||
<el-table-column label="申请金额(元)" align="center" prop="applyAmt" width="120" />
|
||||
<el-table-column label="测算利率(%)" align="center" prop="calculateRate" width="100" />
|
||||
<el-table-column label="执行利率(%)" align="center" prop="executeRate" width="100" />
|
||||
```
|
||||
|
||||
- [ ] **Step 3: 重新检查源码确认新增列位置和字段绑定**
|
||||
|
||||
Run: `rg -n '测算利率\\(%\\)|执行利率\\(%\\)|prop=\"calculateRate\"|prop=\"executeRate\"' ruoyi-ui/src/views/loanPricing/workflow/index.vue`
|
||||
Expected: 能看到“测算利率(%)”列存在,且位于“执行利率(%)”之前,并绑定 `calculateRate`。
|
||||
|
||||
- [ ] **Step 4: 执行前端构建验证**
|
||||
|
||||
Run: `npm --prefix ruoyi-ui run build:prod`
|
||||
Expected: 构建成功,输出包含 `Build complete.`
|
||||
|
||||
- [ ] **Step 5: 补充本次前端实施记录**
|
||||
|
||||
新增实施记录文件:`doc/implementation-report-2026-03-28-workflow-calculate-rate-list-frontend.md`
|
||||
|
||||
至少写明:
|
||||
|
||||
```markdown
|
||||
- 流程列表页新增“测算利率(%)”列
|
||||
- 新增列绑定后端返回字段 `calculateRate`
|
||||
- “执行利率(%)”列保持 `executeRate` 不变
|
||||
- 已完成前端构建验证
|
||||
```
|
||||
|
||||
- [ ] **Step 6: 如果为验证启动了前端进程,结束对应进程**
|
||||
|
||||
Run: `ps -ef | rg 'ruoyi-ui|vue-cli-service'`
|
||||
Expected: 如果本次任务为验证启动了新的前端进程,验证结束后主动停止;对非本次启动的现有进程不做处理。
|
||||
|
||||
- [ ] **Step 7: 提交前端改动**
|
||||
|
||||
Run: `git add ruoyi-ui/src/views/loanPricing/workflow/index.vue doc/implementation-report-2026-03-28-workflow-calculate-rate-list-frontend.md && git commit -m "新增流程列表测算利率前端展示"`
|
||||
Expected: 生成仅包含本次前端改动的中文提交。
|
||||
|
||||
### Task 2: 页面联调确认双利率展示
|
||||
|
||||
**Files:**
|
||||
- Modify: `doc/implementation-report-2026-03-28-workflow-calculate-rate-list-frontend.md`
|
||||
|
||||
- [ ] **Step 1: 打开流程列表页确认页面可正常加载**
|
||||
|
||||
Run: 按项目现有方式启动前端并进入贷款定价流程列表页。
|
||||
Expected: 页面正常渲染,表格可展示列表数据。
|
||||
|
||||
- [ ] **Step 2: 验证“测算利率(%)”和“执行利率(%)”同时展示**
|
||||
|
||||
Run: 在页面上核对至少一条记录的两列展示值。
|
||||
Expected: “测算利率(%)”展示后端返回的 `calculateRate`,“执行利率(%)”继续展示 `executeRate`。
|
||||
|
||||
- [ ] **Step 3: 将联调结果写入前端实施记录**
|
||||
|
||||
将以下结果写入实施记录:
|
||||
|
||||
```markdown
|
||||
- 已确认流程列表页新增“测算利率(%)”列
|
||||
- 已确认“测算利率(%)”列位于“执行利率(%)”列之前
|
||||
- 已确认双利率字段可同时展示
|
||||
```
|
||||
|
||||
- [ ] **Step 4: 停止联调过程中启动的前端进程**
|
||||
|
||||
Run: `ps -ef | rg 'ruoyi-ui|vue-cli-service'`
|
||||
Expected: 若存在本次联调启动的进程,全部停止后再结束任务。
|
||||
@@ -0,0 +1,25 @@
|
||||
# 流程列表测算利率展示实施计划产出记录
|
||||
|
||||
## 实施时间
|
||||
- 2026-03-28
|
||||
|
||||
## 修改内容
|
||||
- 基于设计文档补充前端实施计划
|
||||
- 基于设计文档补充后端实施计划
|
||||
- 明确本次需求采用联表 SQL 方案,一次返回流程列表测算利率与执行利率
|
||||
|
||||
## 文档路径
|
||||
- `doc/2026-03-28-workflow-calculate-rate-list-design.md`
|
||||
- `doc/2026-03-28-workflow-calculate-rate-list-frontend-plan.md`
|
||||
- `doc/2026-03-28-workflow-calculate-rate-list-backend-plan.md`
|
||||
- `doc/implementation-report-2026-03-28-workflow-calculate-rate-list-plans.md`
|
||||
|
||||
## 计划结论
|
||||
- 前端计划只修改流程列表页 `ruoyi-ui/src/views/loanPricing/workflow/index.vue`
|
||||
- 前端新增“测算利率(%)”列,绑定后端返回字段 `calculateRate`
|
||||
- 后端计划新增列表专用 VO 与 Mapper XML,使用联表 SQL 一次返回 `calculateRate` 和 `executeRate`
|
||||
- 两份计划都要求验证结束后关闭本次任务启动的前后端进程
|
||||
|
||||
## 说明
|
||||
- 按仓库要求,设计文档和实施计划均保存在 `doc` 目录
|
||||
- 仓库约束禁止启用 subagent,因此本次未执行基于 subagent 的计划文档复审流程
|
||||
Reference in New Issue
Block a user