# 五维健康能量系统实施计划
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Implement remaining high-priority items from 健康能量设计.md: wisdom/wealth dimension pages + backend multi-business energy ledger integration.
**Architecture:** Frontend uni-app Vue 2 pages following existing dimension page patterns (body/action/mind). Backend adds `awardEnergy` hook calls at existing completion points in GameRecordService, StreakService/FinanceCheckinService, and AssessmentAppointmentService — same pattern as TaskService already uses.
**Tech Stack:** uni-app Vue 2 (frontend), Spring Boot 2.7 + MyBatis-Plus (backend)
---
### Task 1: Create wisdom dimension home page
**Files:**
- Create: `cfc-frontend/pages/wisdom/index.vue`
- Modify: `cfc-frontend/pages.json` (register page in subPackages)
- Reference: `cfc-frontend/pages/action/index.vue` (pattern)
- [ ] **Step 1: Create `pages/wisdom/index.vue`**
Follow the exact pattern of `pages/action/index.vue`:
- PageBanner with `theme="wisdom"`, tagline `"学以启智 · 慧及未来"`, quote `"知者不惑,仁者不忧"`
- Functional entries grid with 5 items: 学习任务, 小游戏, 测评中心, 阅读天地, 知识挑战
- Today's tasks section (if logged in)
- Hot activities section
- Recommended products section
- bottom-spacer
```vue
{{ task.title }}
+{{ task.points || 0 }}分
今日暂无任务
{{ item.icon }}
{{ item.label }}
{{ act.name }}
{{ act.date }} · {{ act.location }}
{{ prod.name }}
¥{{ prod.price }}
```
- [ ] **Step 2: Register wisdom page in pages.json**
Add to the `subPackages` array in `pages.json` — create a new subpackage block for wisdom pages:
```json
// ===== 智慧维度 =====
{
"root": "pages/wisdom",
"pages": [
{
"path": "index",
"style": { "navigationBarTitleText": "智慧" }
}
]
}
```
Insert this after the `pages/energy` subpackage block (around line 437) and before the `pages/membership` block (around line 438).
- [ ] **Step 3: Verify LSP diagnostics**
Run: `lsp_diagnostics` on `cfc-frontend/pages/wisdom/index.vue` — expect: clean (no errors/warnings)
---
### Task 2: Create wealth dimension home page
**Files:**
- Create: `cfc-frontend/pages/wealth/index.vue`
- Reference: `cfc-frontend/pages/action/index.vue` (pattern)
- [ ] **Step 1: Create `pages/wealth/index.vue`**
Follow the pattern of `pages/action/index.vue`:
```vue
{{ task.title }}
+{{ task.points || 0 }}分
今日暂无任务
{{ item.icon }}
{{ item.label }}
{{ act.name }}
{{ act.date }} · {{ act.location }}
{{ prod.name }}
¥{{ prod.price }}
```
- [ ] **Step 2: Register wealth index page in pages.json**
Add to the existing `pages/wealth` subpackage block:
```json
// ===== 财富维度 =====
{
"root": "pages/wealth",
"pages": [
{
"path": "index",
"style": { "navigationBarTitleText": "财富" }
},
{
"path": "checkin",
"style": { "navigationBarTitleText": "财商打卡" }
},
// ... existing pages ...
]
}
```
Insert `index` as the FIRST entry in the `pages/wealth` pages array.
- [ ] **Step 3: Verify LSP diagnostics**
Run: `lsp_diagnostics` on both new files — clean.
---
### Task 3: Integrate MiniGame → awardEnergy
**Files:**
- Modify: `cfc-backend/src/main/java/com/etotem/cfc/service/GameRecordService.java`
- Reference: `cfc-backend/src/main/java/com/etotem/cfc/service/TaskService.java` (lines 372-382, awardEnergy pattern)
- [ ] **Step 1: Add @Resource EnergyService and awardEnergy call in `saveRecord`**
Inject EnergyService and add the same try-catch awardEnergy pattern after `gameRecordMapper.insert(record)`:
```java
import javax.annotation.Resource;
// ... existing imports ...
@Resource
private EnergyService energyService;
// Inside saveRecord method, after gameRecordMapper.insert(record); (line 45):
// 发放智能量
try {
int energyAmount = Math.abs(pointsEarned != null ? pointsEarned : 0);
if (energyAmount > 0) {
energyService.awardEnergy(childId, "game", record.getId(), energyAmount,
"完成游戏: " + gameCode, null);
}
} catch (Exception e) {
log.warn("游戏能量发放失败: childId={}, gameCode={}, error={}",
childId, gameCode, e.getMessage());
}
```
- [ ] **Step 2: Verify compilation**
Run: `mvn clean compile -f cfc-backend/pom.xml` — expect: BUILD SUCCESS
---
### Task 4: Integrate Streak/Checkin → awardEnergy
**Files:**
- Modify: `cfc-backend/src/main/java/com/etotem/cfc/service/StreakService.java`
- Reference: TaskService.java lines 372-382
- [ ] **Step 1: Add @Resource EnergyService and awardEnergy in `checkAndAwardMilestone`**
Inject EnergyService and add awardEnergy call when a milestone is reached (after `recordBonusPoints` call), and for daily streak checkin:
```java
@Resource
private EnergyService energyService;
// In checkAndAwardMilestone, before or after the recordBonusPoints call (around line 74):
// 发放行能量 - 达到里程碑
try {
energyService.awardEnergy(childId, "streak", milestone.getId().longValue(), rewardPoints,
"打卡里程碑-" + milestone.getDays() + "天奖励", null);
} catch (Exception e) {
log.warn("打卡里程碑能量发放失败: childId={}, error={}", childId, e.getMessage());
}
```
Also add a daily streak energy award (even without milestone, for continuing the streak). After milestone check loop ends (around line 81), before the return:
```java
// 每日连续打卡能量奖励(即使没达到里程碑也奖励)
try {
energyService.awardEnergy(childId, "streak", 0L, 5,
"连续打卡第" + currentStreakDays + "天", null);
} catch (Exception e) {
log.warn("每日打卡能量发放失败: childId={}, error={}", childId, e.getMessage());
}
```
- [ ] **Step 2: Verify compilation**
Run: `mvn clean compile -f cfc-backend/pom.xml` — expect: BUILD SUCCESS
---
### Task 5: Integrate Assessment → awardEnergy
**Files:**
- Modify: `cfc-backend/src/main/java/com/etotem/cfc/service/AssessmentAppointmentService.java`
- [ ] **Step 1: Add @Resource EnergyService and awardEnergy in `completeAppointment`**
```java
import com.etotem.cfc.service.EnergyService;
import javax.annotation.Resource;
@Resource
private EnergyService energyService;
// In completeAppointment method, after setting status=2 (line 54), before return:
// 测评完成发放智能量
try {
if (appointment.getChildId() != null) {
energyService.awardEnergy(appointment.getChildId(), "assessment", id, 20,
"完成测评预约", null);
}
} catch (Exception e) {
log.warn("测评能量发放失败: appointmentId={}, error={}", id, e.getMessage());
}
```
- [ ] **Step 2: Verify compilation**
Run: `mvn clean compile -f cfc-backend/pom.xml` — expect: BUILD SUCCESS