|
@@ -11,7 +11,9 @@ import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
import java.util.stream.Stream;
|
|
|
|
|
@@ -97,7 +99,7 @@ public class ExamStudentApi {
|
|
|
if (accessUser.getRootOrgId().longValue() == accessUser.getOrgId().longValue()
|
|
|
|| examStudent.getStudentId() != null) {
|
|
|
examStudent.setRootOrgId(accessUser.getRootOrgId());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
examStudent.setOrgId(accessUser.getOrgId());
|
|
|
}
|
|
|
} else {
|
|
@@ -116,7 +118,7 @@ public class ExamStudentApi {
|
|
|
if (accessUser.getRootOrgId().longValue() == accessUser.getOrgId().longValue()
|
|
|
|| examStudent.getStudentId() != null) {
|
|
|
examStudent.setRootOrgId(accessUser.getRootOrgId());
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
examStudent.setOrgId(accessUser.getOrgId());
|
|
|
}
|
|
|
}
|
|
@@ -140,7 +142,7 @@ public class ExamStudentApi {
|
|
|
}
|
|
|
Exam exam = examRepo.findOne(examStudent.getExam().getId());
|
|
|
examStudent.setExam(exam);
|
|
|
- if(StringUtils.isEmpty(examStudent.getPaperType())){
|
|
|
+ if (StringUtils.isEmpty(examStudent.getPaperType())) {
|
|
|
examStudent.setPaperType("O");
|
|
|
}
|
|
|
ExamStudent saveExamStu = examStudentService.saveExamStudent(examStudent);
|
|
@@ -157,7 +159,7 @@ public class ExamStudentApi {
|
|
|
try {
|
|
|
Exam exam = examRepo.findOne(examStudent.getExam().getId());
|
|
|
examStudent.setExam(exam);
|
|
|
- if(StringUtils.isEmpty(examStudent.getPaperType())){
|
|
|
+ if (StringUtils.isEmpty(examStudent.getPaperType())) {
|
|
|
examStudent.setPaperType("O");
|
|
|
}
|
|
|
ExamStudent saveExamStu = examStudentService.saveExamStudent(examStudent);
|
|
@@ -179,7 +181,7 @@ public class ExamStudentApi {
|
|
|
@ApiOperation(value = "按ID删除考试学生", notes = "删除")
|
|
|
@DeleteMapping("/{id}")
|
|
|
public ResponseEntity deleteExamStudent(@PathVariable String id) {
|
|
|
- List<Long> examStuIds = Stream.of(id.split(",")).map(s->Long.parseLong(s.trim()))
|
|
|
+ List<Long> examStuIds = Stream.of(id.split(",")).map(s -> Long.parseLong(s.trim()))
|
|
|
.collect(Collectors.toList());
|
|
|
try {
|
|
|
examStudentService.deleteExamStudent(examStuIds);
|
|
@@ -198,7 +200,7 @@ public class ExamStudentApi {
|
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
- return new ResponseEntity(new ErrorMsg(e.getMessage()),HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
+ return new ResponseEntity(new ErrorMsg(e.getMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -267,4 +269,17 @@ public class ExamStudentApi {
|
|
|
return new ResponseEntity(new ErrorMsg(e.getMessage()), HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "考生完成数量", notes = "考生完成数量")
|
|
|
+ @PostMapping("/count-by-finished")
|
|
|
+ public Map<String, Integer> countByFinished(@RequestParam Long examId) {
|
|
|
+
|
|
|
+ int finished = examStudentRepo.countByExamIdAndFinished(examId, true);
|
|
|
+ int unFinished = examStudentRepo.countByExamIdAndFinished(examId, false);
|
|
|
+ Map<String, Integer> result = new HashMap<>();
|
|
|
+ result.put("finished", finished);
|
|
|
+ result.put("unFinished", unFinished);
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|