소스 검색

replaceFileUrlInternalDomain

deason 2 년 전
부모
커밋
d86a323ec7

+ 8 - 2
examcloud-core-oe-task-service/src/main/java/cn/com/qmth/examcloud/core/oe/task/service/impl/ExamCaptureQueueServiceImpl.java

@@ -23,6 +23,7 @@ import cn.com.qmth.examcloud.support.enums.ExamProperties;
 import cn.com.qmth.examcloud.support.examing.ExamRecordData;
 import cn.com.qmth.examcloud.support.filestorage.FileStorageUtil;
 import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
+import cn.com.qmth.examcloud.web.config.SystemProperties;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -54,6 +55,9 @@ public class ExamCaptureQueueServiceImpl implements ExamCaptureQueueService {
     @Autowired
     private ExamRecordDataService examRecordDataService;
 
+    @Autowired
+    private SystemProperties systemProperties;
+
     @Override
     public void handlerExamCaptureQueuesByExamRecordDataId(Long examRecordDataId) throws Exception {
         // 每个考试记录ID下通常只有几条待处理抓拍记录,直接取所有一次性处理。
@@ -85,13 +89,15 @@ public class ExamCaptureQueueServiceImpl implements ExamCaptureQueueService {
                 queues.size(), useBaiduApi ? "baidu" : "face++", baiduExpectFaceCompareScore);
 
         // 将学生底照图片转成Base64格式
-        ImageParm basePhoto = new ImageBase64Parm(CommonUtils.toBase64(studentCache.getPhotoPath()));
+        String basePhotoUrl = systemProperties.replaceFileUrlInternalDomain(studentCache.getPhotoPath());
+        ImageParm basePhoto = new ImageBase64Parm(CommonUtils.toBase64(basePhotoUrl));
 
         for (ExamCaptureQueueEntity queue : queues) {
             queue.setFaceCompareStartTime(System.currentTimeMillis());
 
             // 将抓拍照图片转成Base64格式
-            ImageParm capturePhoto = new ImageBase64Parm(CommonUtils.toBase64(FileStorageUtil.realPath(queue.getFileUrl())));
+            String capturePhotoUrl = systemProperties.replaceFileUrlInternalDomain(FileStorageUtil.realPath(queue.getFileUrl()));
+            ImageParm capturePhoto = new ImageBase64Parm(CommonUtils.toBase64(capturePhotoUrl));
 
             String extMsg = "";
             boolean errFace = false;