|
@@ -100,9 +100,6 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
@Autowired
|
|
|
private CategoryCacheService categoryCacheService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private StudentAutoAssignService studentAutoAssignService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private MaterialGenerateService materialGenerateService;
|
|
|
|
|
@@ -115,9 +112,6 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
@Autowired
|
|
|
private StudentApplyNoFinishExportService studentApplyNoFinishExportService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ApplyTaskCacheService applyTaskCacheService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private StudentApplyDetailExportService studentApplyDetailExportService;
|
|
|
|
|
@@ -192,8 +186,8 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
log.warn("[cancel] 获取锁失败,同一个考生不允许同时操作取消预约, lockKey:{}", studentApplyLockKey);
|
|
|
throw new StatusException(Constants.SYSTEM_BUSY);
|
|
|
} else {
|
|
|
-
|
|
|
- /* //先更新数据库
|
|
|
+ /*
|
|
|
+ //先更新数据库
|
|
|
studentApplyEntity.setCancel(Boolean.TRUE);
|
|
|
updateById(studentApplyEntity);
|
|
|
*/
|
|
@@ -206,12 +200,12 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
bean.setOperateId(user.getId());
|
|
|
bean.setOperateTime(System.currentTimeMillis());
|
|
|
|
|
|
- // 先推送至预约队列
|
|
|
+ // 推送至预约队列
|
|
|
cacheService.pushStudentApplyRecordQueue(bean);
|
|
|
+ // 保存至预约缓存
|
|
|
cacheService.saveStudentApplyRecord(bean);
|
|
|
-
|
|
|
- // 扣减redis中的数量
|
|
|
- cacheService.decreaseApplyFinishCount(studentApplyEntity.getExamSiteId(), studentApplyEntity.getTimePeriodId());
|
|
|
+ // 某考点某时段的“剩余可约数量”(归还1个被占数量)
|
|
|
+ cacheService.increaseApplyAvailableCount(studentApplyEntity.getExamSiteId(), studentApplyEntity.getTimePeriodId());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("[cancel] 取消预约失败, msg:{}", e.getMessage());
|
|
@@ -259,7 +253,7 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
}
|
|
|
log.warn("[importPreExam] 获取锁成功!lockKey:{}", CacheConstants.LOCK_AUTO_APPLY);
|
|
|
|
|
|
- CurrentApplyTaskVO task = applyTaskCacheService.currentApplyTask(user.getOrgId());
|
|
|
+ CurrentApplyTaskVO task = cacheService.currentApplyTask(user.getOrgId());
|
|
|
Date openStartTime = new Date(task.getOpenApplyStartTime());
|
|
|
Date openEndTime = new Date(task.getOpenApplyEndTime());
|
|
|
Date now = new Date();
|
|
@@ -522,11 +516,17 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
bean.setOperateId(userId);
|
|
|
bean.setOperateTime(System.currentTimeMillis());
|
|
|
|
|
|
- // 先推送至预约队列
|
|
|
+ // 某考点某时段的“剩余可约数量”(抢占1个数量)
|
|
|
+ boolean takeSuccess = cacheService.decreaseApplyAvailableCount(bean.getExamSiteId(), bean.getTimePeriodId());
|
|
|
+ if (!takeSuccess) {
|
|
|
+ log.warn("预约失败,当前预约时段已约满!examSiteId:{} timePeriodId:{} studentId:{}",
|
|
|
+ bean.getExamSiteId(), bean.getTimePeriodId(), bean.getStudentId());
|
|
|
+ throw new StatusException("当前预约时段已约满");
|
|
|
+ }
|
|
|
+ // 推送至预约队列
|
|
|
cacheService.pushStudentApplyRecordQueue(bean);
|
|
|
+ // 保存至预约缓存
|
|
|
cacheService.saveStudentApplyRecord(bean);
|
|
|
- // redis已预约数量+1
|
|
|
- cacheService.increaseApplyFinishCount(agentTimeVO.getAgentId(), agentTimeVO.getTimePeriodId());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -579,7 +579,7 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
int studentApplyFinishCount = haveApplyList.size();*/
|
|
|
|
|
|
// 考生已经预约的次数
|
|
|
- int studentApplyFinishCount = applyTaskCacheService.getStudentApplyFinishCount(studentImportVO.getStudentId());
|
|
|
+ int studentApplyFinishCount = cacheService.getStudentApplyFinishCount(studentImportVO.getStudentId());
|
|
|
List<AgentAndTimeVO> toBeApplyTimeList = new ArrayList<>();
|
|
|
|
|
|
//考生已完成预约
|
|
@@ -1155,7 +1155,7 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
|
|
|
@Override
|
|
|
public List<StudentApplyExport> listStudentApplyDetail(Long teachingId) {
|
|
|
- CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(null);
|
|
|
+ CurrentApplyTaskVO curApplyTask = cacheService.currentApplyTask(null);
|
|
|
if (curApplyTask == null) {
|
|
|
return Collections.emptyList();
|
|
|
}
|