|
@@ -3481,9 +3481,9 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
|
|
|
int len;
|
|
|
byte[] buffer = new byte[1024];
|
|
|
- BufferedInputStream in = null;
|
|
|
+// BufferedInputStream in = null;
|
|
|
ZipOutputStream zos = null;
|
|
|
- InputStream inputStream = null;
|
|
|
+// InputStream inputStream = null;
|
|
|
File pdfFile = null;
|
|
|
try {
|
|
|
HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
|
@@ -3510,8 +3510,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
ResponseBodyVO<List<String>> list = fileDownService.list(minioParameter1);
|
|
|
List<String> info = list.getInfo();
|
|
|
for (String s : info) {
|
|
|
- String fileName = "";
|
|
|
- String zipPath = "";
|
|
|
+ String fileName;
|
|
|
+ String zipPath;
|
|
|
//获取文件名
|
|
|
if (s.contains("/")) {
|
|
|
fileName = s.substring(s.lastIndexOf("/") + 1);
|
|
@@ -3527,15 +3527,13 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
minioParameter2.setObjectName(s);
|
|
|
Response download2 = fileDownService.download(minioParameter2);
|
|
|
Response.Body body2 = download2.body();
|
|
|
- inputStream = body2.asInputStream();
|
|
|
- in = new BufferedInputStream(inputStream);
|
|
|
-
|
|
|
ZipEntry entry2 = new ZipEntry(zipPath);
|
|
|
zos.putNextEntry(entry2);
|
|
|
+ BufferedInputStream in = new BufferedInputStream(body2.asInputStream());
|
|
|
while ((len = in.read(buffer)) != -1) {
|
|
|
zos.write(buffer, 0, len);
|
|
|
}
|
|
|
-
|
|
|
+ in.close();
|
|
|
} else if (fileList.contains(fileName)) {
|
|
|
|
|
|
MinioParameter minioParameter = new MinioParameter();
|
|
@@ -3547,56 +3545,47 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
|
|
|
Response download = fileDownService.download(minioParameter);
|
|
|
Response.Body body = download.body();
|
|
|
- inputStream = body.asInputStream();
|
|
|
- in = new BufferedInputStream(inputStream);
|
|
|
|
|
|
//任务文件路径
|
|
|
String taskFilePath = taskPagePath + File.separator + fileName;
|
|
|
// FileUtil.writeInputStreamToLocalFile(inputStream,taskFilePath);
|
|
|
|
|
|
ZipEntry entry = new ZipEntry(taskFilePath);
|
|
|
- in = new BufferedInputStream(inputStream);
|
|
|
zos.putNextEntry(entry);
|
|
|
+ BufferedInputStream in = new BufferedInputStream(body.asInputStream());
|
|
|
while ((len = in.read(buffer)) != -1) {
|
|
|
zos.write(buffer, 0, len);
|
|
|
}
|
|
|
+ in.close();
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
i++;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //打包pdf
|
|
|
- if (param.getIsPagePdf() != null && param.getIsPagePdf() == true) {
|
|
|
- //获取工作信息
|
|
|
+ // 打包pdf
|
|
|
+ if (param.getIsPagePdf() != null && param.getIsPagePdf()) {
|
|
|
+ // 获取工作信息
|
|
|
SimulationManualProjectPo p = simulationProjectMapper.selectProjectBaseById(param);
|
|
|
|
|
|
pdfFile = new File(param.getLocalPdfFilePath());
|
|
|
FileInputStream fileInputStream = new FileInputStream(pdfFile);
|
|
|
- in = new BufferedInputStream(fileInputStream);
|
|
|
+ BufferedInputStream in = new BufferedInputStream(fileInputStream);
|
|
|
ZipEntry entry = new ZipEntry(rootPath + File.separator + p.getProjectName() + ".pdf");
|
|
|
zos.putNextEntry(entry);
|
|
|
while ((len = in.read(buffer)) != -1) {
|
|
|
zos.write(buffer, 0, len);
|
|
|
}
|
|
|
-
|
|
|
+ in.close();
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
} finally {
|
|
|
try {
|
|
|
- if (in != null) {
|
|
|
- in.close();
|
|
|
- }
|
|
|
if (zos != null) {
|
|
|
zos.close();
|
|
|
}
|
|
|
- if (inputStream != null) {
|
|
|
- inputStream.close();
|
|
|
- }
|
|
|
if (pdfFile != null) {
|
|
|
pdfFile.delete();
|
|
|
}
|