haogh 8 months ago
parent
commit
6ac35e151a

+ 9 - 2
src/main/java/com/qmth/exam/reserve/service/impl/StudentApplyServiceImpl.java

@@ -17,12 +17,14 @@ import com.qmth.exam.reserve.bean.applytask.CurrentApplyTaskVO;
 import com.qmth.exam.reserve.bean.category.CategoryCacheBean;
 import com.qmth.exam.reserve.bean.examsite.ExamSiteCacheBean;
 import com.qmth.exam.reserve.bean.login.LoginUser;
+import com.qmth.exam.reserve.bean.org.OrgInfo;
 import com.qmth.exam.reserve.bean.stdapply.*;
 import com.qmth.exam.reserve.bean.timeperiod.TimePeriodExamSiteBean;
 import com.qmth.exam.reserve.cache.CacheConstants;
 import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
 import com.qmth.exam.reserve.cache.impl.CategoryCacheService;
 import com.qmth.exam.reserve.cache.impl.ExamSiteCacheService;
+import com.qmth.exam.reserve.cache.impl.OrgCacheService;
 import com.qmth.exam.reserve.dao.StudentApplyDao;
 import com.qmth.exam.reserve.entity.*;
 import com.qmth.exam.reserve.entity.base.BaseEntity;
@@ -119,6 +121,9 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
     @Autowired
     private AutoAssignStudentService autoAssignStudentService;
 
+    @Autowired
+    private OrgCacheService orgCacheService;
+
     @Override
     public PageResult<StudentApplyVO> page(StudentApplyReq req) {
         if (req.getTaskId() == null) {
@@ -804,7 +809,8 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
     @Transactional
     @Override
     public void autoLayout(Long teachingId) {
-        CurrentApplyTaskVO applyTask = cacheService.currentApplyTask(null);
+        OrgInfo org = orgCacheService.currentOrg();
+        CurrentApplyTaskVO applyTask = cacheService.currentApplyTask(org.getOrgId());
         String autoLayoutLockKey = String.format(CacheConstants.LOCK_ARRANGE_EXAM, DateUtil.formatShortDateString(new Date()));
         RLock autoLayoutLock = (RLock) concurrentService.getLock(autoLayoutLockKey);
 
@@ -1094,7 +1100,8 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
 
     @Override
     public List<StudentApplyExport> listStudentApplyDetail(Long teachingId) {
-        CurrentApplyTaskVO curApplyTask = cacheService.currentApplyTask(null);
+        OrgInfo org = orgCacheService.currentOrg();
+        CurrentApplyTaskVO curApplyTask = cacheService.currentApplyTask(org.getOrgId());
         if (curApplyTask == null) {
             return Collections.emptyList();
         }

+ 7 - 1
src/main/java/com/qmth/exam/reserve/service/impl/StudentAutoAssignServiceImpl.java

@@ -7,10 +7,12 @@ import com.qmth.boot.core.exception.StatusException;
 import com.qmth.exam.reserve.bean.apply.ApplyRecordCacheBean;
 import com.qmth.exam.reserve.bean.applytask.CurrentApplyTaskVO;
 import com.qmth.exam.reserve.bean.category.CategoryCacheBean;
+import com.qmth.exam.reserve.bean.org.OrgInfo;
 import com.qmth.exam.reserve.bean.timeperiod.TimePeriodExamSiteBean;
 import com.qmth.exam.reserve.cache.CacheConstants;
 import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
 import com.qmth.exam.reserve.cache.impl.CategoryCacheService;
+import com.qmth.exam.reserve.cache.impl.OrgCacheService;
 import com.qmth.exam.reserve.dao.StudentApplyDao;
 import com.qmth.exam.reserve.entity.*;
 import com.qmth.exam.reserve.service.*;
@@ -56,6 +58,9 @@ public class StudentAutoAssignServiceImpl extends ServiceImpl<StudentApplyDao, S
     @Autowired
     private StudentApplyService studentApplyService;
 
+    @Autowired
+    private OrgCacheService orgCacheService;
+
 
     @Override
     public String autoAssign(Long taskId, Long operateId) {
@@ -181,7 +186,8 @@ public class StudentAutoAssignServiceImpl extends ServiceImpl<StudentApplyDao, S
     }
 
     private List<TimePeriodExamSiteBean> listNoCancelExamTimePeriod(List<TimePeriodExamSiteBean> timePeriodList) {
-        CurrentApplyTaskVO curApplyTask = cacheService.currentApplyTask(null);
+        OrgInfo org = orgCacheService.currentOrg();
+        CurrentApplyTaskVO curApplyTask = cacheService.currentApplyTask(org.getOrgId());
         Long longToday = DateUtil.getLongTimeByDate(DateUtil.formatShortSplitDateString(new Date()) + " 00:00:00");
         Date today = new Date(longToday);
         Date otherDay = DateUtil.addValues(today, Calendar.DAY_OF_MONTH, curApplyTask.getAllowApplyCancelDays());

+ 11 - 5
src/main/java/com/qmth/exam/reserve/service/impl/StudentServiceImpl.java

@@ -11,6 +11,7 @@ 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.login.LoginUser;
+import com.qmth.exam.reserve.bean.org.OrgInfo;
 import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
 import com.qmth.exam.reserve.bean.student.StudentInfo;
 import com.qmth.exam.reserve.bean.student.StudentReq;
@@ -18,6 +19,7 @@ import com.qmth.exam.reserve.bean.student.StudentVO;
 import com.qmth.exam.reserve.bean.student.WechatBindReq;
 import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
 import com.qmth.exam.reserve.cache.impl.CategoryCacheService;
+import com.qmth.exam.reserve.cache.impl.OrgCacheService;
 import com.qmth.exam.reserve.config.SysProperty;
 import com.qmth.exam.reserve.dao.StudentDao;
 import com.qmth.exam.reserve.entity.ApplyTaskEntity;
@@ -85,6 +87,9 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
     @Autowired
     private StudentCourseService studentCourseService;
 
+    @Autowired
+    private OrgCacheService orgCacheService;
+
     @Override
     public StudentEntity findByStudentCode(Long applyTaskId, String studentCode) {
         if (StringUtils.isEmpty(studentCode)) {
@@ -205,9 +210,10 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
 
     @Override
     public PageResult<StudentVO> pageStudent(StudentReq req) {
-        if(req.getTaskId() == null) {
-            CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(null);
-            if(curApplyTask == null) {
+        if (req.getTaskId() == null) {
+            OrgInfo org = orgCacheService.currentOrg();
+            CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(org.getOrgId());
+            if (curApplyTask == null) {
                 return new PageResult<>();
             } else {
                 req.setTaskId(curApplyTask.getTaskId());
@@ -319,8 +325,8 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
         if (file.getSize() > Constants.FILE_SIZE_LIMIT) {
             throw new StatusException("上传的考生照片大小不能超过5M");
         }
-
-        CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(null);
+        OrgInfo org = orgCacheService.currentOrg();
+        CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(org.getOrgId());
         if (curApplyTask == null) {
             throw new StatusException("未开启预约任务,无法导入");
         }