Commit f52aa9b7 authored by yanzg's avatar yanzg

Excel导出功能

parent 06e5e0a6
...@@ -11,6 +11,7 @@ import java.io.RandomAccessFile; ...@@ -11,6 +11,7 @@ import java.io.RandomAccessFile;
/** /**
* 登录相关函数 * 登录相关函数
*
* @author 颜佐光 * @author 颜佐光
*/ */
public class FileHelper { public class FileHelper {
...@@ -169,18 +170,20 @@ public class FileHelper { ...@@ -169,18 +170,20 @@ public class FileHelper {
boolean flag = true; boolean flag = true;
//删除文件夹下的所有文件(包括子目录) //删除文件夹下的所有文件(包括子目录)
File[] files = dirFile.listFiles(); File[] files = dirFile.listFiles();
for (int i = 0; i < files.length; i++) { if (files != null) {
//删除子文件 for (int i = 0; i < files.length; i++) {
if (files[i].isFile()) { //删除子文件
flag = deleteFile(files[i].getAbsolutePath()); if (files[i].isFile()) {
if (!flag) { flag = deleteFile(files[i].getAbsolutePath());
break; if (!flag) {
} break;
} //删除子目录 }
else { } //删除子目录
flag = deleteDirectory(files[i].getAbsolutePath()); else {
if (!flag) { flag = deleteDirectory(files[i].getAbsolutePath());
break; if (!flag) {
break;
}
} }
} }
} }
......
...@@ -246,6 +246,9 @@ public class ZipHelper { ...@@ -246,6 +246,9 @@ public class ZipHelper {
*/ */
private static void dealDirFile(File dirFile, String parentDir, BufferedOutputStream bufferOutStream, ZipOutputStream zipOutStream) throws IOException { private static void dealDirFile(File dirFile, String parentDir, BufferedOutputStream bufferOutStream, ZipOutputStream zipOutStream) throws IOException {
File[] fileList = dirFile.listFiles(); File[] fileList = dirFile.listFiles();
if (fileList == null) {
return;
}
for (File file : fileList) { for (File file : fileList) {
if (file.isFile()) { if (file.isFile()) {
// 创建压缩文件实体 // 创建压缩文件实体
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment