Selaa lähdekoodia

fix 调整接口

DYH2020 2 vuotta sitten
vanhempi
commit
41c28182a4

+ 9 - 12
src/main/java/com/ywt/mg/services/enterprise/ApplyProjectService.java

@@ -77,12 +77,12 @@ public class ApplyProjectService {
 //            item.put("测试文档.pdf", "https://ywt-files.oss-cn-shenzhen.aliyuncs.com//up/marketting_project/public/9-1b9a0a24f2be4cef882a22d1a5750ae5.pdf");
 
             List<MarketingImage> marketingImageList = getMarketingImageList(request);
-            if (Checker.isNone(marketingImageList)){
+            if (Checker.isNone(marketingImageList)) {
                 return;
             }
             for (int i = 0, j = marketingImageList.size(); i < j; i++) {
                 MarketingImage image = marketingImageList.get(i);
-                item.put(i+"_"+image.getName(), image.getImageUrl());
+                item.put(i + "_" + image.getName(), image.getImageUrl());
             }
 
             // 2、遍历记录去下载对应的文件到服务器;
@@ -113,8 +113,8 @@ public class ApplyProjectService {
             logger.error("ApplyProjectService#batchDownloadFiles(request:{}){}", JsonSerializer.toJson(request), e.getMessage(), e);
         } finally {
             // 5、删掉之前所有的文件;
-//            FileUtil.deleteFolders(filePrefix);
-//            FileUtil.deleteFolders(rootPrefix);
+            FileUtil.deleteFolders(filePrefix);
+            FileUtil.deleteFolders(rootPrefix);
         }
     }
 
@@ -238,8 +238,9 @@ public class ApplyProjectService {
      * @param request
      */
     public void createPDF(BatchDownloadFilesRequest request) {
-        String filePrefix = "";
-        String rootPrefix = "";
+        int number = (int) (Math.random() * 1000);
+        String filePrefix = APPLY_PROJECT_FILE_PATH + number + "/";
+        String rootPrefix = APPLY_PROJECT_ROOT_PATH + number + "/";
         try {
             // 1、先根据从前端选择的条件去数据库查找对应的记录
             Map<String, String> item = new HashMap<>();
@@ -255,10 +256,6 @@ public class ApplyProjectService {
             item.put("8", "89d6df3dd1cd4c29937e1f46899ac6e4jpeg");
             item.put("9", "ff31f865218240c5a37729352296ea25jpeg");
 
-            int number = (int) (Math.random() * 1000);
-            filePrefix = APPLY_PROJECT_FILE_PATH + number + "/";
-            rootPrefix = APPLY_PROJECT_ROOT_PATH + number + "/";
-
             // 2、遍历记录去下载对应的文件到服务器;
             List<String> fileUrl = new ArrayList<>();
             for (Map.Entry<String, String> entry : item.entrySet()) {
@@ -285,8 +282,8 @@ public class ApplyProjectService {
             logger.error("ApplyProjectService#batchDownloadFiles(request:{}){}", JsonSerializer.toJson(request), e.getMessage(), e);
         } finally {
             // 5、删掉之前所有的文件;
-//            FileUtil.deleteFolders(rootPrefix);
-//            FileUtil.deleteFolders(filePrefix);
+            FileUtil.deleteFolders(rootPrefix);
+            FileUtil.deleteFolders(filePrefix);
         }
     }