|
@@ -1,6 +1,5 @@
|
|
package cn.com.qmth.examcloud.core.examwork.service.impl;
|
|
package cn.com.qmth.examcloud.core.examwork.service.impl;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -31,6 +30,9 @@ import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamEntity;
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStudentEntity;
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStudentEntity;
|
|
import cn.com.qmth.examcloud.core.examwork.service.ExamStudentService;
|
|
import cn.com.qmth.examcloud.core.examwork.service.ExamStudentService;
|
|
import cn.com.qmth.examcloud.core.examwork.service.bean.ExamStudentInfo;
|
|
import cn.com.qmth.examcloud.core.examwork.service.bean.ExamStudentInfo;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.ExamRecordCloudService;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.request.CheckExamIsStartedReq;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.api.response.CheckExamIsStartedResp;
|
|
import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
|
|
import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
|
|
import cn.com.qmth.examcloud.task.api.request.SyncExamStudentReq;
|
|
import cn.com.qmth.examcloud.task.api.request.SyncExamStudentReq;
|
|
|
|
|
|
@@ -69,6 +71,19 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
@Autowired
|
|
@Autowired
|
|
DataSyncCloudService dataSyncCloudService;
|
|
DataSyncCloudService dataSyncCloudService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ ExamRecordCloudService examRecordCloudService;
|
|
|
|
+
|
|
|
|
+ private boolean isStarted(Long examId, Long StudentId, Long courseId) {
|
|
|
|
+ CheckExamIsStartedReq checkExamIsStartedReq = new CheckExamIsStartedReq();
|
|
|
|
+ checkExamIsStartedReq.setExamId(examId);
|
|
|
|
+ checkExamIsStartedReq.setCourseId(courseId);
|
|
|
|
+ checkExamIsStartedReq.setStudentId(StudentId);
|
|
|
|
+ CheckExamIsStartedResp checkExamIsStartedResp = examRecordCloudService
|
|
|
|
+ .checkExamIsStarted(checkExamIsStartedReq);
|
|
|
|
+ return checkExamIsStartedResp.getIsStarted();
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 方法注释
|
|
* 方法注释
|
|
*
|
|
*
|
|
@@ -80,7 +95,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
List<ExamStudentEntity> examStudents = examStudentRepo.findByIdIn(ids);
|
|
List<ExamStudentEntity> examStudents = examStudentRepo.findByIdIn(ids);
|
|
for (ExamStudentEntity examStudent : examStudents) {
|
|
for (ExamStudentEntity examStudent : examStudents) {
|
|
// 网考判断
|
|
// 网考判断
|
|
- if (System.currentTimeMillis() > 0) {
|
|
|
|
|
|
+ if (isStarted(examStudent.getExamId(), null, null)) {
|
|
throw new StatusException("E-150112", examStudent.getName() + "已开始考试,不能删除");
|
|
throw new StatusException("E-150112", examStudent.getName() + "已开始考试,不能删除");
|
|
}
|
|
}
|
|
examStudentRepo.delete(examStudent);
|
|
examStudentRepo.delete(examStudent);
|
|
@@ -114,7 +129,7 @@ public class ExamStudentServiceImpl implements ExamStudentService {
|
|
public void deleteExamStudentsByExamId(Long examId) {
|
|
public void deleteExamStudentsByExamId(Long examId) {
|
|
ExamEntity exam = examRepo.findOne(examId);
|
|
ExamEntity exam = examRepo.findOne(examId);
|
|
// 已经开考
|
|
// 已经开考
|
|
- if (exam.getBeginTime().before(new Date())) {
|
|
|
|
|
|
+ if (isStarted(exam.getId(), null, null)) {
|
|
throw new StatusException("E-150113", "该考试已开始,不能删除");
|
|
throw new StatusException("E-150113", "该考试已开始,不能删除");
|
|
}
|
|
}
|
|
examStudentRepo.deleteByExamId(examId);
|
|
examStudentRepo.deleteByExamId(examId);
|