|
@@ -154,16 +154,44 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentDao, ExamStud
|
|
|
List<ExcelError> excelErrors = excelReader.reader(file.getInputStream(), obj -> {
|
|
|
try {
|
|
|
StudentDTO dto = (StudentDTO) obj;
|
|
|
+ String nullError = "";
|
|
|
+
|
|
|
+ String examNumber = dto.getExamNumber();
|
|
|
+ String studentCode = dto.getStudentCode();
|
|
|
+ String name = dto.getName();
|
|
|
+ String subjectCode = dto.getCourseCode();
|
|
|
+ String subjectName = dto.getCourseName();
|
|
|
+
|
|
|
+ if (examNumber == null || examNumber.length() == 0) {
|
|
|
+ nullError = nullError + "[准考证号]";
|
|
|
+ }
|
|
|
+ if (studentCode == null || studentCode.length() == 0) {
|
|
|
+ nullError = nullError + "[学号]";
|
|
|
+ }
|
|
|
+ if (name == null || name.length() == 0) {
|
|
|
+ nullError = nullError + "[姓名]";
|
|
|
+ }
|
|
|
+ if (subjectCode == null || subjectCode.length() == 0) {
|
|
|
+ nullError = nullError + "[科目代码]";
|
|
|
+ }
|
|
|
+ if (subjectName == null || subjectName.length() == 0) {
|
|
|
+ nullError = nullError + "[科目名称]";
|
|
|
+ }
|
|
|
+ if (nullError.length() > 0) {
|
|
|
+ throw new StatusException(nullError + "不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
ExamStudentEntity examStudentEntity = new ExamStudentEntity();
|
|
|
examStudentEntity.setExamId(examId);
|
|
|
examStudentEntity.setOrgId(examEntity.getOrgId());
|
|
|
- examStudentEntity.setExamNumber(dto.getExamNumber());
|
|
|
- examStudentEntity.setStudentCode(dto.getStudentCode());
|
|
|
- examStudentEntity.setName(dto.getName());
|
|
|
- examStudentEntity.setCourseCode(dto.getCourseCode().concat("_").concat(dto.getCourseName()));
|
|
|
+ examStudentEntity.setExamNumber(examNumber);
|
|
|
+ examStudentEntity.setStudentCode(studentCode);
|
|
|
+ examStudentEntity.setName(name);
|
|
|
+ examStudentEntity.setCourseCode(subjectCode.concat(PmConstants.LING_SIGN).concat(subjectName));
|
|
|
examStudentEntity.setExamSite(dto.getExamSite());
|
|
|
examStudentEntity.setExamRoom(dto.getExamRoom());
|
|
|
examStudentEntity.setSortNo(aLong.getAndIncrement());
|
|
|
+ examStudentEntity.setExamUnit(dto.getExamUnit());
|
|
|
examStudentEntity.setCreateTime(new Date());
|
|
|
examStudentEntity.setUpdateTime(new Date());
|
|
|
studentList.add(examStudentEntity);
|
|
@@ -227,14 +255,40 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentDao, ExamStud
|
|
|
AtomicLong sort = new AtomicLong(1L);
|
|
|
List<ExcelError> excelErrors = excelReader.reader(FileUtil.getInputStream(studentExcel), obj -> {
|
|
|
try {
|
|
|
+ String nullError = "";
|
|
|
ExamStudentImportDTO dto = (ExamStudentImportDTO) obj;
|
|
|
+ String examNumber = dto.getExamNumber();
|
|
|
+ String studentCode = dto.getStudentCode();
|
|
|
+ String name = dto.getStudentName();
|
|
|
+ String subjectCode = dto.getCourseCode();
|
|
|
+ String subjectName = dto.getCourseName();
|
|
|
+
|
|
|
+ if (examNumber == null || examNumber.length() == 0) {
|
|
|
+ nullError = nullError + "[准考证号]";
|
|
|
+ }
|
|
|
+ if (studentCode == null || studentCode.length() == 0) {
|
|
|
+ nullError = nullError + "[学号]";
|
|
|
+ }
|
|
|
+ if (name == null || name.length() == 0) {
|
|
|
+ nullError = nullError + "[姓名]";
|
|
|
+ }
|
|
|
+ if (subjectCode == null || subjectCode.length() == 0) {
|
|
|
+ nullError = nullError + "[科目代码]";
|
|
|
+ }
|
|
|
+ if (subjectName == null || subjectName.length() == 0) {
|
|
|
+ nullError = nullError + "[科目名称]";
|
|
|
+ }
|
|
|
+ if (nullError.length() > 0) {
|
|
|
+ throw new StatusException(nullError + "不能为空");
|
|
|
+ }
|
|
|
+
|
|
|
ExamStudentEntity examStudentEntity = new ExamStudentEntity();
|
|
|
examStudentEntity.setExamId(examId);
|
|
|
examStudentEntity.setOrgId(examEntity.getOrgId());
|
|
|
- examStudentEntity.setExamNumber(dto.getExamNumber());
|
|
|
- examStudentEntity.setStudentCode(dto.getStudentCode());
|
|
|
- examStudentEntity.setName(dto.getStudentName());
|
|
|
- examStudentEntity.setCourseCode(dto.getCourseCode() + PmConstants.LING_SIGN + dto.getCourseName());
|
|
|
+ examStudentEntity.setExamNumber(examNumber);
|
|
|
+ examStudentEntity.setStudentCode(studentCode);
|
|
|
+ examStudentEntity.setName(name);
|
|
|
+ examStudentEntity.setCourseCode(subjectCode.concat(PmConstants.LING_SIGN).concat(subjectName));
|
|
|
examStudentEntity.setExamSite(dto.getExamPlaceName());
|
|
|
examStudentEntity.setSortNo(sort.getAndIncrement());
|
|
|
examStudentEntity.setExamUnit(dto.getExamUnit());
|