|
@@ -6,6 +6,8 @@ import java.util.List;
|
|
|
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
@@ -38,6 +40,9 @@ import cn.com.qmth.examcloud.service.examwork.service.rpc.StudentService;
|
|
|
*/
|
|
|
@Service
|
|
|
public class ExamStudentService {
|
|
|
+
|
|
|
+ protected static final Logger log = LoggerFactory.getLogger(ExamStudentService.class);
|
|
|
+
|
|
|
@Autowired
|
|
|
ExamStudentRepo examStudentRepo;
|
|
|
@Autowired
|
|
@@ -140,6 +145,7 @@ public class ExamStudentService {
|
|
|
* @return
|
|
|
*/
|
|
|
public List<ExcelError> importExamStudent(Long examId, InputStream inputStream) {
|
|
|
+ log.info("导入考生开始");
|
|
|
Exam exam = examRepo.findOne(examId);
|
|
|
List<ExcelError> excelErrors = new ArrayList<ExcelError>();
|
|
|
if(exam == null){
|
|
@@ -159,14 +165,19 @@ public class ExamStudentService {
|
|
|
if (error == null) {
|
|
|
examStudents.add(examStudentAssembler.toDomain(dto));
|
|
|
}
|
|
|
- if (examStudents.size() % 1000 == 0) {
|
|
|
+ int stu_num = examStudents.size();
|
|
|
+ if (stu_num % 5000 == 0) {
|
|
|
saveStudentList(examStudents);
|
|
|
+ log.info("已导入"+stu_num+"条数据");
|
|
|
}
|
|
|
return error;
|
|
|
}
|
|
|
|
|
|
});
|
|
|
+ int stu_num = examStudents.size();
|
|
|
saveStudentList(examStudents);
|
|
|
+ log.info("已导入"+stu_num+"条数据");
|
|
|
+ log.info("导入考生结束");
|
|
|
return excelErrors;
|
|
|
}
|
|
|
|