|
@@ -232,6 +232,10 @@ public class DataUploadService {
|
|
|
public ExcelError handle(Object obj) {
|
|
|
try {
|
|
|
StudentDTO dto = (StudentDTO) obj;
|
|
|
+ //校验excel文件中数据是否完整
|
|
|
+ if (!checkObjFieldIsNotNull(dto)) {
|
|
|
+ throw new RuntimeException("考生信息缺失");
|
|
|
+ }
|
|
|
|
|
|
String examNumber = dto.getExamNumber();
|
|
|
//如果没有设置区域代码,用准考证前2位作为区域代码
|
|
@@ -252,9 +256,6 @@ public class DataUploadService {
|
|
|
if (student == null && !isAbsent) {
|
|
|
student = new Student(dto.getName(), dto.getExamNumber(), dto.getAreaName(), dto.getAreaCode(),
|
|
|
workId, dto.getExamRoom(), dto.getSourceName(), String.valueOf(TrialEnum.DEFAULT.getId()));
|
|
|
- if (!checkObjFieldIsNotNull(student)) {
|
|
|
- throw new RuntimeException("考生信息缺失");
|
|
|
- }
|
|
|
studentRepo.save(student);
|
|
|
} else if (student != null) {
|
|
|
if (isAbsent) {
|
|
@@ -280,9 +281,6 @@ public class DataUploadService {
|
|
|
student.setExamRoom(dto.getExamRoom());
|
|
|
student.setSourceName(dto.getSourceName());
|
|
|
}
|
|
|
- if (!checkObjFieldIsNotNull(student)) {
|
|
|
- throw new RuntimeException("考生信息缺失");
|
|
|
- }
|
|
|
studentRepo.save(student);
|
|
|
}
|
|
|
return null;
|
|
@@ -517,7 +515,7 @@ public class DataUploadService {
|
|
|
*/
|
|
|
private boolean checkObjFieldIsNotNull(Object obj) {
|
|
|
for (Field field : obj.getClass().getDeclaredFields()) {
|
|
|
- if (Objects.equals("id", field.getName()) || Objects.equals("test", field.getName())) {
|
|
|
+ if (Objects.equals("id", field.getName()) || Objects.equals("test", field.getName()) || Objects.equals("workId", field.getName())) {
|
|
|
continue;
|
|
|
}
|
|
|
field.setAccessible(true);
|