فهرست منبع

fix(backend): 后端稳定性 — catch块日志/空值处理/PostMapping统一/管家stub

Wave 2 fixes (T5-T8):
- DatabaseInitializer: 36个空catch块添加log.warn日志
- TeacherService: getTeacherInfo抛异常, getAuthorizedChildren返回空列表
- 14个controller: 42处@GetMapping/@PutMapping/@DeleteMapping→@PostMapping
- ButlerController: 2个stub方法标记@Deprecated+抛UnsupportedOperationException
Xiaogang Liao 2 ماه پیش
والد
کامیت
fad9637075
17فایلهای تغییر یافته به همراه116 افزوده شده و 116 حذف شده
  1. 36 20
      cfc-backend/src/main/java/com/etotem/cfc/config/DatabaseInitializer.java
  2. 17 17
      cfc-backend/src/main/java/com/etotem/cfc/controller/DanAssessmentController.java
  3. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/controller/MediaController.java
  4. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/controller/MiniGameController.java
  5. 3 3
      cfc-backend/src/main/java/com/etotem/cfc/controller/TaskTemplatePackageController.java
  6. 9 9
      cfc-backend/src/main/java/com/etotem/cfc/controller/admin/AdminController.java
  7. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/controller/admin/AdminSubscriptionController.java
  8. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/admin/PackageTemplateController.java
  9. 24 41
      cfc-backend/src/main/java/com/etotem/cfc/controller/butler/ButlerController.java
  10. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/controller/family/InteractionLogController.java
  11. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/family/RelationshipQuestionnaireController.java
  12. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/guide/GuideFamilyTaskController.java
  13. 2 2
      cfc-backend/src/main/java/com/etotem/cfc/controller/guide/GuideManagementController.java
  14. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/controller/guide/TeacherController.java
  15. 1 1
      cfc-backend/src/main/java/com/etotem/cfc/controller/task/TaskController.java
  16. 6 6
      cfc-backend/src/main/java/com/etotem/cfc/controller/wish/WishController.java
  17. 7 6
      cfc-backend/src/main/java/com/etotem/cfc/service/TeacherService.java

+ 36 - 20
cfc-backend/src/main/java/com/etotem/cfc/config/DatabaseInitializer.java

@@ -671,18 +671,22 @@ log.info("已添加template_id列到tasks表");
         try {
             jdbcTemplate.execute("ALTER TABLE assessment_appointments ADD COLUMN user_id BIGINT COMMENT '用户ID'");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
         try {
             jdbcTemplate.execute("ALTER TABLE assessment_appointments ADD COLUMN guide_id BIGINT COMMENT '成长规划师ID'");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
         try {
             jdbcTemplate.execute("ALTER TABLE assessment_appointments ADD COLUMN package_id BIGINT COMMENT '套餐ID'");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
         try {
             jdbcTemplate.execute("ALTER TABLE assessment_appointments ADD COLUMN remark VARCHAR(500) COMMENT '备注'");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
 
         // assessment_orders 表
@@ -711,6 +715,7 @@ log.info("已添加template_id列到tasks表");
                     "INDEX idx_status (status)) " +
                     "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='评估订单表'");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
 
         // 迁移26: guide_applications表添加address和bank_card字段
@@ -1008,12 +1013,12 @@ log.info("已添加template_id列到tasks表");
         try {
             jdbcTemplate.execute("ALTER TABLE product_orders ADD COLUMN logistics_no VARCHAR(64) COMMENT '物流单号'");
             log.info("已添加logistics_no列到product_orders表");
-        } catch (Exception e) { }
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE product_orders ADD COLUMN logistics_company VARCHAR(100) COMMENT '物流公司'");
             log.info("已添加logistics_company列到product_orders表");
-        } catch (Exception e) { }
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         // SysConfig 种子数据
         try {
@@ -1811,35 +1816,35 @@ log.info("已添加template_id列到tasks表");
         try {
             jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN teacher_no VARCHAR(20) COMMENT '服务商编号'");
             log.info("已添加teacher_no列到guides表");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN title VARCHAR(50) COMMENT '职称/称号'");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN specialty VARCHAR(200) COMMENT '专长领域'");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN bio TEXT COMMENT '简介'");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN experience_years TINYINT DEFAULT 0 COMMENT '从业年限'");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN rating INT DEFAULT 500 COMMENT '评分(百分位,500=5.00)'");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN total_appointments INT DEFAULT 0 COMMENT '总服务次数'");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN street_id BIGINT COMMENT '街道ID'");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN province VARCHAR(50) COMMENT '省份'");
