|
@@ -8,7 +8,7 @@ import com.qmth.exam.reserve.cache.CacheConstants;
|
|
|
import com.qmth.exam.reserve.cache.RedisClient;
|
|
|
import com.qmth.exam.reserve.entity.StudentApplyEntity;
|
|
|
import com.qmth.exam.reserve.service.StudentApplyService;
|
|
|
-import org.redisson.api.RBlockingQueue;
|
|
|
+import org.redisson.api.RQueue;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -46,13 +46,14 @@ public class StudentApplyRecordJob {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- RBlockingQueue<ApplyRecordCacheBean> queue = redisClient.getRedissonClient()
|
|
|
- .getBlockingQueue(CacheConstants.QUEUE_STUDENT_APPLY_RECORD);
|
|
|
+ RQueue<ApplyRecordCacheBean> queue = redisClient.getRedissonClient()
|
|
|
+ .getQueue(CacheConstants.QUEUE_STUDENT_APPLY_RECORD);
|
|
|
|
|
|
int queueSize = queue.size();
|
|
|
log.info("[JOB] queue size:{}", queueSize);
|
|
|
+
|
|
|
for (int i = 0; i < queueSize; i++) {
|
|
|
- ApplyRecordCacheBean value = queue.take();
|
|
|
+ ApplyRecordCacheBean value = queue.poll();
|
|
|
|
|
|
try {
|
|
|
this.saveOrUpdate(value);
|
|
@@ -74,6 +75,10 @@ public class StudentApplyRecordJob {
|
|
|
|
|
|
// @Transactional
|
|
|
public void saveOrUpdate(ApplyRecordCacheBean bean) {
|
|
|
+ if (bean == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
LambdaQueryWrapper<StudentApplyEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(StudentApplyEntity::getExamSiteId, bean.getExamSiteId());
|
|
|
wrapper.eq(StudentApplyEntity::getTimePeriodId, bean.getTimePeriodId());
|