|
@@ -46,67 +46,67 @@ public class ExamStudentApi {
|
|
|
|
|
|
@Autowired
|
|
|
ExamStudentService examStudentService;
|
|
|
-
|
|
|
+
|
|
|
@Autowired
|
|
|
ExamStudentAssembler examStudentAssembler;
|
|
|
|
|
|
- @ApiOperation(value="查询考试学生带条件和分页",notes = "带条件带分页")
|
|
|
+ @ApiOperation(value = "查询考试学生带条件和分页", notes = "带条件带分页")
|
|
|
@GetMapping("/all/{curPage}/{pageSize}")
|
|
|
- public ResponseEntity getAllExamStudent(@ModelAttribute ExamStudentDTO examStudent, @PathVariable Integer curPage, @PathVariable Integer pageSize){
|
|
|
- return new ResponseEntity(examStudentService.getAllExamStudent(examStudent,new PageRequest(curPage - 1,pageSize)),HttpStatus.OK);
|
|
|
+ public ResponseEntity getAllExamStudent(@ModelAttribute ExamStudentDTO examStudent, @PathVariable Integer curPage, @PathVariable Integer pageSize) {
|
|
|
+ return new ResponseEntity(examStudentService.getAllExamStudent(examStudent, new PageRequest(curPage, pageSize)), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="查询所有考试学生带条件",notes = "带条件不分页")
|
|
|
+ @ApiOperation(value = "查询所有考试学生带条件", notes = "带条件不分页")
|
|
|
@GetMapping("/all")
|
|
|
- public ResponseEntity getAllExamStudent(@ModelAttribute ExamStudentDTO examStudent){
|
|
|
+ public ResponseEntity getAllExamStudent(@ModelAttribute ExamStudentDTO examStudent) {
|
|
|
return new ResponseEntity(examStudentService.getAllExamStudent(examStudent), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="按ID查询考试学生",notes = "ID查询")
|
|
|
+ @ApiOperation(value = "按ID查询考试学生", notes = "ID查询")
|
|
|
@GetMapping("/{id}")
|
|
|
- public ResponseEntity<ExamStudent> getExamStudentById(@PathVariable Long id){
|
|
|
- return new ResponseEntity<ExamStudent>(examStudentService.getExamStudentById(id),HttpStatus.OK);
|
|
|
+ public ResponseEntity<ExamStudent> getExamStudentById(@PathVariable Long id) {
|
|
|
+ return new ResponseEntity<ExamStudent>(examStudentService.getExamStudentById(id), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="新增考试学生",notes = "新增")
|
|
|
+ @ApiOperation(value = "新增考试学生", notes = "新增")
|
|
|
@PostMapping()
|
|
|
- public ResponseEntity addExamStudent(@RequestBody ExamStudent examStudent){
|
|
|
- return new ResponseEntity<ExamStudent>(examStudentService.saveExamStudent(examStudent),HttpStatus.OK);
|
|
|
+ public ResponseEntity addExamStudent(@RequestBody ExamStudent examStudent) {
|
|
|
+ return new ResponseEntity<ExamStudent>(examStudentService.saveExamStudent(examStudent), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="更新考试学生",notes = "更新")
|
|
|
+ @ApiOperation(value = "更新考试学生", notes = "更新")
|
|
|
@PutMapping()
|
|
|
- public ResponseEntity updateExamStudent(@RequestBody ExamStudent examStudent){
|
|
|
- return new ResponseEntity(examStudentService.saveExamStudent(examStudent),HttpStatus.OK);
|
|
|
+ public ResponseEntity updateExamStudent(@RequestBody ExamStudent examStudent) {
|
|
|
+ return new ResponseEntity(examStudentService.saveExamStudent(examStudent), HttpStatus.OK);
|
|
|
}
|
|
|
-
|
|
|
- @ApiOperation(value="更新考试学生缺考状态",notes = "更新缺考")
|
|
|
+
|
|
|
+ @ApiOperation(value = "更新考试学生缺考状态", notes = "更新缺考")
|
|
|
@PutMapping("/{id}")
|
|
|
- public ResponseEntity<ExamStudent> getExamStudentById(@PathVariable Long id,@RequestParam boolean finished){
|
|
|
- ExamStudent examStudent = examStudentRepo.findOne(id);
|
|
|
- examStudent.setFinished(finished);
|
|
|
- return new ResponseEntity<ExamStudent>(examStudentRepo.save(examStudent),HttpStatus.OK);
|
|
|
+ public ResponseEntity<ExamStudent> getExamStudentById(@PathVariable Long id, @RequestParam boolean finished) {
|
|
|
+ ExamStudent examStudent = examStudentRepo.findOne(id);
|
|
|
+ examStudent.setFinished(finished);
|
|
|
+ return new ResponseEntity<ExamStudent>(examStudentRepo.save(examStudent), HttpStatus.OK);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value="按ID删除考试学生",notes = "删除")
|
|
|
+ @ApiOperation(value = "按ID删除考试学生", notes = "删除")
|
|
|
@DeleteMapping("/{id}")
|
|
|
- public ResponseEntity deleteExamStudent(@PathVariable Long id){
|
|
|
- examStudentService.deleteExamStudent(id);
|
|
|
+ public ResponseEntity deleteExamStudent(@PathVariable Long id) {
|
|
|
+ examStudentService.deleteExamStudent(id);
|
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
|
}
|
|
|
-
|
|
|
- @ApiOperation(value="导入考试学生",notes = "导入")
|
|
|
+
|
|
|
+ @ApiOperation(value = "导入考试学生", notes = "导入")
|
|
|
@PostMapping("/import")
|
|
|
- public ResponseEntity importExamStudent(@RequestParam Long examId,@RequestParam MultipartFile file){
|
|
|
- try {
|
|
|
- List<ExcelError> excelErrors = examStudentService.importExamStudent(examId,file.getInputStream());
|
|
|
- return new ResponseEntity(excelErrors,HttpStatus.OK);
|
|
|
- } catch (IOException e) {
|
|
|
- e.printStackTrace();
|
|
|
- return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
+ public ResponseEntity importExamStudent(@RequestParam Long examId, @RequestParam MultipartFile file) {
|
|
|
+ try {
|
|
|
+ List<ExcelError> excelErrors = examStudentService.importExamStudent(examId, file.getInputStream());
|
|
|
+ return new ResponseEntity(excelErrors, HttpStatus.OK);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// @ApiOperation(value="导入学生照片",notes = "导入")
|
|
|
// @PostMapping("/exam_student/import_photo")
|
|
|
// public ResponseEntity importPhoto(@RequestParam Long examId,@RequestParam MultipartFile file){
|
|
@@ -118,26 +118,26 @@ public class ExamStudentApi {
|
|
|
// return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
// }
|
|
|
// }
|
|
|
-
|
|
|
- @ApiOperation(value="照片检验",notes = "检验")
|
|
|
+
|
|
|
+ @ApiOperation(value = "照片检验", notes = "检验")
|
|
|
@PostMapping("/photo_check")
|
|
|
- public ResponseEntity photoCheck(@RequestParam Long examId){
|
|
|
- try {
|
|
|
- List<ErrorMsg> errorMsgs = examStudentService.photoCheck(examId);
|
|
|
- return new ResponseEntity(errorMsgs,HttpStatus.OK);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
- }
|
|
|
+ public ResponseEntity photoCheck(@RequestParam Long examId) {
|
|
|
+ try {
|
|
|
+ List<ErrorMsg> errorMsgs = examStudentService.photoCheck(examId);
|
|
|
+ return new ResponseEntity(errorMsgs, HttpStatus.OK);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- @ApiOperation(value="导出考试学生带条件",notes = "导出")
|
|
|
+
|
|
|
+ @ApiOperation(value = "导出考试学生带条件", notes = "导出")
|
|
|
@GetMapping("/export")
|
|
|
- public void exportExamStudent(@ModelAttribute ExamStudentDTO examCriteria,HttpServletResponse response){
|
|
|
- List<ExamStudentDTO> list = new ArrayList<ExamStudentDTO>();
|
|
|
- examStudentService.getAllExamStudent(examCriteria).forEach(c -> {
|
|
|
- list.add(examStudentAssembler.toDTO(c));
|
|
|
+ public void exportExamStudent(@ModelAttribute ExamStudentDTO examCriteria, HttpServletResponse response) {
|
|
|
+ List<ExamStudentDTO> list = new ArrayList<ExamStudentDTO>();
|
|
|
+ examStudentService.getAllExamStudent(examCriteria).forEach(c -> {
|
|
|
+ list.add(examStudentAssembler.toDTO(c));
|
|
|
});
|
|
|
- ExportUtils.exportEXCEL("课程列表", ExamStudentDTO.class, list, response);
|
|
|
+ ExportUtils.exportEXCEL("课程列表", ExamStudentDTO.class, list, response);
|
|
|
}
|
|
|
}
|