|
@@ -4,6 +4,7 @@ import java.util.Date;
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -16,6 +17,7 @@ import cn.com.qmth.examcloud.core.oe.student.dao.enums.ExamType;
|
|
|
import cn.com.qmth.examcloud.core.oe.student.service.ExamRecordDataService;
|
|
|
import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
|
|
|
import cn.com.qmth.examcloud.support.examing.ExamingSession;
|
|
|
+import cn.com.qmth.examcloud.web.redis.RedisClient;
|
|
|
|
|
|
/**
|
|
|
* @author chenken
|
|
@@ -26,6 +28,12 @@ import cn.com.qmth.examcloud.support.examing.ExamingSession;
|
|
|
@Service("examRecordDataService")
|
|
|
public class ExamRecordDataServiceImpl implements ExamRecordDataService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisClient redisClient;
|
|
|
+
|
|
|
+ @Value("${exam_record_data_key_prefix}")
|
|
|
+ private String examRecordDataKeyPrefix;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ExamRecordDataRepo examRecordDataRepo;
|
|
|
|
|
@@ -56,9 +64,26 @@ public class ExamRecordDataServiceImpl implements ExamRecordDataService {
|
|
|
examRecordData.setFaceStrangerCount(0);
|
|
|
examRecordData.setExamRecordStatus(ExamRecordStatus.EXAM_ING);
|
|
|
examRecordDataRepo.save(examRecordData);
|
|
|
- ExamRecordDataBean bean=new ExamRecordDataBean();
|
|
|
+ ExamRecordDataBean bean = new ExamRecordDataBean();
|
|
|
BeanUtils.copyProperties(bean, examRecordData);
|
|
|
+ //存入redis
|
|
|
+ saveExamRecordDataBean(examRecordData.getId(), bean, -1);
|
|
|
return bean;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void saveExamRecordDataBean(Long examRecordDataId, ExamRecordDataBean data, int timeout) {
|
|
|
+ redisClient.set(examRecordDataKeyPrefix + examRecordDataId, data, timeout);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ExamRecordDataBean getExamRecordDataBean(Long examRecordDataId) {
|
|
|
+ return redisClient.get(examRecordDataKeyPrefix + examRecordDataId, ExamRecordDataBean.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void deleteExamRecordDataBean(Long examRecordDataId) {
|
|
|
+ redisClient.delete(examRecordDataKeyPrefix + examRecordDataId);
|
|
|
+ }
|
|
|
+
|
|
|
}
|