|
@@ -1,26 +1,131 @@
|
|
|
package com.qmth.cqb.paper.web;
|
|
|
|
|
|
-import com.qmth.cqb.genpaper.dao.GenPaperRepo;
|
|
|
-import com.qmth.cqb.genpaper.service.GenPaperService;
|
|
|
-import com.qmth.cqb.question.dao.ImportPaperRepo;
|
|
|
-import com.qmth.cqb.question.service.ImportPaperService;
|
|
|
+import com.qmth.cqb.paper.model.Paper;
|
|
|
+import com.qmth.cqb.paper.service.PaperService;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
/**
|
|
|
* Created by songyue on 16/12/28.
|
|
|
*/
|
|
|
-@Controller
|
|
|
+@RestController
|
|
|
+@RequestMapping("${api_cqb}/")
|
|
|
public class PaperController {
|
|
|
@Autowired
|
|
|
- GenPaperService genPaperService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- GenPaperRepo genPaperRepo;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ImportPaperRepo importPaperRepo;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- ImportPaperService importPaperService;
|
|
|
+ PaperService paperService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增试卷
|
|
|
+ * @param paper
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/paper")
|
|
|
+ public ResponseEntity CreatePaper(@ModelAttribute Paper paper){
|
|
|
+ Paper tempPaper = paperService.savePaper(paper);
|
|
|
+ ResponseEntity rse = new ResponseEntity(tempPaper,HttpStatus.OK);
|
|
|
+ return rse;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据Id获取试卷
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value="获取单张试卷",notes="获取单张试卷")
|
|
|
+ @GetMapping(value = "/paper/{paper_id}")
|
|
|
+ public Paper getPaperById(@PathVariable String paper_id){
|
|
|
+ return paperService.findById(paper_id);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取卷库考试试卷
|
|
|
+ * @param paper_id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/paper/list/{exam_id}/{course_code}/{group_code}")
|
|
|
+ public List<Paper> listPaperById(
|
|
|
+ @PathVariable String exam_id,
|
|
|
+ @PathVariable String course_code,
|
|
|
+ @PathVariable String group_code){
|
|
|
+ return paperService.listExamPapers(Long.parseLong(exam_id), course_code, group_code);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增考试试卷
|
|
|
+ * @param exam_id
|
|
|
+ * @param course_code
|
|
|
+ * @param group_code
|
|
|
+ * @param paper_id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping(value = "/paper/join/{exam_id}/{course_code}/{group_code}/{paper_id}")
|
|
|
+ public ResponseEntity joinExamPaper(@PathVariable String exam_id,
|
|
|
+ @PathVariable String course_code,
|
|
|
+ @PathVariable String group_code,
|
|
|
+ @PathVariable String paper_id){
|
|
|
+ boolean falg = paperService.joinToExamPaper(Long.parseLong(exam_id), course_code, group_code, paper_id);
|
|
|
+ ResponseEntity rse = new ResponseEntity(falg,HttpStatus.OK);
|
|
|
+ return rse;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除考试试卷
|
|
|
+ * @param exam_id
|
|
|
+ * @param course_code
|
|
|
+ * @param group_code
|
|
|
+ * @param paper_id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @DeleteMapping(value = "/paper/release/{exam_id}/{course_code}/{group_code}/{paper_id}")
|
|
|
+ public ResponseEntity releaseExamPaper(@PathVariable String exam_id,
|
|
|
+ @PathVariable String course_code,
|
|
|
+ @PathVariable String group_code,
|
|
|
+ @PathVariable String paper_id){
|
|
|
+ boolean falg = paperService.releaseExamPaper(Long.parseLong(exam_id), course_code, group_code, paper_id);
|
|
|
+ ResponseEntity rse = new ResponseEntity(falg,HttpStatus.OK);
|
|
|
+ return rse;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取卷库考试试卷类型集合
|
|
|
+ * @param exam_id
|
|
|
+ * @param group_code
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/paper/listCode/{exam_id}/{group_code}")
|
|
|
+ public Set<String> listGroup(@PathVariable String exam_id,@PathVariable String group_code){
|
|
|
+ return paperService.listGroupCodes(Long.parseLong(exam_id), group_code);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除试卷类型
|
|
|
+ * @param exam_id
|
|
|
+ * @param course_code
|
|
|
+ * @param group_code
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @DeleteMapping(value = "/paper/deleteCode/{exam_id}/{course_code}/{group_code}")
|
|
|
+ public ResponseEntity deleteGropu(@PathVariable String exam_id,
|
|
|
+ @PathVariable String course_code,
|
|
|
+ @PathVariable String group_code){
|
|
|
+ boolean falg = paperService.deletGroupCode(Long.parseLong(exam_id), course_code, group_code);
|
|
|
+ ResponseEntity rse = new ResponseEntity(falg,HttpStatus.OK);
|
|
|
+ return rse;
|
|
|
+ }
|
|
|
}
|