|
|
@@ -238,6 +238,7 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp |
|
|
|
f.delete(); |
|
|
|
f.createNewFile(); |
|
|
|
} |
|
|
|
log.info("开始编写word文件,文件为:{}",filePath); |
|
|
|
wordUtils.openDocument(filePath); |
|
|
|
wordUtils.getDocument().setPageSize(PageSize.A4); |
|
|
|
wordUtils.getDocument().setMargins(71f, 71f, 72f, 72f); |
|
|
@@ -281,6 +282,7 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp |
|
|
|
table.addCell(cell); |
|
|
|
} |
|
|
|
wordUtils.getDocument().add(table); |
|
|
|
log.info("林场信息写入完成"); |
|
|
|
|
|
|
|
wordUtils.insertTitlePatternThird("二:巡检信息", WordUtilsOld.rtfGsBt3); |
|
|
|
Table table2 = new Table(2);//生成一表格 |
|
|
@@ -340,6 +342,7 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp |
|
|
|
table2.addCell(cell); |
|
|
|
} |
|
|
|
wordUtils.getDocument().add(table2); |
|
|
|
log.info("巡检信息写入完成"); |
|
|
|
|
|
|
|
List<QuestionTypeCountVO> questionTypeInfo = reportInfoVO.getQuestionTypeInfo(); |
|
|
|
Map<String, Integer> questionCount=new HashMap<>(); |
|
|
@@ -420,6 +423,7 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp |
|
|
|
wordUtils.getDocument().add(table3); |
|
|
|
} |
|
|
|
|
|
|
|
log.info("巡检结果写入完成"); |
|
|
|
if (reportInfoVO.getQuestionReportList().size() > 0) { |
|
|
|
wordUtils.insertTitlePatternThird("四:问题清单", WordUtilsOld.rtfGsBt3); |
|
|
|
log.info("报告标题四成功"); |
|
|
@@ -491,11 +495,12 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp |
|
|
|
} |
|
|
|
|
|
|
|
wordUtils.closeDocument(); |
|
|
|
log.info("问题清单写入完成"); |
|
|
|
|
|
|
|
//清空缓存 |
|
|
|
response.reset(); |
|
|
|
// 定义浏览器响应表头,并定义下载名 |
|
|
|
String urlFileName = URLEncoder.encode("汤山林场无人机巡检报告【"+ reportInfoVO.getReportNo() + "】.doc", "UTF-8"); |
|
|
|
String urlFileName = URLEncoder.encode("汤山林场无人机巡检报告【"+ reportInfoVO.getReportNo() + "】.docx", "UTF-8"); |
|
|
|
response.setHeader("Content-Disposition", "attachment;filename=" + urlFileName); |
|
|
|
response.setCharacterEncoding("utf-8"); |
|
|
|
//定义下载的类型 |
|
|
@@ -503,6 +508,7 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp |
|
|
|
OutputStream out; |
|
|
|
File files = new File(filePath); |
|
|
|
|
|
|
|
log.info("读出的文件文件地址为:{}",filePath); |
|
|
|
FileInputStream inputStream = new FileInputStream(files); |
|
|
|
//3.通过response获取ServletOutputStream对象(out) |
|
|
|
out = response.getOutputStream(); |