|
@@ -10,15 +10,19 @@ import org.springframework.stereotype.Service;
|
|
|
import com.qmth.boot.core.concurrent.service.ConcurrentService;
|
|
|
|
|
|
import cn.com.qmth.am.config.SysProperty;
|
|
|
+import cn.com.qmth.am.entity.StudentEntity;
|
|
|
import cn.com.qmth.am.entity.StudentScoreEntity;
|
|
|
import cn.com.qmth.am.enums.LockType;
|
|
|
import cn.com.qmth.am.service.StudentScoreService;
|
|
|
+import cn.com.qmth.am.service.StudentService;
|
|
|
|
|
|
@Service
|
|
|
public class AiMarkingJob {
|
|
|
@Autowired
|
|
|
private StudentScoreService studentScoreService;
|
|
|
@Autowired
|
|
|
+ private StudentService studentService;
|
|
|
+ @Autowired
|
|
|
private ConcurrentService concurrentService;
|
|
|
@Autowired
|
|
|
private SysProperty sysProperty;
|
|
@@ -28,8 +32,8 @@ public class AiMarkingJob {
|
|
|
if(!sysProperty.getMarkingTaskEnable()) {
|
|
|
return;
|
|
|
}
|
|
|
- List<StudentScoreEntity> scores = studentScoreService.findAllToAiMarking();
|
|
|
- if (CollectionUtils.isEmpty(scores)) {
|
|
|
+ List<StudentEntity> students=studentService.findToMrking();
|
|
|
+ if (CollectionUtils.isEmpty(students)) {
|
|
|
return;
|
|
|
}
|
|
|
boolean lock = concurrentService.getReadWriteLock(LockType.AI_MARKING.name()).writeLock().tryLock();
|
|
@@ -37,7 +41,7 @@ public class AiMarkingJob {
|
|
|
if (!lock) {
|
|
|
return;
|
|
|
}
|
|
|
- this.dispose(scores);
|
|
|
+ this.dispose(students);
|
|
|
} finally {
|
|
|
if (lock) {
|
|
|
concurrentService.getReadWriteLock(LockType.AI_MARKING.name()).writeLock().unlock();
|
|
@@ -45,12 +49,17 @@ public class AiMarkingJob {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void dispose(List<StudentScoreEntity> scores) {
|
|
|
- for (StudentScoreEntity score : scores) {
|
|
|
+ private void dispose(List<StudentEntity> students) {
|
|
|
+ for (StudentEntity student : students) {
|
|
|
if(!sysProperty.getMarkingTaskEnable()) {
|
|
|
return;
|
|
|
}
|
|
|
- studentScoreService.aiMarking(score);
|
|
|
+ List<StudentScoreEntity> scores = studentScoreService.findToAiMarking(student.getId());
|
|
|
+ if (CollectionUtils.isNotEmpty(scores)) {
|
|
|
+ for (StudentScoreEntity score : scores) {
|
|
|
+ studentScoreService.aiMarking(score);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|