Commit a9402e84 authored by wangqiang's avatar wangqiang

修改批量下载接口

parent 9774734e
...@@ -81,7 +81,10 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple ...@@ -81,7 +81,10 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple
List<V> quarterlyReportVOList = this.findRecursion(query).getContent(); List<V> quarterlyReportVOList = this.findRecursion(query).getContent();
if (!ObjectUtils.isEmpty(quarterlyReportVOList)) { if (!ObjectUtils.isEmpty(quarterlyReportVOList)) {
ExtQuarterlyReportVO extQuarterlyReportVO = quarterlyReportVOList.get(0); ExtQuarterlyReportVO extQuarterlyReportVO = quarterlyReportVOList.get(0);
this.extFindFileIds(fileIds, extQuarterlyReportVO.getObjFileLinks(), Constants.MASTER_FILE); //取出所有行动项的附件id
for(ExtActionItemVO extActionItemVO:extQuarterlyReportVO.getExtActionItems()){
this.extFindFileIds(fileIds, extActionItemVO.getObjFileLinks(), Constants.MASTER_FILE);
}
if (!CollectionUtils.isEmpty(fileIds)) { if (!CollectionUtils.isEmpty(fileIds)) {
fileIds.stream().forEach(fileId -> { fileIds.stream().forEach(fileId -> {
try { try {
...@@ -94,7 +97,8 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple ...@@ -94,7 +97,8 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple
}); });
//压缩文件 //压缩文件
downloadDataZip(response, tempDir); downloadDataZip(response, tempDir);
// todo 删除临时文件夹 //删除生成后的临时文件
FileUtils.deleteDirectory(tempDir);
} else { } else {
throw new DxBusinessException("-1", "根据季报id:" + id + "未查到报表数据"); throw new DxBusinessException("-1", "根据季报id:" + id + "未查到报表数据");
} }
...@@ -154,11 +158,8 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple ...@@ -154,11 +158,8 @@ public class ExtQuarterlyReportServiceImpl<V extends ExtQuarterlyReportVO> imple
*/ */
private void extFindFileIds(List<Long> fileIds, List<ObjFileLinkVO> objFileLinks, String fileType) { private void extFindFileIds(List<Long> fileIds, List<ObjFileLinkVO> objFileLinks, String fileType) {
if (!CollectionUtils.isEmpty(objFileLinks)) { if (!CollectionUtils.isEmpty(objFileLinks)) {
//遍历取主内容的文件id //遍历取文件id
List<ObjFileLinkVO> objFileLinkVOs = objFileLinks.stream().filter(n -> n.getContentType().equals(fileType)).collect(Collectors.toList()); objFileLinks.stream().forEach(o -> {fileIds.add(o.getTargetId());});
objFileLinkVOs.stream().forEach(o -> {
fileIds.add(o.getTargetId());
});
} }
} }
} }
......
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