Jelajahi Sumber

upgrade fss api...

deason 1 tahun lalu
induk
melakukan
23977ec411

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

@@ -22,9 +22,9 @@ import cn.com.qmth.examcloud.support.cache.bean.OrgPropertyCacheBean;
 import cn.com.qmth.examcloud.support.cache.bean.StudentCacheBean;
 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.fss.FssFactory;
+import cn.com.qmth.examcloud.support.fss.FssHelper;
 import cn.com.qmth.examcloud.support.helper.ExamCacheTransferHelper;
-import cn.com.qmth.examcloud.web.aliyun.OssClient;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -61,9 +61,6 @@ public class ExamCaptureQueueServiceImpl implements ExamCaptureQueueService {
     @Autowired
     private ExamRecordDataService examRecordDataService;
 
-    @Autowired
-    private OssClient ossClient;
-
     @Override
     public void handlerExamCaptureQueuesByExamRecordDataId(Long examRecordDataId, List<ExamCaptureQueueEntity> queues, FaceApiParam param) throws Exception {
         if (CollectionUtils.isEmpty(queues)) {
@@ -103,8 +100,8 @@ public class ExamCaptureQueueServiceImpl implements ExamCaptureQueueService {
             basePhoto = new ImageBase64Parm(CommonUtils.toBase64(studentCache.getPhotoPath()));
             log.warn("old data basePhotoUrl:{}", studentCache.getPhotoPath());
         } else {
-            String basePhotoUrl = ossClient.valueOfOssFilePath(studentCache.getPhotoPath());
-            byte[] basePhotoBytes = ossClient.download(basePhotoUrl);
+            String basePhotoPath = FssHelper.fixFilePath(studentCache.getPhotoPath());
+            byte[] basePhotoBytes = FssFactory.getInstance().readFile(basePhotoPath);
             basePhoto = new ImageBase64Parm(Base64.encodeBase64String(basePhotoBytes));
         }
 
@@ -112,8 +109,8 @@ public class ExamCaptureQueueServiceImpl implements ExamCaptureQueueService {
             queue.setFaceCompareStartTime(System.currentTimeMillis());
 
             // 将抓拍照图片转成Base64格式
-            String capturePhotoUrl = ossClient.valueOfOssFilePath(FileStorageUtil.realPath(queue.getFileUrl()));
-            if (StringUtils.isBlank(capturePhotoUrl)) {
+            String capturePhotoPath = FssHelper.fixFilePath(queue.getFileUrl());
+            if (StringUtils.isBlank(capturePhotoPath)) {
                 // 删除错误无效数据
                 log.warn("人脸抓拍图片地址错误!examRecordDataId:{} queueId:{} imgUrl:{}", queue.getExamRecordDataId(),
                         queue.getId(), queue.getFileUrl());
@@ -121,7 +118,7 @@ public class ExamCaptureQueueServiceImpl implements ExamCaptureQueueService {
                 continue;
             }
 
-            byte[] capturePhotoBytes = ossClient.download(capturePhotoUrl);
+            byte[] capturePhotoBytes = FssFactory.getInstance().readFile(capturePhotoPath);
             ImageParm capturePhoto = new ImageBase64Parm(Base64.encodeBase64String(capturePhotoBytes));
             if (StringUtils.isBlank(capturePhoto.value())) {
                 // 删除错误无效数据

+ 0 - 3
examcloud-core-oe-task-starter/src/main/java/cn/com/qmth/examcloud/core/oe/task/starter/OETaskApp.java

@@ -1,7 +1,6 @@
 package cn.com.qmth.examcloud.core.oe.task.starter;
 
 import cn.com.qmth.examcloud.core.oe.student.dao.UniqueRuleHolder;
-import cn.com.qmth.examcloud.support.filestorage.FileStorageUtil;
 import cn.com.qmth.examcloud.web.jpa.DataIntegrityViolationTransverter;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -47,8 +46,6 @@ public class OETaskApp {
     public static void main(String[] args) throws Exception {
         // AppBootstrap.run(OETaskApp.class, args);
         SpringApplication.run(OETaskApp.class, args);
-
-        FileStorageUtil.initYunClient();
     }
 
     @Bean(name = "multipartResolver")