|
@@ -28,6 +28,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.net.URI;
|
|
import java.net.URI;
|
|
|
|
+import java.nio.charset.Charset;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.zip.ZipEntry;
|
|
import java.util.zip.ZipEntry;
|
|
import java.util.zip.ZipFile;
|
|
import java.util.zip.ZipFile;
|
|
@@ -243,8 +244,9 @@ public class SubProjectInfoService extends CrudService<SubProjectInfoDao, SubPro
|
|
@Transactional(readOnly = false)
|
|
@Transactional(readOnly = false)
|
|
public Integer subProjectFileManage(SubProjectInfo subProjectInfo,String destDirPath){
|
|
public Integer subProjectFileManage(SubProjectInfo subProjectInfo,String destDirPath){
|
|
Integer result = 0;
|
|
Integer result = 0;
|
|
|
|
+ File file = null;
|
|
try {
|
|
try {
|
|
- File file = new File(destDirPath);
|
|
|
|
|
|
+ file = new File(destDirPath);
|
|
File[] files = file.listFiles();
|
|
File[] files = file.listFiles();
|
|
Arrays.sort(files);
|
|
Arrays.sort(files);
|
|
if(files.length > 1){
|
|
if(files.length > 1){
|
|
@@ -304,11 +306,12 @@ public class SubProjectInfoService extends CrudService<SubProjectInfoDao, SubPro
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- deleteAllFilesOfDir(file);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
|
+ }finally {
|
|
|
|
+ deleteAllFilesOfDir(file);
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
@@ -495,7 +498,9 @@ public class SubProjectInfoService extends CrudService<SubProjectInfoDao, SubPro
|
|
// 开始解压
|
|
// 开始解压
|
|
ZipFile zipFile = null;
|
|
ZipFile zipFile = null;
|
|
try {
|
|
try {
|
|
- zipFile = new ZipFile(file);
|
|
|
|
|
|
+ //zipFile = new ZipFile(file);
|
|
|
|
+ //添加解压编码,解决解压报错问题
|
|
|
|
+ zipFile = new ZipFile(file, Charset.forName("GBK"));
|
|
Enumeration<?> entries = zipFile.entries();
|
|
Enumeration<?> entries = zipFile.entries();
|
|
while (entries.hasMoreElements()) {
|
|
while (entries.hasMoreElements()) {
|
|
ZipEntry entry = (ZipEntry) entries.nextElement();
|
|
ZipEntry entry = (ZipEntry) entries.nextElement();
|