|
@@ -6,13 +6,16 @@ import com.etotem.cfc.dto.RecommendationResult;
|
|
|
import com.etotem.cfc.service.RecommendationService;
|
|
import com.etotem.cfc.service.RecommendationService;
|
|
|
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.PathVariable;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
@Tag(name = "营养推荐", description = "精准营养推荐搜索")
|
|
@Tag(name = "营养推荐", description = "精准营养推荐搜索")
|
|
|
@RestController
|
|
@RestController
|
|
@@ -29,4 +32,32 @@ public class RecommendationController {
|
|
|
List<RecommendationResult> results = recommendationService.search(query);
|
|
List<RecommendationResult> results = recommendationService.search(query);
|
|
|
return Result.success(results);
|
|
return Result.success(results);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "按维度获取匹配商品")
|
|
|
|
|
+ @PostMapping("/dimension-products")
|
|
|
|
|
+ public Result<List<RecommendationResult>> dimensionProducts(
|
|
|
|
|
+ @RequestBody Map<String, Object> params) {
|
|
|
|
|
+ String dimensionCode = (String) params.get("dimensionCode");
|
|
|
|
|
+ Long familyId = params.get("familyId") != null ? ((Number) params.get("familyId")).longValue() : null;
|
|
|
|
|
+ Integer limit = params.get("limit") != null ? ((Number) params.get("limit")).intValue() : null;
|
|
|
|
|
+ List<RecommendationResult> results = recommendationService.getDimensionProducts(dimensionCode, familyId, limit);
|
|
|
|
|
+ return Result.success(results);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "获取用户复购提醒列表")
|
|
|
|
|
+ @PostMapping("/repurchase-reminders")
|
|
|
|
|
+ public Result<List<RecommendationResult>> repurchaseReminders(
|
|
|
|
|
+ HttpServletRequest request) {
|
|
|
|
|
+ Long userId = (Long) request.getAttribute("userId");
|
|
|
|
|
+ List<RecommendationResult> results = recommendationService.getRepurchaseReminders(userId);
|
|
|
|
|
+ return Result.success(results);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "标记复购提醒已点击")
|
|
|
|
|
+ @PostMapping("/repurchase-reminder/{id}/click")
|
|
|
|
|
+ public Result<?> clickRepurchaseReminder(
|
|
|
|
|
+ @PathVariable Long id) {
|
|
|
|
|
+ recommendationService.markRepurchaseClicked(id);
|
|
|
|
|
+ return Result.success(null);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|