|
@@ -1,13 +1,9 @@
|
|
|
package cn.com.qmth.examcloud.tool.service;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.tool.config.SpringContextHolder;
|
|
|
import cn.com.qmth.examcloud.tool.dao.TaskRepository;
|
|
|
import cn.com.qmth.examcloud.tool.entity.TaskEntity;
|
|
|
import cn.com.qmth.examcloud.tool.enums.TaskStatus;
|
|
|
-import cn.com.qmth.examcloud.tool.enums.TaskType;
|
|
|
-import cn.com.qmth.examcloud.tool.service.config_exam_paper.ConfigExamPaperTask;
|
|
|
-import cn.com.qmth.examcloud.tool.service.create_random_paper_template.CreateRandomPaperTemplateTask;
|
|
|
-import cn.com.qmth.examcloud.tool.service.export_student_answer_and_score_detail.ExportStudentAnswerAndScoreDetailTask;
|
|
|
-import cn.com.qmth.examcloud.tool.service.update_correct_answer_and_re_fix_score.UpdateCorrectAnswerAndReFixScoreTask;
|
|
|
import cn.com.qmth.examcloud.tool.utils.StatusException;
|
|
|
import cn.com.qmth.examcloud.tool.vo.task.TaskAdd;
|
|
|
import cn.com.qmth.examcloud.tool.vo.task.TaskQuery;
|
|
@@ -37,18 +33,6 @@ public class TaskManager {
|
|
|
@Autowired
|
|
|
private TaskRepository taskRepository;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ExportStudentAnswerAndScoreDetailTask exportStudentAnswerAndScoreDetailTask;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private UpdateCorrectAnswerAndReFixScoreTask updateCorrectAnswerAndReFixScoreTask;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private ConfigExamPaperTask configExamPaperTask;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private CreateRandomPaperTemplateTask createRandomPaperTemplate;
|
|
|
-
|
|
|
public Page<TaskEntity> getTaskList(TaskQuery req) {
|
|
|
if (req.getPageNo() == null || req.getPageNo() < 1) {
|
|
|
req.setPageNo(1);
|
|
@@ -137,18 +121,8 @@ public class TaskManager {
|
|
|
taskRepository.save(task);
|
|
|
|
|
|
try {
|
|
|
- if (TaskType.EXPORT_STUDENT_ANSWER_AND_SCORE_DETAIL == task.getType()) {
|
|
|
- exportStudentAnswerAndScoreDetailTask.start(task);
|
|
|
- } else if (TaskType.UPDATE_CORRECT_ANSWER_AND_RE_FIX_SCORE == task.getType()) {
|
|
|
- updateCorrectAnswerAndReFixScoreTask.start(task);
|
|
|
- } else if (TaskType.CONFIG_EXAM_PAPER == task.getType()) {
|
|
|
- configExamPaperTask.start(task);
|
|
|
- } else if (TaskType.CREATE_RANDOM_PAPER_TEMPLATE == task.getType()) {
|
|
|
- createRandomPaperTemplate.start(task);
|
|
|
- } else {
|
|
|
- throw new StatusException("功能暂未实现!");
|
|
|
- }
|
|
|
-
|
|
|
+ TaskService taskService = SpringContextHolder.getBean(task.getType().getImpl());
|
|
|
+ taskService.start(task);
|
|
|
task.setStatus(TaskStatus.SUCCESS);
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.getMessage(), e);
|