|
@@ -1,12 +1,14 @@
|
|
|
package com.seec.bok.web.controller;
|
|
package com.seec.bok.web.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+import com.seec.bok.service.InteractiveService;
|
|
|
import com.seec.bok.web.dto.CollectDTO;
|
|
import com.seec.bok.web.dto.CollectDTO;
|
|
|
import com.seec.bok.web.dto.RateDTO;
|
|
import com.seec.bok.web.dto.RateDTO;
|
|
|
import com.seec.bok.web.util.FakeQuestionData;
|
|
import com.seec.bok.web.util.FakeQuestionData;
|
|
|
import com.seec.bok.web.vo.QuestionVO;
|
|
import com.seec.bok.web.vo.QuestionVO;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -15,14 +17,15 @@ import java.util.List;
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/api/user")
|
|
@RequestMapping("/api/user")
|
|
|
public class UserInteractiveController {
|
|
public class UserInteractiveController {
|
|
|
-
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private InteractiveService interactiveService;
|
|
|
@PostMapping("/{userId}/question/{questionId}/rate")
|
|
@PostMapping("/{userId}/question/{questionId}/rate")
|
|
|
@Operation(description = "记录用户对题目的评分信息")
|
|
@Operation(description = "记录用户对题目的评分信息")
|
|
|
public Object userRateQuestion(
|
|
public Object userRateQuestion(
|
|
|
@PathVariable String userId,
|
|
@PathVariable String userId,
|
|
|
@PathVariable String questionId,
|
|
@PathVariable String questionId,
|
|
|
@RequestBody RateDTO rateDTO) {
|
|
@RequestBody RateDTO rateDTO) {
|
|
|
- return new Object();
|
|
|
|
|
|
|
+ return interactiveService.addRate(userId,questionId,rateDTO.getRate());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/{userId}/question/{questionId}/collection")
|
|
@PostMapping("/{userId}/question/{questionId}/collection")
|
|
@@ -31,7 +34,7 @@ public class UserInteractiveController {
|
|
|
@PathVariable String userId,
|
|
@PathVariable String userId,
|
|
|
@PathVariable String questionId,
|
|
@PathVariable String questionId,
|
|
|
@RequestBody CollectDTO collectDTO) {
|
|
@RequestBody CollectDTO collectDTO) {
|
|
|
- return new Object();
|
|
|
|
|
|
|
+ return interactiveService.addCollect(userId,questionId,collectDTO.getCollect());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/{userId}/question")
|
|
@GetMapping("/{userId}/question")
|
|
@@ -43,6 +46,6 @@ public class UserInteractiveController {
|
|
|
Boolean collection,
|
|
Boolean collection,
|
|
|
@Parameter(description = "是否是用户打分的题目") @RequestParam(value = "rate", required = false)
|
|
@Parameter(description = "是否是用户打分的题目") @RequestParam(value = "rate", required = false)
|
|
|
Boolean rate) {
|
|
Boolean rate) {
|
|
|
- return FakeQuestionData.buildList();
|
|
|
|
|
|
|
+ return interactiveService.findInteractiveQuestions(userId,collection,rate);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|