修正贷款定价敏感信息脱敏设计与计划
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
> **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:** 让贷款定价流程在后端对 `custName`、`idNum` 实现密文存储,并保证列表、详情、模型调用链路在各自边界内完成脱敏或解密。
|
||||
**Goal:** 让贷款定价流程在后端对 `custName`、`idNum` 实现密文存储,并保证列表、详情、模型输出基本信息、模型调用链路在各自边界内完成脱敏或解密。
|
||||
|
||||
**Architecture:** 后端在 `ruoyi-loan-pricing` 模块内新增贷款定价专用敏感字段加解密服务和展示脱敏服务,固定密钥从配置读取。`LoanPricingWorkflowServiceImpl` 在创建、列表、详情链路显式接入这些服务,`LoanPricingModelService` 在调模型前显式解密,避免把密文错误透传给模型。
|
||||
**Architecture:** 后端在 `ruoyi-loan-pricing` 模块内新增贷款定价专用敏感字段加解密服务和展示脱敏服务,固定密钥从配置读取。`LoanPricingWorkflowServiceImpl` 在创建、列表、详情和模型输出展示链路显式接入这些服务,`LoanPricingModelService` 在调模型前显式解密,避免把密文错误透传给模型。
|
||||
|
||||
**Tech Stack:** Spring Boot、MyBatis Plus、JUnit 5、Mockito、Maven、JDK `javax.crypto`
|
||||
|
||||
@@ -193,7 +193,7 @@ git add ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/service/impl/Loan
|
||||
git commit -m "接入流程敏感字段加密与列表脱敏"
|
||||
```
|
||||
|
||||
### Task 3: 接入详情返回与模型调用链路
|
||||
### Task 3: 接入详情返回、模型输出展示与模型调用链路
|
||||
|
||||
**Files:**
|
||||
- Modify: `ruoyi-loan-pricing/src/main/java/com/ruoyi/loanpricing/service/impl/LoanPricingWorkflowServiceImpl.java`
|
||||
@@ -202,7 +202,7 @@ git commit -m "接入流程敏感字段加密与列表脱敏"
|
||||
- Create: `ruoyi-loan-pricing/src/test/java/com/ruoyi/loanpricing/service/LoanPricingModelServiceTest.java`
|
||||
- Modify: `ruoyi-loan-pricing/src/test/java/com/ruoyi/loanpricing/service/impl/LoanPricingWorkflowServiceImplTest.java`
|
||||
|
||||
- [ ] **Step 1: 写详情与模型调用失败测试**
|
||||
- [ ] **Step 1: 写详情、模型输出展示与模型调用失败测试**
|
||||
|
||||
新增或补充以下测试场景:
|
||||
|
||||
@@ -211,6 +211,16 @@ git commit -m "接入流程敏感字段加密与列表脱敏"
|
||||
void shouldMaskCustNameAndIdNumWhenReturningWorkflowDetail() { ... }
|
||||
```
|
||||
|
||||
```java
|
||||
@Test
|
||||
void shouldMaskCustNameAndIdNumInRetailModelOutputBasicInfo() { ... }
|
||||
```
|
||||
|
||||
```java
|
||||
@Test
|
||||
void shouldMaskCustNameAndIdNumInCorporateModelOutputBasicInfo() { ... }
|
||||
```
|
||||
|
||||
```java
|
||||
@Test
|
||||
void shouldDecryptCustNameAndIdNumBeforeInvokeModel() { ... }
|
||||
@@ -221,6 +231,8 @@ void shouldDecryptCustNameAndIdNumBeforeInvokeModel() { ... }
|
||||
```java
|
||||
assertEquals("张*", result.getLoanPricingWorkflow().getCustName());
|
||||
assertEquals("1101********1234", result.getLoanPricingWorkflow().getIdNum());
|
||||
assertEquals("张*", result.getModelRetailOutputFields().getCustName());
|
||||
assertEquals("1101********1234", result.getModelRetailOutputFields().getIdNum());
|
||||
verify(modelService).invokeModel(argThat(dto ->
|
||||
Objects.equals("张三", dto.getCustName())
|
||||
&& Objects.equals("110101199001011234", dto.getIdNum())));
|
||||
@@ -229,7 +241,7 @@ verify(modelService).invokeModel(argThat(dto ->
|
||||
- [ ] **Step 2: 运行详情与模型测试确认失败**
|
||||
|
||||
Run: `mvn -pl ruoyi-loan-pricing -am -Dtest=LoanPricingWorkflowServiceImplTest,LoanPricingModelServiceTest -Dsurefire.failIfNoSpecifiedTests=false test`
|
||||
Expected: FAIL,当前详情返回未脱敏,模型调用前也未解密。
|
||||
Expected: FAIL,当前详情返回未完整脱敏,模型输出“基本信息”仍会返回明文,模型调用前也未解密。
|
||||
|
||||
- [ ] **Step 3: 在详情返回前显式解密再脱敏**
|
||||
|
||||
@@ -245,6 +257,7 @@ loanPricingWorkflow.setIdNum(loanPricingSensitiveDisplayService.maskIdNum(plainI
|
||||
要求:
|
||||
- 对外返回对象中不保留明文
|
||||
- 保持既有测算利率与执行利率逻辑不变
|
||||
- 若 `modelRetailOutputFields` 或 `modelCorpOutputFields` 非空,同样对其 `custName`、`idNum` 做脱敏替换
|
||||
|
||||
- [ ] **Step 4: 在模型调用前显式解密**
|
||||
|
||||
@@ -316,6 +329,7 @@ Run: 按项目现有方式启动后端,创建一条个人流程和一条企业
|
||||
Expected:
|
||||
- 数据库中的 `cust_name`、`id_num` 不等于前端提交明文
|
||||
- 列表和详情返回的 `custName`、`idNum` 为脱敏值
|
||||
- 模型输出“基本信息”页签中的 `custName`、`idNum` 也为脱敏值
|
||||
|
||||
- [ ] **Step 4: 如果为验证启动了后端进程,结束对应进程**
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
> **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:** 让贷款定价流程前端只按客户内码查询,并在列表页、详情页稳定展示后端返回的脱敏 `custName`、`idNum`。
|
||||
**Goal:** 让贷款定价流程前端只按客户内码查询,并在列表页、详情页、模型输出“基本信息”页签稳定展示后端返回的脱敏 `custName`、`idNum`。
|
||||
|
||||
**Architecture:** 前端不承担任何加解密逻辑,只做查询项收口与脱敏值展示消费。列表页从按 `custName` 查询切换为按 `custIsn` 查询,详情页保持现有结构,继续直接渲染后端返回字段。
|
||||
**Architecture:** 前端不承担任何加解密逻辑,只做查询项收口与脱敏值展示消费。列表页从按 `custName` 查询切换为按 `custIsn` 查询,详情页与 `ModelOutputDisplay.vue` 保持现有结构,继续直接渲染后端返回字段,但要联调确认模型输出“基本信息”页签不再出现敏感明文。
|
||||
|
||||
**Tech Stack:** Vue 2、Element UI、RuoYi 前端工程、npm
|
||||
|
||||
@@ -64,18 +64,19 @@ git add ruoyi-ui/src/views/loanPricing/workflow/index.vue ruoyi-ui/src/api/loanP
|
||||
git commit -m "调整流程列表按客户内码查询"
|
||||
```
|
||||
|
||||
### Task 2: 固化列表页与详情页的脱敏展示消费
|
||||
### Task 2: 固化列表页、详情页与模型输出基本信息的脱敏展示消费
|
||||
|
||||
**Files:**
|
||||
- Modify: `ruoyi-ui/src/views/loanPricing/workflow/index.vue`
|
||||
- Modify: `ruoyi-ui/src/views/loanPricing/workflow/detail.vue`
|
||||
- Modify: `ruoyi-ui/src/views/loanPricing/workflow/components/PersonalWorkflowDetail.vue`
|
||||
- Modify: `ruoyi-ui/src/views/loanPricing/workflow/components/CorporateWorkflowDetail.vue`
|
||||
- Inspect: `ruoyi-ui/src/views/loanPricing/workflow/components/ModelOutputDisplay.vue`
|
||||
|
||||
- [ ] **Step 1: 核对当前页面直接消费后端字段的位置**
|
||||
|
||||
Run: `rg -n 'custName|idNum' ruoyi-ui/src/views/loanPricing/workflow/index.vue ruoyi-ui/src/views/loanPricing/workflow/detail.vue ruoyi-ui/src/views/loanPricing/workflow/components/PersonalWorkflowDetail.vue ruoyi-ui/src/views/loanPricing/workflow/components/CorporateWorkflowDetail.vue`
|
||||
Expected: 能定位列表和详情页中所有 `custName`、`idNum` 的展示位置。
|
||||
Run: `rg -n 'custName|idNum' ruoyi-ui/src/views/loanPricing/workflow/index.vue ruoyi-ui/src/views/loanPricing/workflow/detail.vue ruoyi-ui/src/views/loanPricing/workflow/components/PersonalWorkflowDetail.vue ruoyi-ui/src/views/loanPricing/workflow/components/CorporateWorkflowDetail.vue ruoyi-ui/src/views/loanPricing/workflow/components/ModelOutputDisplay.vue`
|
||||
Expected: 能定位列表、详情以及模型输出“基本信息”页签中所有 `custName`、`idNum` 的展示位置。
|
||||
|
||||
- [ ] **Step 2: 去掉任何可能的前端二次处理设想,只保留直接展示**
|
||||
|
||||
@@ -90,6 +91,7 @@ Expected: 能定位列表和详情页中所有 `custName`、`idNum` 的展示位
|
||||
- 不新增“查看明文”按钮
|
||||
- 不新增复制原值功能
|
||||
- 不在前端自行做脱敏算法
|
||||
- `ModelOutputDisplay.vue` 继续直接消费后端字段,不新增本地脱敏逻辑
|
||||
|
||||
- [ ] **Step 3: 执行前端构建验证**
|
||||
|
||||
@@ -103,6 +105,8 @@ Expected:
|
||||
- 列表页客户名称显示为脱敏值
|
||||
- 个人详情页客户名称、证件号码显示为脱敏值
|
||||
- 企业详情页客户名称、证件号码显示为脱敏值
|
||||
- 个人模型输出“基本信息”页签中的客户名称、证件号码显示为脱敏值
|
||||
- 企业模型输出“基本信息”页签中的客户名称、证件号码显示为脱敏值
|
||||
|
||||
- [ ] **Step 5: 如果为验证启动了前端进程,结束对应进程**
|
||||
|
||||
@@ -129,6 +133,7 @@ git commit -m "接入流程敏感字段前端脱敏展示"
|
||||
- 流程列表页查询项已从客户名称切换为客户内码
|
||||
- 前端不承担 `custName`、`idNum` 加解密逻辑
|
||||
- 列表页与详情页均直接展示后端返回的脱敏值
|
||||
- 模型输出“基本信息”页签也直接展示后端返回的脱敏值
|
||||
- 已完成前端构建验证与页面联调
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user