|
@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
|
+import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.OrgCloudService;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
|
|
@@ -79,11 +80,27 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
@Autowired
|
|
|
ExamPaperTypeRelationRepo examPaperTypeRelationRepo;
|
|
|
|
|
|
- private boolean isStarted(Long examId, Long StudentId, Long courseId) {
|
|
|
- if (2 > 1) {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * 是否强制删除考生
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean forceDeleteExamStudent() {
|
|
|
+ boolean b = PropertiesUtil.getBoolean("$deleteExamStudent.force", false);
|
|
|
+ return b;
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 是否开考
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @param examId
|
|
|
+ * @param StudentId
|
|
|
+ * @param courseId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private boolean isStarted(Long examId, Long StudentId, Long courseId) {
|
|
|
CheckExamIsStartedReq checkExamIsStartedReq = new CheckExamIsStartedReq();
|
|
|
checkExamIsStartedReq.setExamId(examId);
|
|
|
checkExamIsStartedReq.setCourseId(courseId);
|
|
@@ -105,7 +122,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
|
|
|
for (ExamStudentEntity examStudent : examStudents) {
|
|
|
// 网考判断
|
|
|
- if (isStarted(examStudent.getExamId(), null, null)) {
|
|
|
+ if ((!forceDeleteExamStudent()) && isStarted(examStudent.getExamId(), null, null)) {
|
|
|
throw new StatusException("E-150112", examStudent.getName() + "已开始考试,不能删除");
|
|
|
}
|
|
|
examStudentRepo.delete(examStudent);
|
|
@@ -154,7 +171,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
|
public void deleteExamStudentsByExamId(Long examId) {
|
|
|
ExamEntity exam = examRepo.findOne(examId);
|
|
|
// 已经开考
|
|
|
- if (isStarted(exam.getId(), null, null)) {
|
|
|
+ if ((!forceDeleteExamStudent()) && isStarted(exam.getId(), null, null)) {
|
|
|
throw new StatusException("E-150113", "该考试已开始,不能删除");
|
|
|
}
|
|
|
examStudentRepo.deleteByExamId(examId);
|