feat: T10 回归测试 Bug 修复与功能完善

修复 BUG-001 至 BUG-009 及 T10-1 至 T10-6 相关问题:
- 打卡积分显示与累加逻辑优化
- 食谱计算器 Tab 选中样式修复
- 食物百科列表图片与简介展示修复
- 食物详情页数据加载修复
- AI营养师差异化回复优化
- 健康知识/营养知识名称统一
- 饮食指南/科普文章详情页内容展示修复
- 帖子营养统计数据展示修复
- 社区帖子类型中文命名统一
- 帖子详情标签中文显示修复
- 食谱营养AI填充功能完善
- 食谱收藏/点赞功能修复

新增:
- ToolNutritionFillService 营养填充服务
- T10 回归测试用例 (Playwright)
- 知识文章数据 SQL 脚本

涉及模块:
- crmeb-common: VO/Request/Response 优化
- crmeb-service: 业务逻辑完善
- crmeb-front: API 接口扩展
- msh_single_uniapp: 前端页面修复
- tests/e2e: 回归测试用例
This commit is contained in:
2026-03-05 09:35:00 +08:00
parent 6f2dc27fbc
commit d8d2025543
44 changed files with 1536 additions and 165 deletions

View File

@@ -53,6 +53,9 @@ public class ToolController {
@Autowired
private ToolPointsService toolPointsService;
@Autowired
private ToolNutritionFillService toolNutritionFillService;
@Autowired
private ToolHomeService toolHomeService;
@@ -312,6 +315,15 @@ public class ToolController {
return CommonResult.success(toolKnowledgeService.getNutrientDetail(name));
}
/**
* 检查知识库数据:按 type、status 汇总 v2_knowledge 条数T04
*/
@ApiOperation(value = "知识库统计")
@GetMapping("/knowledge/stats")
public CommonResult<Map<String, Object>> getKnowledgeStats() {
return CommonResult.success(toolKnowledgeService.getStats());
}
/**
* 为 cover_image 为空的饮食指南/科普文章生成封面图KieAI 1:1100KB 内,上传 OSS 并更新 v2_knowledge
*/
@@ -322,6 +334,19 @@ public class ToolController {
return CommonResult.success(updated);
}
// ==================== AI 营养填充T06/T07 ====================
/**
* 根据饮食描述文本,用 AI 估算营养数据(热量、蛋白质、钾、磷)
*/
@ApiOperation(value = "AI营养估算")
@PostMapping("/nutrition/fill-ai")
public CommonResult<Map<String, Object>> fillNutritionByAi(@RequestBody Map<String, Object> data) {
String text = data != null && data.containsKey("text") ? String.valueOf(data.get("text")) : null;
Map<String, Object> result = toolNutritionFillService.fillFromText(text);
return CommonResult.success(result);
}
// ==================== 打卡社区相关 ====================
/**
@@ -352,6 +377,16 @@ public class ToolController {
return CommonResult.success(toolCommunityService.publish(data));
}
/**
* 帖子营养 AI 填充:根据帖子标题与内容用 AI 估算营养数据并更新帖子
*/
@ApiOperation(value = "帖子营养AI填充")
@PostMapping("/community/post/{postId}/fill-nutrition")
public CommonResult<Map<String, Object>> fillPostNutrition(
@ApiParam(value = "帖子ID", required = true) @PathVariable Long postId) {
return CommonResult.success(toolCommunityService.fillNutrition(postId));
}
/**
* 点赞/取消点赞
*/
@@ -548,10 +583,22 @@ public class ToolController {
@ApiOperation(value = "收藏/取消收藏食谱")
@PostMapping("/recipe/favorite")
public CommonResult<String> toggleRecipeFavorite(@RequestBody Map<String, Object> data) {
toolRecipeService.toggleFavorite((Long) data.get("recipeId"), (Boolean) data.get("isFavorite"));
Long recipeId = ((Number) data.get("recipeId")).longValue();
Boolean isFavorite = (Boolean) data.get("isFavorite");
toolRecipeService.toggleFavorite(recipeId, isFavorite);
return CommonResult.success("操作成功");
}
/**
* 食谱营养 AI 填充:根据食谱食材用 Coze AI 分析并填充营养数据(能量、蛋白质、钾、磷、钠),更新食谱并返回
*/
@ApiOperation(value = "食谱营养AI填充")
@PostMapping("/recipe/{recipeId}/fill-nutrition")
public CommonResult<Map<String, Object>> fillRecipeNutrition(
@ApiParam(value = "食谱ID", required = true) @PathVariable Long recipeId) {
return CommonResult.success(toolRecipeService.fillNutrition(recipeId));
}
// ==================== 文件上传相关 ====================
/**