认证-报库-自定义导出excel模板-导出历史

This commit is contained in:
liyawei
2022-08-01 18:04:02 +08:00
parent 6387cea86b
commit 8b87b177c8
2 changed files with 47 additions and 3 deletions
@@ -829,7 +829,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
InputStream excelTemplate = CosBootUtil.download(templateUrl);
SpreadsheetMLPackage pkg = SpreadsheetMLPackage.load(wordTemplate);
Workbook workbook = WorkbookFactory.create(excelTemplate);
ExcelUtil.replacePictureBatchPOI(workbook, pkg, imgListAll);
ExcelUtil.replacePictureBatchPOI(workbook, pkg, imgListAll, params);
ExcelUtil.variableReplace(pkg, params);
pkg.save(wordOS);
@@ -862,6 +862,19 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
os.write(len2);
}
// 添加导出历史
String uploadFileName = fileOriName + ".zip";
InputStream uploadFileio = new FileInputStream(new File(fileNowPath+".zip"));
MultipartFile mFile = new MockMultipartFile(uploadFileName, uploadFileName, "text/plain", uploadFileio); // 用于上传
OSSFile ossFile = ossFileService.uploadLocalOfCos(mFile, "/report", "", CutEnum.CN.getValue()); // 上传导出的压缩包
ParamsReportExportHistoryEO paramsReportExportHistoryEO = new ParamsReportExportHistoryEO();
paramsReportExportHistoryEO.setExportType(ExportTypeEnum.CUSTOM.getValue());
paramsReportExportHistoryEO.setExportFileId(ossFile.getId());
paramsReportExportHistoryEO.setParamsManifestId(paramsReportDetailVO.getParamsManifestId());
paramsReportExportHistoryEO.setExportTime(new Date());
paramsReportExportHistoryEOService.add(paramsReportExportHistoryEO);
uploadFileio.close();
os.flush();
os.close(); // 后开先关
fis.close(); // 先开后关