|
@@ -63,9 +63,7 @@ public class ExamStudentService {
|
|
|
@Autowired
|
|
|
OrgService orgService;
|
|
|
|
|
|
- @Autowired
|
|
|
- OeService oeService;
|
|
|
-
|
|
|
+
|
|
|
// @Value("${app.em.photo.path}")
|
|
|
// private String PHOTO_PATH ;
|
|
|
// @Value("${app.em.facepp.key}")
|
|
@@ -197,10 +195,6 @@ public class ExamStudentService {
|
|
|
student.setRootOrgId(examStudent.getRootOrgId());
|
|
|
student.setStudentCode(examStudent.getStudentCode());
|
|
|
student.setIdentityNumber(examStudent.getIdentityNumber());
|
|
|
- examStudentRepo.updateById(examStudent.getIdentityNumber(),
|
|
|
- examStudent.getName(),
|
|
|
- examStudent.getSpecialtyName(),
|
|
|
- examStudent.getExamSite());
|
|
|
studentService.updateStudent(student);
|
|
|
}
|
|
|
examStudent.setFinished(false);
|
|
@@ -390,21 +384,38 @@ public class ExamStudentService {
|
|
|
List<ExamStudent> targetExamStudents = new ArrayList<ExamStudent>();
|
|
|
Exam targetExam = examRepo.findOne(targetExamId);
|
|
|
sourceExamStudents.stream().forEach(examStudent -> {
|
|
|
- ExamStudent tempStudent = BeanCopierUtil.copyProperties(examStudent,ExamStudent.class);
|
|
|
- tempStudent.setId(null);
|
|
|
- tempStudent.setExam(targetExam);
|
|
|
- targetExamStudents.add(tempStudent);
|
|
|
+ if(examStudentRepo.checkExamStuById(examStudent.getExam().getId(),
|
|
|
+ examStudent.getRootOrgId(),
|
|
|
+ examStudent.getIdentityNumber(),
|
|
|
+ examStudent.getCourseCode(),
|
|
|
+ examStudent.getId()) == 0){
|
|
|
+ ExamStudent tempStudent = BeanCopierUtil.copyProperties(examStudent,ExamStudent.class);
|
|
|
+ tempStudent.setId(null);
|
|
|
+ tempStudent.setExam(targetExam);
|
|
|
+ targetExamStudents.add(tempStudent);
|
|
|
+ }
|
|
|
});
|
|
|
examStudentRepo.save(targetExamStudents);
|
|
|
+ sourceExamStudents.clear();
|
|
|
+ targetExamStudents.clear();
|
|
|
}
|
|
|
|
|
|
public void deleteExamStudent(Long id)throws Exception{
|
|
|
ExamStudent examStudent = examStudentRepo.findOne(id);
|
|
|
- int examRecordCount = oeService.checkExamRecord(examStudent.getExam().getId(), examStudent.getIdentityNumber());
|
|
|
- if(examRecordCount > 0){
|
|
|
- throw new RuntimeException("该考生已有考试记录,不能删除");
|
|
|
- }else{
|
|
|
+ if(examStudent.getExam().getCanStuDel()){
|
|
|
examStudentRepo.delete(id);
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("该考试已开始,不能删除");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void deleteExamStudents(Long examId)throws Exception{
|
|
|
+ Exam exam = examRepo.findOne(examId);
|
|
|
+ if(exam.getCanStuDel()){
|
|
|
+ List<ExamStudent> examStudents = examStudentRepo.findByExamId(examId);
|
|
|
+ examStudentRepo.deleteInBatch(examStudents);
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("该考试已开始,不能删除");
|
|
|
}
|
|
|
}
|
|
|
}
|