@@ -1847,11 +1852,11 @@ log.info("已添加template_id列到tasks表");
             jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN district VARCHAR(50) COMMENT '区县'");
             jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN street VARCHAR(100) COMMENT '街道'");
             log.info("已添加地址字段到guides表");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guides ADD COLUMN verified_at DATETIME COMMENT '审核通过时间'");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         // 迁移: 将 teachers 表数据合并到 guides(type='teacher')
         try {
@@ -3589,44 +3594,52 @@ try {
         try {
             jdbcTemplate.execute("ALTER TABLE guide_packages ADD COLUMN guide_id BIGINT COMMENT '成长规划师ID' AFTER id");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guide_packages ADD COLUMN package_id BIGINT COMMENT '关联模板' AFTER guide_id");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guide_packages ADD COLUMN commission_rate INT COMMENT '佣金比例(bps,100=1%)' AFTER package_id");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guide_packages MODIFY COLUMN teacher_id BIGINT NULL");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
 
         try {
             jdbcTemplate.execute("ALTER TABLE guide_packages MODIFY COLUMN template_id BIGINT NULL");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
 
         // 迁移:guide_packages 表添加 level 列(GuidePackage 实体需要)
         try {
             jdbcTemplate.execute("ALTER TABLE guide_packages ADD COLUMN level VARCHAR(20) COMMENT '套餐等级' AFTER name");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
 
         // 迁移:guide_packages 表添加 validity_days 列
         try {
             jdbcTemplate.execute("ALTER TABLE guide_packages ADD COLUMN validity_days INT DEFAULT 0 COMMENT '有效期天数' AFTER validity_months");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
 
         // 迁移:guide_packages 表添加 sort_order 列
         try {
             jdbcTemplate.execute("ALTER TABLE guide_packages ADD COLUMN sort_order INT DEFAULT 0 COMMENT '排序' AFTER status");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
 
         // 成长规划师套餐服务项表
@@ -4110,42 +4123,42 @@ try {
         try {
             jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN source_type VARCHAR(20) DEFAULT 'manual' COMMENT '来源类型: manual/platform_purchase/self_upload/supplement'");
             log.info("已添加source_type列到growth_records表");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN source_file_url VARCHAR(500) COMMENT '原始报告文件URL'");
             log.info("已添加source_file_url列到growth_records表");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN order_id BIGINT COMMENT '关联订单ID'");
             log.info("已添加order_id列到growth_records表");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN report_date DATETIME COMMENT '测评/报告日期'");
             log.info("已添加report_date列到growth_records表");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN parent_record_id BIGINT COMMENT '关联的原始档案ID(补充档案专用)'");
             log.info("已添加parent_record_id列到growth_records表");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN is_latest TINYINT(1) DEFAULT 1 COMMENT '是否同组最新记录'");
             log.info("已添加is_latest列到growth_records表");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN dedup_hash VARCHAR(64) COMMENT '去重哈希值(SHA256)'");
             log.info("已添加dedup_hash列到growth_records表");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("ALTER TABLE growth_records ADD COLUMN parsed_data TEXT COMMENT '上传报告的解析结果(JSON)'");
             log.info("已添加parsed_data列到growth_records表");
-        } catch (Exception e) {}
+        } catch (Exception e) { log.warn("Migration skipped (already exists): {}", e.getMessage()); }
 
         try {
             jdbcTemplate.execute("CREATE UNIQUE INDEX IF NOT EXISTS uk_growth_dedup_hash ON growth_records(dedup_hash)");
@@ -5236,10 +5249,12 @@ try {
         try {
             jdbcTemplate.execute("ALTER TABLE pending_refund ADD INDEX idx_order_type (order_type)");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
         try {
             jdbcTemplate.execute("ALTER TABLE pending_refund ADD INDEX idx_order_no (order_no)");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
 
         runMigration80();
@@ -5546,6 +5561,7 @@ try {
             jdbcTemplate.execute("ALTER TABLE users ADD COLUMN butler_approved_at DATETIME");
             log.info("已添加 butler 相关列到 users 表");
         } catch (Exception e) {
+            log.warn("Migration skipped (already exists): {}", e.getMessage());
         }
 
         // 迁移 86: 创建 butler_assignments 表(会员 - 管家分配记录)

+ 17 - 17
cfc-backend/src/main/java/com/etotem/cfc/controller/DanAssessmentController.java

@@ -41,31 +41,31 @@ public class DanAssessmentController {
 
     // ===== 测评材料 =====
 
-    @Operation(summary = "获取当前测评材料")
-    @GetMapping("/material/active")
+@Operation(summary = "获取当前测评材料")
+    @PostMapping("/material/active")
     public Result<AssessmentMaterial> getActiveMaterial() {
         AssessmentMaterial material = assessmentService.getActiveMaterial();
         return Result.success(material);
     }
 
-    @Operation(summary = "获取测评材料列表")
-    @GetMapping("/material/list")
+@Operation(summary = "获取测评材料列表")
+    @PostMapping("/material/list")
     public Result<List<AssessmentMaterial>> getMaterialList() {
         return Result.success(assessmentService.getMaterialList());
     }
 
     // ===== 积分配置 =====
 
-    @Operation(summary = "获取积分配置")
-    @GetMapping("/points-config")
+@Operation(summary = "获取积分配置")
+    @PostMapping("/points-config")
     public Result<AssessmentPointsConfig> getPointsConfig() {
         return Result.success(assessmentService.getPointsConfig());
     }
 
     // ===== 家庭配置 =====
 
-    @Operation(summary = "获取家庭测评配置")
-    @GetMapping("/family/config")
+@Operation(summary = "获取家庭测评配置")
+    @PostMapping("/family/config")
     public Result<FamilyAssessmentConfig> getFamilyConfig(@RequestParam Long familyId) {
         return Result.success(assessmentService.getFamilyConfig(familyId));
     }
@@ -112,14 +112,14 @@ public class DanAssessmentController {
         return ok ? Result.success("完成成功") : Result.error("记录不存在");
     }
 
-    @Operation(summary = "获取家庭测评记录")
-    @GetMapping("/record/family")
+@Operation(summary = "获取家庭测评记录")
+    @PostMapping("/record/family")
     public Result<List<AssessmentRecord>> getFamilyRecords(@RequestParam Long familyId) {
         return Result.success(assessmentService.getFamilyRecords(familyId));
     }
 
-    @Operation(summary = "获取当前测评")
-    @GetMapping("/record/current")
+@Operation(summary = "获取当前测评")
+    @PostMapping("/record/current")
     public Result<AssessmentRecord> getCurrentAssessment(@RequestParam Long familyId) {
         return Result.success(assessmentService.getCurrentAssessment(familyId));
     }
@@ -201,14 +201,14 @@ public class DanAssessmentController {
         return ok ? Result.success("取消成功") : Result.error("取消失败");
     }
 
-    @Operation(summary = "获取用户的预约列表")
-    @GetMapping("/appointment/user")
+@Operation(summary = "获取用户的预约列表")
+    @PostMapping("/appointment/user")
     public Result<List<AssessmentAppointment>> getUserAppointments(@RequestParam Long userId) {
         return Result.success(appointmentService.getByUserId(userId));
     }
 
     @Operation(summary = "获取规划师的预约列表")
-    @GetMapping("/appointment/guide")
+    @PostMapping("/appointment/guide")
     public Result<List<AssessmentAppointment>> getGuideAppointments(@RequestParam Long guideId) {
         return Result.success(appointmentService.getByGuideId(guideId));
     }
@@ -252,13 +252,13 @@ public class DanAssessmentController {
     }
 
     @Operation(summary = "获取订单详情")
-    @GetMapping("/order/detail")
+    @PostMapping("/order/detail")
     public Result<AssessmentOrder> getOrderDetail(@RequestParam String orderNo) {
         return Result.success(orderService.getByOrderNo(orderNo));
     }
 
     @Operation(summary = "获取家庭订单列表")
-    @GetMapping("/order/family")
+    @PostMapping("/order/family")
     public Result<List<AssessmentOrder>> getFamilyOrders(@RequestParam Long familyId) {
         return Result.success(orderService.getFamilyOrders(familyId));
     }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/MediaController.java

@@ -56,7 +56,7 @@ public class MediaController {
     }
 
     @Operation(summary = "删除媒体")
-    @DeleteMapping("/{mediaId}")
+    @PostMapping("/{mediaId}")
     public Result<Boolean> deleteMedia(
             @PathVariable Long mediaId,
             @RequestAttribute("userId") Long userId) {

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/MiniGameController.java

@@ -43,7 +43,7 @@ public class MiniGameController {
         return Result.success(games);
     }
     @Operation(summary = "更新游戏状态")
-    @PutMapping("/{id}/status")
+    @PostMapping("/{id}/status")
     public Result<Boolean> updateStatus(@PathVariable Long id, @RequestParam Integer status) {
         boolean success = miniGameService.updateGameStatus(id, status);
         return Result.success(success);

+ 3 - 3
cfc-backend/src/main/java/com/etotem/cfc/controller/TaskTemplatePackageController.java

@@ -38,7 +38,7 @@ public class TaskTemplatePackageController {
      * 更新套餐
      */
     @Operation(summary = "更新套餐")
-    @PutMapping("/{id}")
+    @PostMapping("/{id}")
     public Result<Boolean> updatePackage(@PathVariable Long id,
                                           @RequestBody CreatePackageDTO dto) {
         boolean success = packageService.updatePackage(id, dto);
@@ -103,7 +103,7 @@ public class TaskTemplatePackageController {
      * 更新任务项
      */
     @Operation(summary = "更新任务项")
-    @PutMapping("/items/{itemId}")
+    @PostMapping("/items/{itemId}")
     public Result<Boolean> updateItem(@PathVariable Long itemId,
                                         @RequestBody CreatePackageItemDTO dto) {
         boolean success = packageService.updateItem(itemId, dto);
@@ -114,7 +114,7 @@ public class TaskTemplatePackageController {
      * 删除任务项
      */
     @Operation(summary = "删除任务项")
-    @DeleteMapping("/items/{itemId}")
+    @PostMapping("/items/{itemId}")
     public Result<Boolean> deleteItem(@PathVariable Long itemId) {
         boolean success = packageService.deleteItem(itemId);
         return Result.success(success);

+ 9 - 9
cfc-backend/src/main/java/com/etotem/cfc/controller/admin/AdminController.java

@@ -124,7 +124,7 @@ public class AdminController {
         return Result.success(userMapper.selectById(id));
     }
 
-    @PutMapping("/users/{id}")
+    @PostMapping("/users/{id}/update")
     public Result<Boolean> updateUser(@PathVariable Long id, @RequestBody User user) {
         user.setId(id);
         userMapper.updateById(user);
@@ -173,7 +173,7 @@ public class AdminController {
         return Result.success(users);
     }
 
-    @DeleteMapping("/users/{id}")
+    @PostMapping("/users/{id}/delete")
     public Result<Boolean> deleteUser(@PathVariable Long id) {
         userMapper.deleteById(id);
         return Result.success(true);
@@ -194,7 +194,7 @@ public class AdminController {
         return Result.success(familyMemberMapper.selectById(id));
     }
 
-    @PutMapping("/children/{id}")
+    @PostMapping("/children/{id}/update")
     public Result<Boolean> updateChild(@PathVariable Long id, @RequestBody FamilyMember child) {
         child.setId(id);
         familyMemberMapper.updateById(child);
@@ -321,7 +321,7 @@ public class AdminController {
         return Result.success(reward.getId());
     }
 
-    @DeleteMapping("/rewards/templates/{id}")
+    @PostMapping("/rewards/templates/{id}/delete")
     public Result<Boolean> deleteRewardTemplate(@PathVariable Long id, @RequestAttribute("userId") Long userId) {
         // 验证家庭归属
         com.etotem.cfc.entity.User user = userService.getUserInfo(userId);
@@ -335,7 +335,7 @@ public class AdminController {
         return Result.success(true);
     }
 
-    @PutMapping("/rewards/templates/{id}")
+    @PostMapping("/rewards/templates/{id}/update")
     public Result<Boolean> updateRewardTemplate(@PathVariable Long id, @RequestBody Reward reward, @RequestAttribute("userId") Long userId) {
         // 验证家庭归属
         com.etotem.cfc.entity.User user = userService.getUserInfo(userId);
@@ -501,7 +501,7 @@ public class AdminController {
         return Result.success(result);
     }
 
-    @PutMapping("/families/{id}")
+    @PostMapping("/families/{id}/update")
     public Result<Boolean> updateFamily(@PathVariable Long id, @RequestBody Family family) {
         family.setId(id);
         family.setUpdatedAt(new Date());
@@ -509,7 +509,7 @@ public class AdminController {
         return Result.success(true);
     }
 
-    @DeleteMapping("/families/{id}")
+    @PostMapping("/families/{id}/delete")
     public Result<Boolean> deleteFamily(@PathVariable Long id) {
         familyMapper.deleteById(id);
         return Result.success(true);
@@ -556,7 +556,7 @@ public class AdminController {
         return Result.success(template.getId());
     }
 
-    @PutMapping("/task-templates/{id}")
+    @PostMapping("/task-templates/{id}/update")
     public Result<Boolean> updateTaskTemplate(@PathVariable Long id, @RequestBody TaskTemplate template) {
         template.setId(id);
         template.setUpdatedAt(new Date());
@@ -564,7 +564,7 @@ public class AdminController {
         return Result.success(true);
     }
 
-    @DeleteMapping("/task-templates/{id}")
+    @PostMapping("/task-templates/{id}/delete")
     public Result<Boolean> deleteTaskTemplate(@PathVariable Long id) {
         taskTemplateMapper.deleteById(id);
         return Result.success(true);

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/admin/AdminSubscriptionController.java

@@ -103,7 +103,7 @@ public class AdminSubscriptionController {
         return Result.success(null);
     }
 
-    @GetMapping("/benefits")
+    @PostMapping("/benefits")
     public Result<List<Map<String, Object>>> getBenefitConfig() {
         List<Map<String, Object>> benefits = new ArrayList<>();
         return Result.success(benefits);

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/admin/PackageTemplateController.java

@@ -50,7 +50,7 @@ public class PackageTemplateController {
         return Result.success(created);
     }
 
-    @PutMapping("/{id}")
+    @PostMapping("/{id}/update")
     @Operation(summary = "更新套餐模板")
     public Result<GuidePackageTemplate> update(@PathVariable Long id, @RequestBody GuidePackageTemplate template) {
         template.setId(id);
@@ -59,7 +59,7 @@ public class PackageTemplateController {
         return success ? Result.success(template) : Result.error("更新失败");
     }
 
-    @DeleteMapping("/{id}")
+    @PostMapping("/{id}/delete")
     @Operation(summary = "删除套餐模板")
     public Result<Void> delete(@PathVariable Long id) {
         boolean success = templateService.deleteTemplate(id);

+ 24 - 41
cfc-backend/src/main/java/com/etotem/cfc/controller/butler/ButlerController.java

@@ -6,6 +6,7 @@ import com.etotem.cfc.common.Result;
 import com.etotem.cfc.entity.User;
 import com.etotem.cfc.mapper.UserMapper;
 import com.etotem.cfc.service.ButlerService;
+import io.swagger.v3.oas.annotations.Operation;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
@@ -80,45 +81,27 @@ public class ButlerController {
         return Result.success(data);
     }
 
-    /**
-     * 获取服务记录
-     * POST /api/butler/service-records
-     */
-    @PostMapping("/service-records")
-    public Result<Map<String, Object>> getServiceRecords(@RequestBody Map<String, Object> params,
-                                                           @RequestAttribute("userId") Long userId) {
-        int page = params.get("page") != null ? ((Number) params.get("page")).intValue() : 1;
-        int size = params.get("size") != null ? ((Number) params.get("size")).intValue() : 20;
-        String status = (String) params.get("status");
-
-        // 这里需要查询服务记录表,暂时返回空列表
-        // TODO: 实现 ButlerServiceRecord 实体查询
-        Map<String, Object> data = new HashMap<>();
-        data.put("list", java.util.Collections.emptyList());
-        data.put("total", 0L);
-        data.put("page", page);
-        data.put("size", size);
-        return Result.success(data);
-    }
-
-    /**
-     * 获取佣金记录
-     * POST /api/butler/commissions
-     */
-    @PostMapping("/commissions")
-    public Result<Map<String, Object>> getCommissions(@RequestBody Map<String, Object> params,
-                                                       @RequestAttribute("userId") Long userId) {
-        int page = params.get("page") != null ? ((Number) params.get("page")).intValue() : 1;
-        int size = params.get("size") != null ? ((Number) params.get("size")).intValue() : 20;
-        String status = (String) params.get("status");
-
-        // 这里需要查询佣金记录表,暂时返回空列表
-        // TODO: 实现 ButlerCommission 实体查询
-        Map<String, Object> data = new HashMap<>();
-        data.put("list", java.util.Collections.emptyList());
-        data.put("total", 0L);
-        data.put("page", page);
-        data.put("size", size);
-        return Result.success(data);
-    }
+/**
+ * 获取服务记录
+ * POST /api/butler/service-records
+ */
+@Deprecated
+@Operation(summary = "获取服务记录", deprecated = true)
+@PostMapping("/service-records")
+public Result<Map<String, Object>> getServiceRecords(@RequestBody Map<String, Object> params,
+@RequestAttribute("userId") Long userId) {
+throw new UnsupportedOperationException("管家服务记录功能暂未开放");
+}
+
+/**
+ * 获取佣金记录
+ * POST /api/butler/commissions
+ */
+@Deprecated
+@Operation(summary = "获取佣金记录", deprecated = true)
+@PostMapping("/commissions")
+public Result<Map<String, Object>> getCommissions(@RequestBody Map<String, Object> params,
+@RequestAttribute("userId") Long userId) {
+throw new UnsupportedOperationException("管家佣金功能暂未开放");
+}
 }

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/family/InteractionLogController.java

@@ -76,7 +76,7 @@ public class InteractionLogController {
     }
 
     @Operation(summary = "获取互动类型列表")
-    @GetMapping("/types")
+    @PostMapping("/types")
     public Result<Map<String, String>> getInteractionTypes() {
         return Result.success(interactionLogService.getInteractionTypes());
     }

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/family/RelationshipQuestionnaireController.java

@@ -74,7 +74,7 @@ public class RelationshipQuestionnaireController {
     }
 
     @Operation(summary = "获取最新问卷快照")
-    @GetMapping("/snapshot/{memberId}")
+    @PostMapping("/snapshot/{memberId}")
     public Result<QuestionnaireSnapshotVO> getSnapshot(HttpServletRequest request,
                                                         @PathVariable Long memberId) {
         Long userId = getUserId(request);
@@ -90,7 +90,7 @@ public class RelationshipQuestionnaireController {
     }
 
     @Operation(summary = "获取问卷历史记录")
-    @GetMapping("/history/{memberId}")
+    @PostMapping("/history/{memberId}")
     public Result<List<RelationshipQuestionnaireResponse>> getHistory(HttpServletRequest request,
                                                                         @PathVariable Long memberId) {
         Long userId = getUserId(request);

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/guide/GuideFamilyTaskController.java

@@ -305,7 +305,7 @@ public class GuideFamilyTaskController {
         @ApiResponse(responseCode = "403", description = "Access denied"),
         @ApiResponse(responseCode = "404", description = "任务不存在")
     })
-    @PutMapping("/{familyId}/tasks/{taskId}")
+    @PostMapping("/{familyId}/tasks/{taskId}")
     public Result<Boolean> updateTask(
             @PathVariable Long familyId,
             @PathVariable Long taskId,
@@ -356,7 +356,7 @@ public class GuideFamilyTaskController {
         @ApiResponse(responseCode = "403", description = "Access denied"),
         @ApiResponse(responseCode = "404", description = "任务不存在")
     })
-    @DeleteMapping("/{familyId}/tasks/{taskId}")
+    @PostMapping("/{familyId}/tasks/{taskId}")
     public Result<Boolean> deleteTask(
             @PathVariable Long familyId,
             @PathVariable Long taskId,

+ 2 - 2
cfc-backend/src/main/java/com/etotem/cfc/controller/guide/GuideManagementController.java

@@ -297,7 +297,7 @@ public class GuideManagementController {
      * 更新成长规划师套餐价格
      */
     @Operation(summary = "更新成长规划师套餐价格")
-    @PutMapping("/package/{packageId}")
+    @PostMapping("/package/{packageId}/update")
     public Result<Boolean> updateGuidePackage(@RequestAttribute("userId") Long userId,
                                                @PathVariable Long packageId,
                                                @RequestBody Map<String, Object> params) {
@@ -310,7 +310,7 @@ public class GuideManagementController {
      * 删除成长规划师套餐
      */
     @Operation(summary = "删除成长规划师套餐")
-    @DeleteMapping("/package/{packageId}")
+    @PostMapping("/package/{packageId}/delete")
     public Result<Boolean> deleteGuidePackage(@RequestAttribute("userId") Long userId,
                                                @PathVariable Long packageId) {
         boolean success = guidePackageService.deleteGuidePackage(userId, packageId);

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/guide/TeacherController.java

@@ -83,7 +83,7 @@ public class TeacherController {
 
     @Deprecated
     @Operation(summary = "从班级移除学生", deprecated = true)
-    @DeleteMapping("/classes/{classId}/students/{studentId}")
+    @PostMapping("/classes/{classId}/students/{studentId}")
     public Result<Boolean> removeStudentFromClass(@RequestAttribute("userId") Long teacherId,
       @PathVariable Long classId,
       @PathVariable Long studentId) {

+ 1 - 1
cfc-backend/src/main/java/com/etotem/cfc/controller/task/TaskController.java

@@ -113,7 +113,7 @@ public class TaskController {
     }
 
     @Operation(summary = "删除任务")
-    @DeleteMapping("/{id}")
+    @PostMapping("/{id}")
     public Result<Boolean> deleteTask(@PathVariable Long id,
             @RequestAttribute("userId") Long userId) {
         boolean success = taskService.deleteTask(id, userId);

+ 6 - 6
cfc-backend/src/main/java/com/etotem/cfc/controller/wish/WishController.java

@@ -50,7 +50,7 @@ public class WishController {
     // ========== 定价流程 ==========
 
     @Operation(summary = "家长定价")
-    @PutMapping("/{id}/set-price")
+    @PostMapping("/{id}/set-price")
     public Result<Boolean> setPrice(
             @PathVariable Long id,
             @RequestAttribute("userId") Long userId,
@@ -72,7 +72,7 @@ public class WishController {
     }
 
     @Operation(summary = "家长拒绝心愿")
-    @PutMapping("/{id}/reject")
+    @PostMapping("/{id}/reject")
     public Result<Boolean> rejectWish(
             @PathVariable Long id,
             @RequestAttribute("userId") Long userId,
@@ -110,7 +110,7 @@ public class WishController {
     }
 
     @Operation(summary = "家长审批兑换")
-    @PutMapping("/{id}/approve-exchange")
+    @PostMapping("/{id}/approve-exchange")
     public Result<Boolean> approveExchange(
             @PathVariable Long id,
             @RequestAttribute("userId") Long userId,
@@ -135,7 +135,7 @@ public class WishController {
     // ========== 兑现流程 ==========
 
     @Operation(summary = "家长标记已购买")
-    @PutMapping("/{id}/fulfill")
+    @PostMapping("/{id}/fulfill")
     public Result<Boolean> markFulfilled(
             @PathVariable Long id,
             @RequestAttribute("userId") Long userId) {
@@ -152,7 +152,7 @@ public class WishController {
     }
 
     @Operation(summary = "孩子确认收货")
-    @PutMapping("/{id}/confirm")
+    @PostMapping("/{id}/confirm")
     public Result<Boolean> confirmReceived(
             @PathVariable Long id,
             @RequestAttribute("userId") Long userId) {
@@ -171,7 +171,7 @@ public class WishController {
     // ========== 取消心愿 ==========
 
     @Operation(summary = "取消心愿")
-    @DeleteMapping("/{id}")
+    @PostMapping("/{id}")
     public Result<Boolean> cancelWish(
             @PathVariable Long id,
             @RequestAttribute("userId") Long userId,

+ 7 - 6
cfc-backend/src/main/java/com/etotem/cfc/service/TeacherService.java

@@ -8,6 +8,7 @@ import com.etotem.cfc.service.api.TeacherServiceInterface;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -43,9 +44,9 @@ public class TeacherService {
         Teacher teacher = teacherMapper.selectOne(new LambdaQueryWrapper<Teacher>()
                 .eq(Teacher::getUserId, userId));
         
-        if (teacher == null) {
-            return null;
-        }
+ if (teacher == null) {
+ throw new RuntimeException("教师信息不存在");
+ }
         
         return toDTO(teacher);
     }
@@ -221,9 +222,9 @@ public class TeacherService {
      */
     public List<ChildInfoDTO> getAuthorizedChildren(Long teacherId) {
         // 这里需要查询家长授权表,获取授权的孩子
-        // 简化实现:返回所有家庭的孩子
-        return null;
-    }
+ // 简化实现:返回所有家庭的孩子
+ return Collections.emptyList();
+}
 
     private String generateTeacherNo() {
         return "T" + System.currentTimeMillis();