|
|
@@ -715,14 +715,19 @@ public class FinanceRecordController extends BaseController {
|
|
|
p.put("list",list);
|
|
|
return AjaxResult.success(p);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 导出附件
|
|
|
+ * @param response
|
|
|
+ * @param zfrFinanceId 融信id
|
|
|
+ * @param zfrId 融资id
|
|
|
* @return
|
|
|
+ * @throws Exception
|
|
|
*/
|
|
|
@PreAuthorize(hasPermi = "finance:record:export")
|
|
|
@Log(title = "融资管理", businessType = BusinessType.EXPORT)
|
|
|
- @PostMapping("/export/{zfrFinanceId}")
|
|
|
- public AjaxResult export(HttpServletResponse response,@PathVariable String zfrFinanceId ) throws Exception {
|
|
|
+ @PostMapping("/export/{zfrFinanceId}/{zfrId}")
|
|
|
+ public AjaxResult export(HttpServletResponse response,@PathVariable String zfrFinanceId ,@PathVariable String zfrId) throws Exception {
|
|
|
List<Map<String, String>> list = new ArrayList<>();
|
|
|
//查询往来账款
|
|
|
LambdaQueryWrapper<ZcFinanceBillRel> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
@@ -815,7 +820,7 @@ public class FinanceRecordController extends BaseController {
|
|
|
}
|
|
|
//融资附件关联表
|
|
|
LambdaQueryWrapper<ZcFinanceRecordFileRel> recordFileRelWrapper = new LambdaQueryWrapper<>();
|
|
|
- recordFileRelWrapper.in(ZcFinanceRecordFileRel::getZfrfrFinanceId,zfrFinanceId);
|
|
|
+ recordFileRelWrapper.in(ZcFinanceRecordFileRel::getZfrfrFinanceId,zfrId);
|
|
|
List<ZcFinanceRecordFileRel> recordRelList = financeRecordFileRelService.findZcFinanceRecordFileRels(recordFileRelWrapper);
|
|
|
//不为空
|
|
|
if (recordRelList.size() > 0){
|
|
|
@@ -893,15 +898,17 @@ public class FinanceRecordController extends BaseController {
|
|
|
//构造最终压缩包的输出流
|
|
|
zipStream = new ZipOutputStream(new FileOutputStream(zipFile));
|
|
|
//TODO:未对文件不存在时进行操作,后期优化。
|
|
|
+ String number = "0";
|
|
|
for (Map crete : list) {
|
|
|
if(new UrlResource(CommonUtil.objToString(crete.get("pfiFileUrl"))).exists()) {
|
|
|
+ number = AmtUtil.add(number,"1",0);
|
|
|
InputStream zipSource = getFileInputStream(crete.get("pfiFileUrl")+"");
|
|
|
/**
|
|
|
* 压缩条目不是具体独立的文件,而是压缩包文件列表中的列表项,称为条目,就像索引一样这里的name就是文件名,
|
|
|
* 文件名和之前的重复就会导致文件被覆盖
|
|
|
*/
|
|
|
//在压缩目录中文件的名字
|
|
|
- ZipEntry zipEntry = new ZipEntry(CommonUtil.objToString(crete.get("pfiFileName")));
|
|
|
+ ZipEntry zipEntry = new ZipEntry(CommonUtil.objToString("No"+number+"_"+crete.get("pfiFileName")));
|
|
|
//定位该压缩条目位置,开始写入文件到压缩包中
|
|
|
zipStream.putNextEntry(zipEntry);
|
|
|
BufferedInputStream bufferStream = new BufferedInputStream(zipSource, 1024 * 10);
|