lideyin 5 vuotta sitten
vanhempi
commit
049af2bd73

+ 8 - 9
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamControlServiceImpl.java

@@ -48,6 +48,7 @@ import main.java.com.upyun.Base64Coder;
 import main.java.com.upyun.UpException;
 import main.java.com.upyun.UpYunUtils;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.math.RandomUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.time.DateUtils;
 import org.apache.commons.logging.Log;
@@ -834,7 +835,7 @@ public class ExamControlServiceImpl implements ExamControlService {
     @Override
     public void cleanTempFileAnswers() {
         //默认删除7天以前的数据
-        int days = PropertyHolder.getInt("oe.cleanTempFileAnswer.thresholdDays", 7);
+        int days = PropertyHolder.getInt("oe.cleanTempFileAnswer.thresholdDays", 1);
         Date dateBeforeDays = DateUtils.addDays(new Date(), -1 * days);
         examFileAnswerTempRepo.deleteByCreationTime(dateBeforeDays);
     }
@@ -1083,14 +1084,12 @@ public class ExamControlServiceImpl implements ExamControlService {
 
             ExamRecordEntity examRecord = GlobalHelper.getEntity(
                     examRecordRepo, reco.getExamRecordId(), ExamRecordEntity.class);
-            synchronized (lock) {
-                filePath.append(SEPARATOR).append(OE_ANSWER_FILE_PATH).append(SEPARATOR).append(examRecord.getExamStudentId())
-                        .append(SEPARATOR).append(req.getExamRecordDataId()).append(SEPARATOR).append(req.getOrder())
-                        .append(SEPARATOR).append(examRecord.getExamStudentId()).append(UNDERLINE)
-                        .append(req.getExamRecordDataId()).append(UNDERLINE).append(req.getOrder()).append(UNDERLINE)
-                        .append(System.currentTimeMillis());
-                Util.sleep(TimeUnit.MILLISECONDS, 1);
-            }
+            filePath.append(SEPARATOR).append(OE_ANSWER_FILE_PATH).append(SEPARATOR).append(examRecord.getExamStudentId())
+                    .append(SEPARATOR).append(req.getExamRecordDataId()).append(SEPARATOR).append(req.getOrder())
+                    .append(SEPARATOR).append(examRecord.getExamStudentId()).append(UNDERLINE)
+                    .append(req.getExamRecordDataId()).append(UNDERLINE).append(req.getOrder()).append(UNDERLINE)
+                    .append(System.currentTimeMillis())
+                    .append(RandomUtils.nextInt(8999) + 1000);
 
             if (StringUtils.isNotEmpty(req.getExt())) {
                 filePath.append(UNDERLINE).append(req.getExt());