|
@@ -235,25 +235,32 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
|
|
|
studentApplyEntity.setCancel(Boolean.TRUE);
|
|
|
updateById(studentApplyEntity);
|
|
|
|
|
|
- ApplyRecordCacheBean bean = new ApplyRecordCacheBean();
|
|
|
- bean.setStudentId(studentApplyEntity.getStudentId());
|
|
|
- bean.setExamSiteId(studentApplyEntity.getExamSiteId());
|
|
|
- bean.setTimePeriodId(studentApplyEntity.getTimePeriodId());
|
|
|
- bean.setCancel(Boolean.TRUE);
|
|
|
- bean.setOperateId(user.getId());
|
|
|
- bean.setOperateTime(System.currentTimeMillis());
|
|
|
- bean.setBizId(cacheService.increaseBizId());
|
|
|
-
|
|
|
- // 推送至预约队列
|
|
|
+ // 获取当前考试点当前时段的容量
|
|
|
+ int examSiteTimePeriodCapacity = examSiteService.getExamSiteTimePeriodCapacity(studentApplyEntity.getExamSiteId(),
|
|
|
+ studentApplyEntity.getTimePeriodId());
|
|
|
+ //有容量才刷缓存
|
|
|
+ if(examSiteTimePeriodCapacity > 0) {
|
|
|
+ ApplyRecordCacheBean bean = new ApplyRecordCacheBean();
|
|
|
+ bean.setStudentId(studentApplyEntity.getStudentId());
|
|
|
+ bean.setExamSiteId(studentApplyEntity.getExamSiteId());
|
|
|
+ bean.setTimePeriodId(studentApplyEntity.getTimePeriodId());
|
|
|
+ bean.setCancel(Boolean.TRUE);
|
|
|
+ bean.setOperateId(user.getId());
|
|
|
+ bean.setOperateTime(System.currentTimeMillis());
|
|
|
+ bean.setBizId(cacheService.increaseBizId());
|
|
|
+
|
|
|
+ // 推送至预约队列
|
|
|
/*boolean pushSuccess = cacheService.pushStudentApplyRecordQueue(bean);
|
|
|
if (!pushSuccess) {
|
|
|
log.error("[cancel] 预约消息推送失败,id:{}", id);
|
|
|
throw new RuntimeException("取消失败,请稍后再试!");
|
|
|
}*/
|
|
|
- // 保存至预约缓存
|
|
|
- cacheService.saveStudentApplyRecord(bean);
|
|
|
- // 某考点某时段的“剩余可约数量”(归还1个被占数量)
|
|
|
- cacheService.increaseApplyAvailableCount(studentApplyEntity.getExamSiteId(), studentApplyEntity.getTimePeriodId());
|
|
|
+ // 保存至预约缓存
|
|
|
+ cacheService.saveStudentApplyRecord(bean);
|
|
|
+ // 某考点某时段的“剩余可约数量”(归还1个被占数量)
|
|
|
+ cacheService.increaseApplyAvailableCount(studentApplyEntity.getExamSiteId(), studentApplyEntity.getTimePeriodId());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("[cancel] 取消预约失败, msg:{}", e.getMessage());
|