shicf
2024-06-12 a0a4e4027514ca678b6b7ec4dde3530e30b5ae25
src/main/java/com/product/file/util/FileUtil.java
@@ -1,8 +1,6 @@
package com.product.file.util;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.IdUtil;
import cn.hutool.poi.word.WordUtil;
import com.aspose.words.Document;
import com.aspose.words.SaveFormat;
import com.deepoove.poi.XWPFTemplate;
@@ -14,10 +12,6 @@
import com.product.file.config.CmnConst;
import com.product.file.config.FileCode;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.text.WordUtils;
import org.apache.log4j.Logger;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import java.io.*;
import java.util.List;
@@ -35,8 +29,6 @@
 */
@Slf4j
public class FileUtil {
   private static Properties properties;
   private FileUtil() {
   }
@@ -127,7 +119,6 @@
    * @return zip文件保存绝对路径
    */
   public static long createZip(List<Map<String, String>> pathList, OutputStream os) {
      log.info("正在打包文件...");
      try {
         long size = 0;
         ZipOutputStream out = new ZipOutputStream(os);
@@ -152,7 +143,6 @@
               fileName = head + "(" + showCount + ")." + tail;
            }
            fileNameCountMap.put(fileName, ++showCount);
            log.info(String.format("正在打包文件 %s", fileName));
            //以论文标题为每个文件命名
            FileInputStream fis = new FileInputStream(downloadPath);
@@ -164,11 +154,9 @@
            while ((len = fis.read(buffer)) > 0) {
               if (symbol == 1) {
                  // 加密
                  log.info("正在加密...");
                  out.write(encryption(buffer), 0, len);
               } else if (symbol == -1) {
                  // 解密
                  log.info("正在解密...");
                  out.write(decryption(buffer), 0, len);
               } else {
                  // 单纯的复制