Browse Source

Merge remote-tracking branch 'origin/master'

liuyc 2 năm trước cách đây
mục cha
commit
3d88672663

+ 55 - 36
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveAutoPdfServiceImpl.java

@@ -94,25 +94,36 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
 //        System.out.println();
 
 
-        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-        boolean flag = FileUtils.LocalPath.equals(file_path);
-        String excelUrl = file_path +  "\\备考表.xlsx";
-
-        Map<String, Object> DataInfo = new HashMap<>();
-
-        DataVO dataVO = FormulaUtil.convertCellToIndex("C2");
-        String key =  "1__"+ dataVO.getY() + "_" + dataVO.getX();
-        DataInfo.put(key,"档号12345688888888888888888888888888888888888888888888888888888888888");
-
-        DataVO dataVO1 = FormulaUtil.convertCellToIndex("A9");
-        String key1 =  "2__"+ dataVO1.getY() + "_" + dataVO1.getX();
-        DataInfo.put(key1,"hahahahaa9999999999999999999999999999999999999999999999999999999999999");
-        try {
-            String url = getBussPdfInfo(pkeyId.toString(),DataInfo,excelUrl,file_path,null,null);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
+//        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+//        boolean flag = FileUtils.LocalPath.equals(file_path);
+//        String excelUrl = file_path +  "\\备考表.xlsx";
+//
+//        Map<String, Object> DataInfo = new HashMap<>();
+//
+//        DataVO dataVO = FormulaUtil.convertCellToIndex("C2");
+//        String key =  "1__"+ dataVO.getY() + "_" + dataVO.getX();
+//        DataInfo.put(key,"档号12345688888888888888888888888888888888888888888888888888888888888");
+//
+//        DataVO dataVO1 = FormulaUtil.convertCellToIndex("A9");
+//        String key1 =  "2__"+ dataVO1.getY() + "_" + dataVO1.getX();
+//        DataInfo.put(key1,"hahahahaa9999999999999999999999999999999999999999999999999999999999999");
+//        try {
+//            String url = getBussPdfInfo(pkeyId.toString(),DataInfo,excelUrl,file_path,null,null);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+        ArchivesAuto archivesAuto = new ArchivesAuto();
+        archivesAuto.setProjectId(1578599210897772545L);
+
+        ArchiveFile f1 = new ArchiveFile();
+        f1.setFileUrl("https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload/20220713/3b86dab241e5c000ed9ece1cd9734806.pdf");
+        f1.setIsElement(1);
+        ArchiveFile f2 = new ArchiveFile();
+        f2.setFileUrl("https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload/20220713/90a67cc96d14470f94a7ba0d6a86edaa.pdf");
+        List<ArchiveFile> waitFiles = new ArrayList<>();
+        waitFiles.add(f1);
+        waitFiles.add(f2);
+        builtFilePageNo(archivesAuto,waitFiles);
         System.out.println();
 
 
@@ -282,7 +293,11 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
         List<String> urls = new ArrayList<>();
         for (ArchiveFile f: waitArchiveFiles) {
             String url = getPdfFileUrl(f);
-            urls.add(url);
+            if (f.getIsElement() != null && f.getIsElement()== 1) {
+                urls.add(FileUtils.Element_FLAG + url);
+            } else {
+                urls.add(url);
+            }
         }
         String localPath = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         List<String> pageUrls = FileUtils.doForPageNumberUseItextpdf(urls,localPath,newIOSSClient, archivesAuto.getProjectId());
@@ -639,24 +654,28 @@ public class ArchiveAutoPdfServiceImpl implements IArchiveAutoPdfService {
 
         //todo  增加获取总大小
         for (ArchiveFile file:  datas) {
-            idx++;
-            //设置序号
-            file.setFid(idx);
-            //设置文件编号
-            if (StringUtil.isEmpty(file.getFileNumber())) {
-                file.setFileNumber("\\");
-            }
-            //设置页数
-            file.setPageNum(iStartPage.toString());
-
-            //最后一页
-            iStartPage +=   file.getFilePage();
-            if (idx >= datas.size() ) {
-                String lastPageNum = file.getPageNum() + "~" + (iStartPage-1);
-                file.setPageNum(lastPageNum);
-            }
 
+            if (file.getIsElement() != null && file.getIsElement()== 1){
 
+            }else {
+
+                idx++;
+                //设置序号
+                file.setFid(idx);
+                //设置文件编号
+                if (StringUtil.isEmpty(file.getFileNumber())) {
+                    file.setFileNumber("\\");
+                }
+                //设置页数
+                file.setPageNum(iStartPage.toString());
+
+                //最后一页
+                iStartPage += file.getFilePage();
+                if (idx >= datas.size()) {
+                    String lastPageNum = file.getPageNum() + "~" + (iStartPage - 1);
+                    file.setPageNum(lastPageNum);
+                }
+            }
 
             Map<String, Object> fileMap = new ObjectMapper().convertValue(file, Map.class);
             fileMapList.add(fileMap);

+ 8 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/utils/FileUtils.java

@@ -52,6 +52,8 @@ public class FileUtils {
 
     public static final String LocalPath = "/www/wwwroot/Users/hongchuangyanfa/Desktop/";
 
+    public static final String Element_FLAG = "FOUR_ELEMENT";
+
     public static void batchDownloadFileToZip(List<String> urls, HttpServletResponse response) {
         // 设置压缩流:直接写入response,实现边压缩边下载
         ZipOutputStream zipos = null;
@@ -437,6 +439,12 @@ public class FileUtils {
                         result.add("");
                         continue;
                     }
+                    //如果是封面四要素,就不需要再打码了
+                    if (url.startsWith(FileUtils.Element_FLAG)) {
+                        url = url.replaceFirst(FileUtils.Element_FLAG, "");
+                        result.add(url);
+                        continue;
+                    }
 
                     String fileNameWithExtension = url.substring(url.lastIndexOf("/") + 1); // 获取带有扩展名的文件名