|
|
@@ -1,16 +1,17 @@
|
|
|
package cn.seecoder.seecoderbokserver.web.rest;
|
|
|
|
|
|
-import apple.laf.JRSUIConstants;
|
|
|
import cn.seecoder.bok.common.QuestionState;
|
|
|
import cn.seecoder.bok.common.QuestionType;
|
|
|
import cn.seecoder.bok.common.UserRole;
|
|
|
import cn.seecoder.bok.common.api.SeecoderBokQuestionApi;
|
|
|
import cn.seecoder.bok.common.api.SeecoderBokQuestionQueryApi;
|
|
|
+import cn.seecoder.bok.common.vo.GraspVO;
|
|
|
import cn.seecoder.bok.common.vo.QuestionVO;
|
|
|
import cn.seecoder.seecoderbokserver.aspect.auth.Authorized;
|
|
|
import cn.seecoder.seecoderbokserver.domain.Question;
|
|
|
import cn.seecoder.seecoderbokserver.mapper.QuestionConvertor;
|
|
|
import cn.seecoder.seecoderbokserver.mapper.QuestionMapper;
|
|
|
+import cn.seecoder.seecoderbokserver.service.GraspService;
|
|
|
import cn.seecoder.seecoderbokserver.service.QuestionService;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
@@ -23,6 +24,7 @@ import javax.validation.constraints.NotNull;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
+import java.util.stream.Collector;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.StreamSupport;
|
|
|
|
|
|
@@ -35,10 +37,12 @@ public class QuestionController implements SeecoderBokQuestionApi, SeecoderBokQu
|
|
|
|
|
|
private final QuestionService questionService;
|
|
|
private final QuestionMapper questionMapper;
|
|
|
+ private final GraspService graspService;
|
|
|
|
|
|
- public QuestionController(QuestionService questionService, QuestionMapper questionMapper) {
|
|
|
+ public QuestionController(QuestionService questionService, QuestionMapper questionMapper, GraspService graspService) {
|
|
|
this.questionService = questionService;
|
|
|
this.questionMapper = questionMapper;
|
|
|
+ this.graspService = graspService;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -138,10 +142,23 @@ public class QuestionController implements SeecoderBokQuestionApi, SeecoderBokQu
|
|
|
public Response findUncheckedQuestion(
|
|
|
@RequestParam(name = "state") QuestionState questionState,
|
|
|
@RequestParam(name = "offset", required = false) int offset,
|
|
|
- @RequestParam(name = "pageSize", required = false) int pageSize
|
|
|
- ){
|
|
|
+ @RequestParam(name = "pageSize", required = false) int pageSize) {
|
|
|
Pageable pageable = PageRequest.of(offset, pageSize);
|
|
|
return Response.buildSuccess(questionService.findUncheckedQuestion(questionState, pageable));
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/grasp")
|
|
|
+ public Response getAllGrasp() {
|
|
|
+ return Response.buildSuccess(graspService.getAll());
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/grasp/{question}")
|
|
|
+ public Response getAllGraspByQuestion(@PathVariable Integer question) {
|
|
|
+ return Response.buildSuccess(graspService.getAllByQuestion(question));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/grasp")
|
|
|
+ public Response updateGrasp(@RequestBody GraspVO graspVO) {
|
|
|
+ return Response.buildSuccess(graspService.save(graspVO));
|
|
|
+ }
|
|
|
}
|