把模板放到resources中

This commit is contained in:
zer0Black
2022-06-09 23:44:47 +08:00
parent a16f92ff3b
commit b94c0e767a
4 changed files with 25 additions and 3 deletions
@@ -231,7 +231,6 @@ public class DummyInventoryInfoEOEn implements Serializable {
private String verifyDeliverableType;
/**验证符合性确认-交付物模板*/
@ApiModelProperty(value = "验证符合性确认-交付物模板")
private String verifyDeliverableTemplate;
@@ -5322,7 +5322,6 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
*/
@Override
public void downloadDocxReport(Map<String, Object> params, HttpServletRequest req, HttpServletResponse resp) {
File templateFile = null;
File exportFile = null;
InputStream fin = null;
ServletOutputStream out = null;
@@ -5463,7 +5462,27 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
dataMap.put("REGULATION_ENG", StringUtils.isNotEmpty(regulationOwnerName) ? regulationOwnerName : "");
log.debug("导出word报告,查询数据结束 =============================================================================");
log.debug("导出word报告,获取模板开始 =============================================================================");
templateFile = new File(exportPdfTempPath + "temp/ComplianceReportTemplate.docx");
File templateFile = new File(exportPdfTempPath + "temp/ComplianceReportTemplate.docx");
InputStream inputStream = ProjectLawsInventoryEOServiceImpl.class.getClassLoader().getResourceAsStream("exportPdfTemp/ComplianceReportTemplate.docx");
try {
FileUtils.copyInputStreamToFile(inputStream, templateFile);
} catch (IOException e) {
e.printStackTrace();
}
//
// try {
// OutputStream os = new FileOutputStream(templateFile);
// int bytesRead = 0;
// byte[] buffer = new byte[8192];
// while ((bytesRead = inputStream.read(buffer, 0, 8192)) != -1) {
// os.write(buffer, 0, bytesRead);
// }
// os.close();
// inputStream.close();
// } catch (Exception e) {
// e.printStackTrace();
// }
log.debug("导出word报告,获取模板结束 =============================================================================");
if(templateFile != null){
try {
@@ -5479,6 +5498,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
exportFile = new File(outFile);
FileOutputStream os = new FileOutputStream(outFile);
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new FileInputStream(templateFile));
// WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(inputStream);
//验证符合性流程实例id
String verifyPId = projectTaskInventoryEO.getVerifyPId();
+3
View File
@@ -355,6 +355,9 @@
<nonFilteredFileExtension>eot</nonFilteredFileExtension>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>svg</nonFilteredFileExtension>
<nonFilteredFileExtension>svg</nonFilteredFileExtension>
<nonFilteredFileExtension>doc</nonFilteredFileExtension>
<nonFilteredFileExtension>docx</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>