瀏覽代碼

试玩模块创建和优化3

zhaoxian 4 年之前
父節點
當前提交
aab5b4c480
共有 1 個文件被更改,包括 5 次插入6 次删除
  1. 5 6
      module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/FileUtil.java

+ 5 - 6
module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/FileUtil.java

@@ -170,23 +170,22 @@ public class FileUtil {
      * @param zipSavePath 压缩好的zip包存放路径
      * @param sourceFile  待压缩的文件(单个文件或者整个文件目录)
      * @return
-     * @Description
-     * @author xukaixun
+     * @author
      */
     public static String zipCompress(String zipSavePath, File sourceFile) {
         try {
             //创建zip输出流
             ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipSavePath));
             File[] fileList = sourceFile.listFiles();
-            if (fileList.length != 0)//如果文件夹为空,则只需在目的地zip文件中写入一个目录进入点
-            {
+            //如果文件夹为空,则只需在目的地zip文件中写入一个目录进入点
+            if (fileList.length != 0) {
                 for (File file : fileList) {
-                    compress(zos, file, sourceFile.getName() + "/" + file.getName());
+                    compress(zos, file, file.getName());
                 }
                 zos.close();
             }
         } catch (Exception e) {
-            log.error("zip compress file exception: {}, zipSavePath={}, sourceFile={}", e, zipSavePath, sourceFile.getName());
+            log.error("压缩文件异常 : {}, zipSavePath={}, sourceFile={}", e, zipSavePath, sourceFile.getName());
         }
         return zipSavePath;
     }