|
@@ -9,7 +9,6 @@ import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
-import org.springframework.core.task.AsyncTaskExecutor;
|
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
@@ -18,19 +17,16 @@ import cn.com.qmth.stmms.biz.campus.service.CampusService;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamStudent;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
|
|
import cn.com.qmth.stmms.biz.exam.model.ExamSubject;
|
|
import cn.com.qmth.stmms.biz.exam.model.MarkGroup;
|
|
import cn.com.qmth.stmms.biz.exam.model.MarkGroup;
|
|
|
|
+import cn.com.qmth.stmms.biz.exam.model.Marker;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamStudentService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
import cn.com.qmth.stmms.biz.exam.service.ExamSubjectService;
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkGroupService;
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkGroupService;
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkerService;
|
|
import cn.com.qmth.stmms.biz.exam.service.MarkerService;
|
|
-import cn.com.qmth.stmms.biz.lock.LockService;
|
|
|
|
import cn.com.qmth.stmms.biz.lock.impl.MemoryLockProvider;
|
|
import cn.com.qmth.stmms.biz.lock.impl.MemoryLockProvider;
|
|
import cn.com.qmth.stmms.biz.mark.service.MarkService;
|
|
import cn.com.qmth.stmms.biz.mark.service.MarkService;
|
|
-import cn.com.qmth.stmms.biz.mark.thread.MarkQualityThread;
|
|
|
|
import cn.com.qmth.stmms.biz.utils.FormalTaskUtil;
|
|
import cn.com.qmth.stmms.biz.utils.FormalTaskUtil;
|
|
import cn.com.qmth.stmms.biz.utils.TrialTaskUtil;
|
|
import cn.com.qmth.stmms.biz.utils.TrialTaskUtil;
|
|
-import cn.com.qmth.stmms.common.enums.LockType;
|
|
|
|
import cn.com.qmth.stmms.common.enums.MarkStatus;
|
|
import cn.com.qmth.stmms.common.enums.MarkStatus;
|
|
-import cn.com.qmth.stmms.common.utils.Callback;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 与评卷相关的所有定时任务
|
|
* 与评卷相关的所有定时任务
|
|
@@ -67,12 +63,6 @@ public class MarkCronService {
|
|
@Autowired
|
|
@Autowired
|
|
private MarkerService markerService;
|
|
private MarkerService markerService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private AsyncTaskExecutor taskExecutor;
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- private LockService mlockService;
|
|
|
|
-
|
|
|
|
@Value("${mark.cleanTimeoutMinute}")
|
|
@Value("${mark.cleanTimeoutMinute}")
|
|
private long timeoutMinute;
|
|
private long timeoutMinute;
|
|
|
|
|
|
@@ -146,25 +136,18 @@ public class MarkCronService {
|
|
List<MarkGroup> groups = groupService.findByExamAndSubjectAndStatus(examId, subject.getCode(), MarkStatus.FORMAL);
|
|
List<MarkGroup> groups = groupService.findByExamAndSubjectAndStatus(examId, subject.getCode(), MarkStatus.FORMAL);
|
|
for (MarkGroup markGroup : groups) {
|
|
for (MarkGroup markGroup : groups) {
|
|
if(!MarkStatus.FINISH.equals(markGroup.getStatus())){
|
|
if(!MarkStatus.FINISH.equals(markGroup.getStatus())){
|
|
- final String lockKey = getLockKey(examId, subject.getCode(), markGroup.getNumber());
|
|
|
|
- if (mlockService.trylock(LockType.GROUP, lockKey)) {
|
|
|
|
- taskExecutor.submit(new MarkQualityThread(
|
|
|
|
- markerService.findByExamAndSubjectAndGroup(examId, subject.getCode(), markGroup.getNumber()), new Callback() {
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void invoke() {
|
|
|
|
- mlockService.unlock(LockType.GROUP, lockKey);
|
|
|
|
- }
|
|
|
|
- }));
|
|
|
|
- }
|
|
|
|
|
|
+ List<Marker> markers = markerService.findByExamAndSubjectAndGroup(examId, subject.getCode(), markGroup.getNumber());
|
|
|
|
+ for (Marker marker : markers) {
|
|
|
|
+ try {
|
|
|
|
+ markService.updateQuality(marker);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("update marker quality error for markerId="+marker.getId(), e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- private String getLockKey(Integer examId, String subjectCode, Integer groupNumber) {
|
|
|
|
- return examId + "_" + subjectCode + "_" + groupNumber;
|
|
|
|
- }
|
|
|
|
|
|
|
|
private void buildLibraryByExam(Integer examId, Map<String, Campus> campusMap) {
|
|
private void buildLibraryByExam(Integer examId, Map<String, Campus> campusMap) {
|
|
// 获取主观题总分大于0的科目
|
|
// 获取主观题总分大于0的科目
|