|
@@ -1,7 +1,9 @@
|
|
|
package com.etotem.cfc.controller;
|
|
package com.etotem.cfc.controller;
|
|
|
|
|
|
|
|
import com.etotem.cfc.common.Result;
|
|
import com.etotem.cfc.common.Result;
|
|
|
|
|
+import com.etotem.cfc.service.GrowthMilestoneService;
|
|
|
import com.etotem.cfc.service.GrowthRecommendationService;
|
|
import com.etotem.cfc.service.GrowthRecommendationService;
|
|
|
|
|
+import com.etotem.cfc.util.ParamUtils;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -19,6 +21,9 @@ public class GrowthController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private GrowthRecommendationService growthRecommendationService;
|
|
private GrowthRecommendationService growthRecommendationService;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private GrowthMilestoneService growthMilestoneService;
|
|
|
|
|
+
|
|
|
@Operation(summary = "获取成长板块推荐内容")
|
|
@Operation(summary = "获取成长板块推荐内容")
|
|
|
@PostMapping("/recommendations")
|
|
@PostMapping("/recommendations")
|
|
|
public Result<Map<String, Object>> getRecommendations(
|
|
public Result<Map<String, Object>> getRecommendations(
|
|
@@ -45,4 +50,38 @@ public class GrowthController {
|
|
|
@RequestParam(defaultValue = "20") int batchSize) {
|
|
@RequestParam(defaultValue = "20") int batchSize) {
|
|
|
return Result.success(growthRecommendationService.autoClassifyProducts(batchSize));
|
|
return Result.success(growthRecommendationService.autoClassifyProducts(batchSize));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // ========== 成长里程碑(SC-P-51 / 缺口 G-2:growth.milestone.mark)==========
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "标记成长里程碑(系统/手动标,返回里程碑ID,幂等)")
|
|
|
|
|
+ @PostMapping("/milestone/mark")
|
|
|
|
|
+ public Result<Long> markMilestone(@RequestBody Map<String, Object> body,
|
|
|
|
|
+ @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
|
|
|
|
|
+ Long memberId = ParamUtils.getLong(body.get("memberId"), currentMemberId);
|
|
|
|
|
+ Long recordId = ParamUtils.getLong(body.get("recordId"));
|
|
|
|
|
+ String milestoneType = body.get("milestoneType") != null
|
|
|
|
|
+ ? body.get("milestoneType").toString() : "manual";
|
|
|
|
|
+ if (memberId == null || recordId == null) {
|
|
|
|
|
+ return Result.error("缺少必要参数: memberId, recordId");
|
|
|
|
|
+ }
|
|
|
|
|
+ Long milestoneId = growthMilestoneService.markMilestone(memberId, recordId, milestoneType);
|
|
|
|
|
+ return Result.success("标记成功", milestoneId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "查询成长记录是否已标记里程碑(时间线高亮判定)")
|
|
|
|
|
+ @PostMapping("/milestone/marked")
|
|
|
|
|
+ public Result<Map<String, Object>> isMilestoneMarked(@RequestBody Map<String, Object> body,
|
|
|
|
|
+ @RequestAttribute(value = "currentMemberId", required = false) Long currentMemberId) {
|
|
|
|
|
+ Long memberId = ParamUtils.getLong(body.get("memberId"), currentMemberId);
|
|
|
|
|
+ Long recordId = ParamUtils.getLong(body.get("recordId"));
|
|
|
|
|
+ String milestoneType = body.get("milestoneType") != null
|
|
|
|
|
+ ? body.get("milestoneType").toString() : "manual";
|
|
|
|
|
+ if (memberId == null || recordId == null) {
|
|
|
|
|
+ return Result.error("缺少必要参数: memberId, recordId");
|
|
|
|
|
+ }
|
|
|
|
|
+ boolean marked = growthMilestoneService.isMarked(memberId, recordId, milestoneType);
|
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
|
|
+ result.put("marked", marked);
|
|
|
|
|
+ return Result.success(result);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|