# Results Overview Hit Tag Model Color Backend Implementation Plan

> **For agentic workers:** REQUIRED: Use superpowers:subagent-driven-development (if subagents available) or superpowers:executing-plans to implement this plan. Steps use checkbox (`- [ ]`) syntax for tracking.

**Goal:** 为项目总览页“核心异常点”和“异常标签”补充标签所属模型字段，支撑前端按选中模型高亮标签颜色。

**Architecture:** 保持现有结果总览接口与查询入口不变，仅在标签 VO、Mapper XML 和服务映射链路中补充 `modelCode`、`modelName` 字段。风险人员总览、命中模型涉及人员、流水详情统一复用同一模型归属信息，不新增兼容接口、不改动统计口径。

**Tech Stack:** Java 21, Spring Boot 3, MyBatis XML, Maven, JUnit 5, Mockito

---

### Task 1: 先锁定后端标签模型字段契约

**Files:**
- Modify: `ccdi-project/src/test/java/com/ruoyi/ccdi/project/service/impl/CcdiProjectOverviewServiceImplTest.java`
- Modify: `ccdi-project/src/test/java/com/ruoyi/ccdi/project/controller/CcdiProjectOverviewControllerTest.java`
- Modify: `ccdi-project/src/test/java/com/ruoyi/ccdi/project/mapper/CcdiProjectOverviewMapperRiskModelPeopleTest.java`

- [ ] **Step 1: Write the failing test**

补充断言，锁定以下预期：

- 风险模型人员列表返回的 `hitTagList` 项包含 `modelCode`
- 风险人员总览返回的核心异常点标签项包含模型字段
- Mapper XML 的标签查询明确从 JSON 中提取 `modelCode`、`modelName`

- [ ] **Step 2: Run test to verify it fails**

Run:

```bash
mvn test -pl ccdi-project -Dtest=CcdiProjectOverviewServiceImplTest,CcdiProjectOverviewControllerTest,CcdiProjectOverviewMapperRiskModelPeopleTest
```

Expected:

- `FAIL`
- 原因是当前标签 VO 与 SQL 尚未暴露模型字段

- [ ] **Step 3: Commit the test expectation update**

```bash
git add ccdi-project/src/test/java/com/ruoyi/ccdi/project/service/impl/CcdiProjectOverviewServiceImplTest.java ccdi-project/src/test/java/com/ruoyi/ccdi/project/controller/CcdiProjectOverviewControllerTest.java ccdi-project/src/test/java/com/ruoyi/ccdi/project/mapper/CcdiProjectOverviewMapperRiskModelPeopleTest.java
git commit -m "锁定结果总览标签模型字段测试"
```

### Task 2: 扩展标签 VO 与 Mapper 提取字段

**Files:**
- Modify: `ccdi-project/src/main/java/com/ruoyi/ccdi/project/domain/vo/CcdiProjectRiskHitTagVO.java`
- Modify: `ccdi-project/src/main/java/com/ruoyi/ccdi/project/domain/vo/CcdiBankStatementHitTagVO.java`
- Modify: `ccdi-project/src/main/resources/mapper/ccdi/project/CcdiProjectOverviewMapper.xml`

- [ ] **Step 1: Extend the tag VOs**

为两个标签 VO 均新增：

- `private String modelCode;`
- `private String modelName;`

不要新增无关字段，也不要调整现有字段命名。

- [ ] **Step 2: Update tag SQL extraction**

在 `CcdiProjectOverviewMapper.xml` 中：

- `selectRiskHitTagsByScope` 增加 `model_code`、`model_name`
- 风险人员总览核心异常点对应查询同步返回模型字段
- 保持现有按 `selectedModelCodes` 过滤逻辑不变

- [ ] **Step 3: Run focused backend tests**

Run:

```bash
mvn test -pl ccdi-project -Dtest=CcdiProjectOverviewServiceImplTest,CcdiProjectOverviewMapperRiskModelPeopleTest
```

Expected:

- `PASS`

- [ ] **Step 4: Review interface boundary**

人工确认：

- 未新增接口路径
- 未修改查询入参
- 未变更风险等级与人数统计逻辑

- [ ] **Step 5: Commit**

```bash
git add ccdi-project/src/main/java/com/ruoyi/ccdi/project/domain/vo/CcdiProjectRiskHitTagVO.java ccdi-project/src/main/java/com/ruoyi/ccdi/project/domain/vo/CcdiBankStatementHitTagVO.java ccdi-project/src/main/resources/mapper/ccdi/project/CcdiProjectOverviewMapper.xml
git commit -m "补充结果总览标签模型字段"
```

### Task 3: 回归验证后端结果总览链路

**Files:**
- Verify: `ccdi-project/src/test/java/com/ruoyi/ccdi/project/controller/CcdiProjectOverviewControllerTest.java`
- Verify: `ccdi-project/src/test/java/com/ruoyi/ccdi/project/mapper/CcdiProjectOverviewMapperSqlTest.java`
- Verify: `ccdi-project/src/test/java/com/ruoyi/ccdi/project/service/CcdiProjectOverviewServiceStructureTest.java`

- [ ] **Step 1: Run backend regression checks**

Run:

```bash
mvn test -pl ccdi-project -Dtest=CcdiProjectOverviewControllerTest,CcdiProjectOverviewMapperSqlTest,CcdiProjectOverviewServiceStructureTest
```

Expected:

- `PASS`
- 证明结果总览接口边界、SQL 结构和服务接口未被破坏

- [ ] **Step 2: Commit**

```bash
git add ccdi-project/src/test/java/com/ruoyi/ccdi/project/controller/CcdiProjectOverviewControllerTest.java ccdi-project/src/test/java/com/ruoyi/ccdi/project/mapper/CcdiProjectOverviewMapperSqlTest.java ccdi-project/src/test/java/com/ruoyi/ccdi/project/service/CcdiProjectOverviewServiceStructureTest.java
git commit -m "回归验证结果总览标签模型字段后端改动"
```
