|
@@ -18,6 +18,7 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
@@ -184,6 +185,7 @@ public class ApplyTaskCacheService implements CacheConstants {
|
|
|
wrapper.eq(StudentApplyEntity::getStudentId, studentId);
|
|
|
List<StudentApplyEntity> list = studentApplyService.list(wrapper);
|
|
|
|
|
|
+ Map<String, ApplyRecordCacheBean> maps = new HashMap<>();
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
for (StudentApplyEntity entity : list) {
|
|
|
ApplyRecordCacheBean bean = new ApplyRecordCacheBean();
|
|
@@ -193,11 +195,15 @@ public class ApplyTaskCacheService implements CacheConstants {
|
|
|
bean.setCancel(entity.getCancel());
|
|
|
bean.setOperateId(entity.getOperateId());
|
|
|
bean.setOperateTime(entity.getUpdateTime());
|
|
|
- this.saveStudentApplyRecord(studentId, bean);
|
|
|
+ this.saveStudentApplyRecord(bean);
|
|
|
+
|
|
|
+ String hashKey = String.format("%s_%s", entity.getExamSiteId(), entity.getTimePeriodId());
|
|
|
+ maps.put(hashKey, bean);
|
|
|
}
|
|
|
|
|
|
redisClient.expire(cacheKey, 30, TimeUnit.DAYS);
|
|
|
}
|
|
|
+ return maps;
|
|
|
}
|
|
|
|
|
|
return redisClient.getEntriesForHash(cacheKey, ApplyRecordCacheBean.class);
|
|
@@ -215,8 +221,8 @@ public class ApplyTaskCacheService implements CacheConstants {
|
|
|
/**
|
|
|
* 保存某考生的 某考点某时段的“预约记录”缓存
|
|
|
*/
|
|
|
- public void saveStudentApplyRecord(Long studentId, ApplyRecordCacheBean value) {
|
|
|
- String cacheKey = String.format(CACHE_STUDENT_APPLY_RECORD, studentId);
|
|
|
+ public void saveStudentApplyRecord(ApplyRecordCacheBean value) {
|
|
|
+ String cacheKey = String.format(CACHE_STUDENT_APPLY_RECORD, value.getStudentId());
|
|
|
String hashKey = String.format("%s_%s", value.getExamSiteId(), value.getTimePeriodId());
|
|
|
redisClient.setForHash(cacheKey, hashKey, value);
|
|
|
log.info("SET cacheKey:{} hashKey:{}", cacheKey, hashKey);
|