Explorar el Código

修改头条上传

yumeng hace 5 años
padre
commit
bde2a7cdb6

+ 7 - 0
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -159,3 +159,10 @@ logging:
 chrome:
   script:
     clean: sh /mnt/webapp/cleanProcess.sh
+
+oss:
+  replace:
+    replace-value: oss-cn-beijing
+    replace-old-value: oss-cn-beijing
+    download: D:\mnt\file\video
+

+ 5 - 0
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -157,3 +157,8 @@ chrome:
   script:
     clean: sh /mnt/webapp/cleanProcess.sh
 
+oss:
+  replace:
+    replace-value: oss-cn-beijing-internal
+    replace-old-value: oss-cn-beijing
+    download: /mnt/file/video/

+ 7 - 0
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -159,3 +159,10 @@ logging:
 chrome:
   script:
     clean: sh /mnt/webapp/cleanProcess.sh
+
+
+oss:
+  replace:
+    replace-value: oss-cn-beijing-internal
+    replace-old-value: oss-cn-beijing
+    download: /mnt/file/video/

+ 19 - 4
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java

@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.ParseException;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.core.io.FileSystemResource;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
@@ -44,7 +45,13 @@ import java.util.concurrent.Executors;
 @Slf4j
 @Service
 public class MaterialUploadServiceImpl implements IMaterialUploadService {
-    static ExecutorService executorService = Executors.newFixedThreadPool(3);
+    static ExecutorService executorService = Executors.newFixedThreadPool(4);
+    @Value("${oss.replace.replace-value}")
+    private String replaceValue;
+    @Value("${oss.replace.replace-old-value}")
+    private String replaceOldValue;
+    @Value("${oss.replace.download}")
+    private String downloadUrl;
 
 
     @Autowired
@@ -90,11 +97,14 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
             if (Check.isNull(materialInfo)) {
                 continue;
             }
+            if (Check.isNull(materialInfo.getUrl())) {
+                continue;
+            }
 
 
             try {
-
-                String localUrl = LoadFileUtil.downLoadFromUrl(materialInfo.getUrl(), PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
+                String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
+                String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
 
                 for (int i = 0; i < accountArray.size(); i++) {
                     Long accountId = accountArray.getLong(i);
@@ -141,8 +151,13 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
             if (Check.isNull(materialInfo)) {
                 continue;
             }
+            if (Check.isNull(materialInfo.getUrl())) {
+                continue;
+            }
             try {
-                String localUrl = LoadFileUtil.downLoadFromUrl(materialInfo.getUrl(), PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
+                String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
+                log.info("replaceUrl:{}", url);
+                String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
                 FileSystemResource resource = new FileSystemResource(new File(localUrl));
                 Map<String, String> headerMap = new HashMap<>();
                 headerMap.put("Content-Type", "multipart/form-data");