deason 1 rok pred
rodič
commit
8bce313a90

+ 4 - 4
src/main/java/com/qmth/exam/reserve/controller/admin/SystemPropertyController.java

@@ -7,10 +7,10 @@ import com.qmth.boot.core.fss.store.FileStore;
 import com.qmth.exam.reserve.bean.Constants;
 import com.qmth.exam.reserve.bean.applytask.CurrentApplyTaskVO;
 import com.qmth.exam.reserve.bean.systemproperty.SystemPropertyBean;
+import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
 import com.qmth.exam.reserve.controller.BaseController;
 import com.qmth.exam.reserve.entity.OrgEntity;
 import com.qmth.exam.reserve.entity.SystemPropertyEntity;
-import com.qmth.exam.reserve.service.ApplyTaskService;
 import com.qmth.exam.reserve.service.OrgService;
 import com.qmth.exam.reserve.service.SystemPropertyService;
 import io.swagger.annotations.Api;
@@ -36,10 +36,10 @@ public class SystemPropertyController extends BaseController {
     private FileStore fileStore;
 
     @Autowired
-    private ApplyTaskService applyTaskService;
+    private OrgService orgService;
 
     @Autowired
-    private OrgService orgService;
+    private ApplyTaskCacheService applyTaskCacheService;
 
     @Autowired
     private SystemPropertyService systemPropertyService;
@@ -65,7 +65,7 @@ public class SystemPropertyController extends BaseController {
             orgId = org.getId();
         }
 
-        CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(orgId);
+        CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(orgId);
         if (curApplyTask != null) {
             // 当前预约任务
             properties.setTaskTitle(curApplyTask.getTaskName());

+ 5 - 1
src/main/java/com/qmth/exam/reserve/service/impl/AuthServiceImpl.java

@@ -9,6 +9,7 @@ import com.qmth.exam.reserve.bean.applytask.CurrentApplyTaskVO;
 import com.qmth.exam.reserve.bean.login.LoginReq;
 import com.qmth.exam.reserve.bean.login.LoginUser;
 import com.qmth.exam.reserve.bean.login.WechatLoginReq;
+import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
 import com.qmth.exam.reserve.cache.impl.LoginSessionManager;
 import com.qmth.exam.reserve.entity.ApplyTaskEntity;
 import com.qmth.exam.reserve.entity.StudentEntity;
@@ -43,6 +44,9 @@ public class AuthServiceImpl implements AuthorizationService<LoginUser>, AuthSer
     @Autowired
     private ApplyTaskService applyTaskService;
 
+    @Autowired
+    private ApplyTaskCacheService applyTaskCacheService;
+
     @Override
     public LoginUser userLogin(LoginReq req) {
         if (StringUtils.isBlank(req.getAccount())) {
@@ -90,7 +94,7 @@ public class AuthServiceImpl implements AuthorizationService<LoginUser>, AuthSer
             throw new StatusException("登录密码不能为空");
         }
 
-        CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(req.getOrgId());
+        CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(req.getOrgId());
         if (curApplyTask == null) {
             throw new StatusException("尚未开启预约任务");
         }

+ 10 - 11
src/main/java/com/qmth/exam/reserve/service/impl/CategoryServiceImpl.java

@@ -1,13 +1,5 @@
 package com.qmth.exam.reserve.service.impl;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -19,18 +11,25 @@ import com.qmth.exam.reserve.bean.login.LoginUser;
 import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
 import com.qmth.exam.reserve.bean.teaching.TeachingReq;
 import com.qmth.exam.reserve.bean.teaching.TeachingVO;
+import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
 import com.qmth.exam.reserve.dao.CategoryDao;
 import com.qmth.exam.reserve.entity.CategoryEntity;
 import com.qmth.exam.reserve.enums.CategoryLevel;
 import com.qmth.exam.reserve.enums.Role;
-import com.qmth.exam.reserve.service.ApplyTaskService;
 import com.qmth.exam.reserve.service.CategoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity> implements CategoryService {
 
     @Autowired
-    private ApplyTaskService applyTaskService;
+    private ApplyTaskCacheService applyTaskCacheService;
 
     @Override
     public List<CategoryVO> listTeaching(LoginUser user) {
@@ -71,7 +70,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
         List<CategoryInfo> list = new ArrayList<>();
 
         // 获取当前启用的预约任务
-        CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(student.getOrgId());
+        CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(student.getOrgId());
         if (curApplyTask == null) {
             return list;
         }

+ 9 - 12
src/main/java/com/qmth/exam/reserve/service/impl/ExamReserveServiceImpl.java

@@ -41,22 +41,19 @@ public class ExamReserveServiceImpl implements ExamReserveService {
     private static final Logger log = LoggerFactory.getLogger(ExamReserveServiceImpl.class);
 
     @Autowired
-    private StudentService studentService;
-
-    @Autowired
-    private StudentApplyService studentApplyService;
+    private ApplyTaskCacheService applyTaskCacheService;
 
     @Autowired
     private ApplyTaskService applyTaskService;
 
     @Autowired
-    private TimePeriodService timePeriodService;
+    private ExamSiteService examSiteService;
 
     @Autowired
-    private ExamSiteService examSiteService;
+    private TimePeriodService timePeriodService;
 
     @Autowired
-    private ApplyTaskCacheService applyTaskCacheService;
+    private StudentApplyService studentApplyService;
 
     @Autowired
     private ConcurrentService concurrentService;
@@ -71,7 +68,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
             throw new StatusException("预约时段ID不能为空");
         }
 
-        CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(student.getOrgId());
+        CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(student.getOrgId());
         if (curApplyTask == null) {
             log.warn("预约失败,尚未开启预约任务!stuApplyTaskId:{}", student.getApplyTaskId());
             throw new StatusException("尚未开启预约任务");
@@ -172,7 +169,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
             throw new StatusException("预约记录ID不能为空");
         }
 
-        CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(student.getOrgId());
+        CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(student.getOrgId());
         if (curApplyTask == null) {
             log.warn("取消预约失败,尚未开启预约任务!stuApplyTaskId:{} applyId:{}", student.getApplyTaskId(), applyId);
             return;
@@ -266,7 +263,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
 
     @Override
     public List<ApplyVO> getStudentApplyList(LoginUser student, Boolean cancel) {
-        CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(student.getOrgId());
+        CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(student.getOrgId());
         if (curApplyTask == null) {
             return new ArrayList<>();
         }
@@ -339,7 +336,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
         // 日期格式:yyyyMMdd
         List<String> dateList = new ArrayList<>();
 
-        CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(student.getOrgId());
+        CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(student.getOrgId());
         if (curApplyTask == null) {
             return dateList;
         }
@@ -390,7 +387,7 @@ public class ExamReserveServiceImpl implements ExamReserveService {
             throw new StatusException("预约日期值的格式不正确");
         }
 
-        CurrentApplyTaskVO curApplyTask = applyTaskService.currentApplyTask(student.getOrgId());
+        CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(student.getOrgId());
         if (curApplyTask == null) {
             throw new StatusException("尚未开启预约任务");
         }