xiatian 5 년 전
부모
커밋
a377017956

+ 43 - 7
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamRecordDataServiceImpl.java

@@ -2,19 +2,16 @@ package cn.com.qmth.examcloud.core.oe.student.service.impl;
 
 import java.util.Date;
 
-import cn.com.qmth.examcloud.support.cache.bean.CourseCacheBean;
-import cn.com.qmth.examcloud.support.cache.bean.ExamSettingsCacheBean;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import cn.com.qmth.examcloud.api.commons.enums.ExamType;
-import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
 import cn.com.qmth.examcloud.core.oe.student.dao.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.student.dao.entity.ExamRecordDataEntity;
 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.cache.bean.CourseCacheBean;
+import cn.com.qmth.examcloud.support.cache.bean.ExamSettingsCacheBean;
 import cn.com.qmth.examcloud.support.enums.ExamRecordStatus;
 import cn.com.qmth.examcloud.support.examing.ExamRecordData;
 import cn.com.qmth.examcloud.support.examing.ExamingSession;
@@ -63,8 +60,7 @@ public class ExamRecordDataServiceImpl implements ExamRecordDataService {
         examRecordData.setFaceStrangerCount(0);
         examRecordData.setExamRecordStatus(ExamRecordStatus.EXAM_ING);
         examRecordDataRepo.save(examRecordData);
-        ExamRecordData bean = new ExamRecordData();
-        BeanUtils.copyProperties(bean, examRecordData);
+        ExamRecordData bean = of(examRecordData);
         //存入redis
         saveExamRecordDataCache(examRecordData.getId(), bean);
         return bean;
@@ -88,4 +84,44 @@ public class ExamRecordDataServiceImpl implements ExamRecordDataService {
         redisClient.delete(key + examRecordDataId);
     }
 
+    private ExamRecordData of(ExamRecordDataEntity et) {
+        ExamRecordData bean = new ExamRecordData();
+        bean.setId(et.getId());
+        bean.setExamId(et.getId());
+        bean.setExamType(et.getExamType());
+
+        bean.setExamStudentId(et.getExamStudentId());
+        bean.setStudentId(et.getStudentId());
+        bean.setCourseId(et.getCourseId());
+        bean.setOrgId(et.getOrgId());
+        bean.setRootOrgId(et.getRootOrgId());
+
+        bean.setBasePaperId(et.getBasePaperId());
+
+        bean.setPaperType(et.getPaperType());
+
+        bean.setStartTime(et.getStartTime());
+        bean.setEndTime(et.getEndTime());
+        bean.setUsedExamTime(et.getUsedExamTime());
+        bean.setIsContinued(et.getIsContinued());
+        bean.setContinuedCount(et.getContinuedCount());
+        bean.setIsExceed(et.getIsExceed());
+        bean.setFaceSuccessCount(et.getFaceSuccessCount());
+        bean.setFaceFailedCount(et.getFaceFailedCount());
+        bean.setFaceStrangerCount(et.getFaceStrangerCount());
+        bean.setFaceTotalCount(et.getFaceTotalCount());
+        bean.setExamRecordStatus(et.getExamRecordStatus());
+        bean.setHandInExamType(et.getHandInExamType());
+        bean.setFaceVerifyResult(et.getFaceVerifyResult());
+        bean.setCleanTime(et.getCleanTime());
+        bean.setIsWarn(et.getIsWarn());
+        bean.setIsAudit(et.getIsAudit());
+        bean.setIsIllegality(et.getIsIllegality());
+        bean.setTotalScore(et.getTotalScore());
+        bean.setObjectiveScore(et.getObjectiveScore());
+        bean.setObjectiveAccuracy(et.getObjectiveAccuracy());
+        bean.setSubjectiveScore(et.getSubjectiveScore());
+        bean.setSuccPercent(et.getSuccPercent());
+        return bean;
+    }
 }

+ 38 - 5
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamRecordQuestionsServiceImpl.java

@@ -7,7 +7,6 @@ import java.util.Optional;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.lang.StringUtils;
-import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -130,7 +129,7 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
                 if(!op.isPresent()) {
                     throw new StatusException("1001", "试题内容未找到");
                 }
-                BeanUtils.copyProperties(op.get(), eq);
+                copyFromTemp(eq, op.get());
             }
             examQuestions.add(eq);
         }
@@ -192,9 +191,7 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
             //过长存入mongo
             if(eq.getIsAnswer()&&eq.getStudentAnswer().length()>ANWSER_LENGT) {
                 eq.setIsInMongo(true);
-                ExamQuestionTempEntity temp=new ExamQuestionTempEntity();
-                BeanUtils.copyProperties(eq, temp);
-                temp.setId(null);
+                ExamQuestionTempEntity temp=of(eq);
                 examRecordQuestionTempRepo.save(temp);
                 eq.setExamQuestionTempId(temp.getId());
             }else {
@@ -203,4 +200,40 @@ public class ExamRecordQuestionsServiceImpl implements ExamRecordQuestionsServic
             saveExamQuestion(examRecordDataId, examQuestionInfo.getOrder(), eq);
         }
     }
+    
+    private ExamQuestionTempEntity of(ExamQuestion eq) {
+        ExamQuestionTempEntity tem=new ExamQuestionTempEntity();
+        tem.setExamRecordDataId(eq.getExamRecordDataId());
+        tem.setMainNumber(eq.getMainNumber());
+        tem.setQuestionId(eq.getQuestionId());
+        tem.setOrder(eq.getOrder());
+        tem.setQuestionScore(eq.getQuestionScore());
+        tem.setQuestionType(eq.getQuestionType());
+        tem.setCorrectAnswer(eq.getCorrectAnswer());
+        tem.setStudentAnswer(eq.getStudentAnswer());
+        tem.setStudentScore(eq.getStudentScore());
+        tem.setIsAnswer(eq.getIsAnswer());
+        tem.setIsSign(eq.getIsSign());
+        tem.setOptionPermutation(eq.getOptionPermutation());
+        tem.setAudioPlayTimes(eq.getAudioPlayTimes());
+        tem.setAnswerType(eq.getAnswerType());
+        return tem;
+    }
+    
+    private void copyFromTemp(ExamQuestion eq,ExamQuestionTempEntity temp) {
+        eq.setExamRecordDataId(temp.getExamRecordDataId());
+        eq.setMainNumber(temp.getMainNumber());
+        eq.setQuestionId(temp.getQuestionId());
+        eq.setOrder(temp.getOrder());
+        eq.setQuestionScore(temp.getQuestionScore());
+        eq.setQuestionType(temp.getQuestionType());
+        eq.setCorrectAnswer(temp.getCorrectAnswer());
+        eq.setStudentAnswer(temp.getStudentAnswer());
+        eq.setStudentScore(temp.getStudentScore());
+        eq.setIsAnswer(temp.getIsAnswer());
+        eq.setIsSign(temp.getIsSign());
+        eq.setOptionPermutation(temp.getOptionPermutation());
+        eq.setAudioPlayTimes(temp.getAudioPlayTimes());
+        eq.setAnswerType(temp.getAnswerType());
+    }
 }