|
@@ -1,45 +0,0 @@
|
|
-package cn.com.qmth.examcloud.core.oe.admin.service.cache;
|
|
|
|
-
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.ExamRecordDataRepo;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.entity.ExamRecordDataEntity;
|
|
|
|
-import cn.com.qmth.examcloud.support.cache.bean.ExamRecordPropertyCacheBean;
|
|
|
|
-import cn.com.qmth.examcloud.web.cache.RandomObjectRedisCache;
|
|
|
|
-import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
-
|
|
|
|
-@Service
|
|
|
|
-public class ExamRecordPropertyCache extends RandomObjectRedisCache<ExamRecordPropertyCacheBean> {
|
|
|
|
-
|
|
|
|
- @Autowired
|
|
|
|
- ExamRecordDataRepo examRecordDataRepo;
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public ExamRecordPropertyCacheBean loadFromResource(Object... keys) {
|
|
|
|
- if (keys == null) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- Long examRecordDataId = (Long) keys[0];
|
|
|
|
- ExamRecordDataEntity examRecordData = GlobalHelper.getEntity(examRecordDataRepo, examRecordDataId, ExamRecordDataEntity.class);
|
|
|
|
-
|
|
|
|
- if (null == examRecordData) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- ExamRecordPropertyCacheBean b = new ExamRecordPropertyCacheBean();
|
|
|
|
- b.setExamId(examRecordData.getExamId());
|
|
|
|
- b.setOrgId(examRecordData.getOrgId());
|
|
|
|
- return b;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- protected String getKeyPrefix() {
|
|
|
|
- return "OE_EXAM_RECORD_PROP:";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- protected int getTimeout() {
|
|
|
|
- // 2分钟
|
|
|
|
- return 60 * 2;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-}
|
|
|