Joburgess 5 years ago
parent
commit
e35a2a4f29

+ 11 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRoomStudentRelationServiceImpl.java

@@ -10,6 +10,7 @@ import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.common.tenant.TenantContextHolder;
 import com.keao.edu.user.api.entity.ExamRoom;
 import com.keao.edu.user.api.entity.ExamRoomStudentRelation;
+import com.keao.edu.user.api.enums.ExamModeEnum;
 import com.keao.edu.user.dao.*;
 import com.keao.edu.user.dto.ExamRoomStudentRelationDto;
 import com.keao.edu.user.entity.*;
@@ -73,7 +74,13 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 		if(Objects.isNull(examRoom)){
 			throw new BizException("教室不存在");
 		}
-		ExamLocation examLocation = examLocationDao.get(examRoom.getExamLocationId());
+		ExamLocation examLocation = null;
+		if(ExamModeEnum.OFFLINE.equals(examRoom.getExamMode())){
+			examLocation = examLocationDao.get(examRoom.getExamLocationId());
+			if(Objects.isNull(examLocation)){
+				throw new BizException("考点信息错误");
+			}
+		}
 
 		List<ExamRoomStudentRelation> studentsWithExamRoom = examRoomStudentRelationDao.findStudentsWithExamRoom(examRoomId);
 		Set<Long> existRegistIds = studentsWithExamRoom.stream().map(ExamRoomStudentRelation::getExamRegistrationId).collect(Collectors.toSet());
@@ -121,7 +128,9 @@ public class ExamRoomStudentRelationServiceImpl extends BaseServiceImpl<Long, Ex
 			ec.setLevel(examRegistration.getLevel());
 			ec.setExamStartTime(examRoom.getExamStartTime());
 			ec.setExamEndTime(examRoom.getExamEndTime());
-			ec.setExamAddress(examLocation.getAddress());
+			if(ExamModeEnum.OFFLINE.equals(examRoom.getExamMode())){
+				ec.setExamAddress(examLocation.getAddress());
+			}
 			ec.setTenantId(TenantContextHolder.getTenantId());
 			examCertifications.add(ec);
 		}