# Risk People Overview Risk Point 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:** 保持现有风险人数统计、风险等级划分和排序规则不变，只调整 `ccdi-project` 结果总览聚合 SQL 与服务映射。核心异常点改为先按员工和规则统计命中次数，再按命中次数倒序、规则编码升序拼接多条规则名称，直接返回给前端展示。

**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/mapper/CcdiProjectOverviewMapperSqlTest.java`

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

在服务测试中新增或调整用例，断言 `riskPoint` 取拼接后的多规则字符串；在 SQL 结构测试中锁定 `group_concat` 与 `risk_point` 聚合片段。

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

Run:

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

Expected:

- `FAIL`
- 服务层仍只映射单条规则，SQL 尚未包含多规则拼接

- [ ] **Step 3: Write minimal implementation**

为员工聚合 VO 增加 `riskPoint` 字段；在 Mapper XML 中新增员工维度规则拼接子查询；Service 改为使用聚合后的 `riskPoint`。

- [ ] **Step 4: Run test to verify it passes**

Run:

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

Expected:

- `PASS`

- [ ] **Step 5: Commit**

```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/mapper/CcdiProjectOverviewMapperSqlTest.java ccdi-project/src/main/java/com/ruoyi/ccdi/project/domain/vo/CcdiProjectEmployeeRiskAggregateVO.java ccdi-project/src/main/java/com/ruoyi/ccdi/project/service/impl/CcdiProjectOverviewServiceImpl.java ccdi-project/src/main/resources/mapper/ccdi/project/CcdiProjectOverviewMapper.xml
git commit -m "修正风险人员总览核心异常点多规则展示"
```
