Commit 675871dc authored by fangxinjiang's avatar fangxinjiang

代码优化-fxj

parent 97126b8c
...@@ -4361,14 +4361,12 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE ...@@ -4361,14 +4361,12 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
response.setContentType("application/octet-stream"); response.setContentType("application/octet-stream");
response.setHeader("content-type", "application/octet-stream"); response.setHeader("content-type", "application/octet-stream");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + URLEncoder.encode(departName + departNo, "UTF-8") + ".zip"); response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + URLEncoder.encode(departName + departNo, "UTF-8") + ".zip");
ZipArchiveOutputStream zipOutput = null;
zipOutput = new ZipArchiveOutputStream(response.getOutputStream());
CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpClient httpClient = HttpClients.createDefault();
// 获取人员档案所有的附件信息 // 获取人员档案所有的附件信息
getFilesInfo(handles); getFilesInfo(handles);
// 处理附件 压缩并下载 // 处理附件 压缩并下载
if (Common.isNotNull(handles)) { if (Common.isNotNull(handles)) {
try { try (ZipArchiveOutputStream zipOutput = new ZipArchiveOutputStream(response.getOutputStream())){
CloseableHttpResponse response1; CloseableHttpResponse response1;
HttpEntity entity; HttpEntity entity;
byte[] data; byte[] data;
...@@ -4387,11 +4385,15 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE ...@@ -4387,11 +4385,15 @@ public class TPreEmpMainServiceImpl extends ServiceImpl<TPreEmpMainMapper, TPreE
} }
zipOutput.finish(); zipOutput.finish();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("C端项目人员签字附件下载打包异常:",e);
} }
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); log.error("C端项目人员签字附件下载异常:",e);
}finally {
if (Common.isNotNull(handles)){
handles.clear();
}
} }
} }
......
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