From 937daff0ebc1aa16a852d5a86434ab1994d8a02d Mon Sep 17 00:00:00 2001
From: 胡仁荣 <897853850@qq.com>
Date: 星期一, 11 九月 2023 10:41:25 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/com/qxueyou/scc/teach/res/service/impl/HweiYunOBSServiceImpl.java |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/qxueyou/scc/teach/res/service/impl/HweiYunOBSServiceImpl.java b/src/main/java/com/qxueyou/scc/teach/res/service/impl/HweiYunOBSServiceImpl.java
index 8964cf2..4ddf1e5 100644
--- a/src/main/java/com/qxueyou/scc/teach/res/service/impl/HweiYunOBSServiceImpl.java
+++ b/src/main/java/com/qxueyou/scc/teach/res/service/impl/HweiYunOBSServiceImpl.java
@@ -5,6 +5,7 @@
 import com.obs.services.ObsClient;
 import com.obs.services.exception.ObsException;
 import com.obs.services.model.*;
+import com.qxueyou.scc.base.model.CacheConstants;
 import com.qxueyou.scc.base.model.FileMeta;
 import com.qxueyou.scc.base.model.Result;
 import com.qxueyou.scc.base.service.ICacheService;
@@ -128,7 +129,8 @@
         List<FileMeta> files = new ArrayList<FileMeta>(2);
         FileMeta fileMeta = null;
         try {
-            String destPath = getDestPath(objectKey);
+            System.out.println(objectKey);
+//            String destPath = getDestPath(objectKey);
             String bucketName = hweiOBSConfig.getBucketName();
             obsClient = hweiOBSConfig.getInstance();
 
@@ -142,7 +144,7 @@
             }
             InputStream inputStream = uploadFile.getInputStream();
             long available = inputStream.available();
-            PutObjectRequest request = new PutObjectRequest(bucketName,destPath,inputStream);
+            PutObjectRequest request = new PutObjectRequest(bucketName,objectKey,inputStream);
             ObjectMetadata objectMetadata = new ObjectMetadata();
             objectMetadata.setContentLength(available);
             request.setMetadata(objectMetadata);
@@ -416,8 +418,7 @@
 
     @Override
     public Result initUploadChunk(String uniqueId, String fileName, String md5) {
-        String path = getDestPath(fileName);
-        String key = chopPath(path);
+        String key = chopPath(fileName);
 
         //娓呯紦瀛�
         cache.template().delete(uniqueId + ClientUtils.getUserId());
@@ -434,12 +435,12 @@
 
         //涓洪厤鍚堝垎鐗囦笂浼狅紝鍚庡彴鍏堟柊寤烘枃浠惰褰�
 
-        ResFile file = newFileToDB(fileName, path, getFileType(fileName), 0l, md5);
+        ResFile file = newFileToDB(fileName, fileName, getFileType(fileName), 0l, md5);
 
         //娣诲姞鍒扮紦瀛�
         cache.template().opsForHash().put(uniqueId + ClientUtils.getUserId(), "uploadId", uploadId);
         cache.template().opsForHash().put(uniqueId + ClientUtils.getUserId(), "key", key);
-        cache.template().opsForHash().put(uniqueId + ClientUtils.getUserId(), "path", path);
+        cache.template().opsForHash().put(uniqueId + ClientUtils.getUserId(), "path", fileName);
         cache.template().opsForHash().put(uniqueId + ClientUtils.getUserId(), "fileId", file.getFileId());
 
         //闃叉浜х敓杩囧缂撳瓨鍨冨溇

--
Gitblit v1.8.0