From f2123ad78adc82f6a3e69a5603b6c0b110025236 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期五, 10 五月 2024 12:00:37 +0800
Subject: [PATCH] refactor:缺考新需求,移除延时保存补考用户功能

---
 src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java |   32 --------------------------------
 1 files changed, 0 insertions(+), 32 deletions(-)

diff --git a/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java b/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java
index f434bc1..cb4ac16 100644
--- a/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java
+++ b/src/main/java/com/mindskip/xzs/service/impl/ExamPaperServiceImpl.java
@@ -10,7 +10,6 @@
 import com.mindskip.xzs.domain.exam.ExamPaperTitleItemObject;
 import com.mindskip.xzs.domain.other.KeyValue;
 import com.mindskip.xzs.domain.vo.PaperExcelVO;
-import com.mindskip.xzs.queue.ExamPaperTimeTask;
 import com.mindskip.xzs.repository.ExamPaperMapper;
 import com.mindskip.xzs.repository.QuestionMapper;
 import com.mindskip.xzs.repository.UserDepartmentMapper;
@@ -20,7 +19,6 @@
 import com.mindskip.xzs.utility.ExamUtil;
 import com.mindskip.xzs.utility.JsonUtil;
 import com.mindskip.xzs.utility.ModelMapperSingle;
-import com.mindskip.xzs.utility.minio.DateUtils;
 import com.mindskip.xzs.viewmodel.admin.exam.*;
 import com.mindskip.xzs.viewmodel.admin.question.ExamQuestionVO;
 import com.mindskip.xzs.viewmodel.admin.question.QuestionEditRequestVM;
@@ -33,9 +31,7 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.annotation.PostConstruct;
 import java.util.*;
-import java.util.concurrent.DelayQueue;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 
@@ -55,24 +51,8 @@
     private final UserService userService;
     private final UserDepartmentMapper userDepartmentMapper;
     private final DepartmentService departmentService;
-    private final DelayQueue<ExamPaperTimeTask> QUEUE = new DelayQueue<>();
 
 
-    /**
-     * 灏嗚繘琛屼腑鐨勫畾鏃惰瘯鍗峰姞鍏ュ埌闃熷垪涓紝骞跺惎鍔ㄤ竴涓嚎绋嬫潵杞闃熷垪
-     */
-    @PostConstruct
-    public void pollQueue() {
-        examPaperMapper.selectTimeTaskPaper(DateUtils.getNowDate()).forEach(this::addTimeTask);
-        new Thread(() -> {
-            try {
-                ExamPaperTimeTask task = QUEUE.take();
-                saveMissExamUser(task.getExamPaperId());
-            } catch (InterruptedException e) {
-                Thread.currentThread().interrupt();
-            }
-        }).start();
-    }
 
     @Autowired
     public ExamPaperServiceImpl(ExamPaperMapper examPaperMapper, QuestionMapper questionMapper, TextContentService textContentService, QuestionService questionService, SubjectService subjectService, ExamPaperDepartmentService examPaperDepartmentService, ExamPaperSubjectService examPaperSubjectService, QuestionSubjectService questionSubjectService, ExamPaperUserService examPaperUserService, UserService userService, UserDepartmentMapper userDepartmentMapper, DepartmentService departmentService) {
@@ -616,16 +596,4 @@
         return randomNumber;
     }
 
-    @Override
-    public void addTimeTask(ExamPaper examPaper) {
-        ExamPaperTimeTask examPaperTimeTask = new ExamPaperTimeTask();
-        examPaperTimeTask.setExamPaperId(examPaper.getId());
-        examPaperTimeTask.setExpiry(examPaper.getLimitEndTime().getTime());
-        QUEUE.add(examPaperTimeTask);
-    }
-
-    @Override
-    public void saveMissExamUser(long examPaperId) {
-        examPaperMapper.saveMissExamUser(examPaperId);
-    }
 }

--
Gitblit v1.8.0