|
@@ -212,6 +212,8 @@ public class ReportServiceImpl implements IReportService {
|
|
|
List<FactorUseDTO> factorUseDTOS = factorImageMap.get(rootFactor.getId());
|
|
|
List<WktsVo.WktInfo> wktInfos = new ArrayList<>();
|
|
|
for (FactorUseDTO factorUseDTO : factorUseDTOS) {
|
|
|
+ if (factorUseDTO.getFactorName().equals("坡度") || factorUseDTO.getFactorName().equals("高程"))
|
|
|
+ continue;
|
|
|
String ewkt = getFactorWkt(geomRes.getGeom(), factorUseDTO.getFactorBsm());
|
|
|
|
|
|
Random random = new Random();
|
|
@@ -226,8 +228,19 @@ public class ReportServiceImpl implements IReportService {
|
|
|
|
|
|
wktInfos.add(wktInfo);
|
|
|
}
|
|
|
+ if (wktInfos.size() == 0) continue;
|
|
|
|
|
|
String imagePath = reportImg(wktInfos);
|
|
|
+ if (imagePath.equals("")) continue;
|
|
|
+ // 获取插入图片
|
|
|
+ NpoiHelper.content(document, rootFactor.getName(), pos++, ParagraphAlignment.CENTER);
|
|
|
+ ReportImage reportImage = getPathImage(imagePath, 300);
|
|
|
+
|
|
|
+ XWPFParagraph imageParagraph = document.createParagraph();
|
|
|
+ imageParagraph.setAlignment(ParagraphAlignment.CENTER); // Center align the image
|
|
|
+ XWPFRun imageRun = imageParagraph.createRun();
|
|
|
+ imageRun.addPicture(reportImage.getInputStream(), XWPFDocument.PICTURE_TYPE_PNG, null, Units.toEMU(reportImage.getUseWidth()), Units.toEMU(reportImage.getUseHeight()));
|
|
|
+ pos++;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -244,7 +257,7 @@ public class ReportServiceImpl implements IReportService {
|
|
|
NpoiHelper.content(document, fwfx, pos++);
|
|
|
|
|
|
// 获取插入图片
|
|
|
- ReportImage reportImage = getReportImage(geomRes.getGeom(), 300);
|
|
|
+ ReportImage reportImage = getWktImage(geomRes.getGeom(), 300);
|
|
|
|
|
|
XWPFParagraph imageParagraph = document.createParagraph();
|
|
|
imageParagraph.setAlignment(ParagraphAlignment.CENTER); // Center align the image
|
|
@@ -328,7 +341,7 @@ public class ReportServiceImpl implements IReportService {
|
|
|
|
|
|
// 获取地块图片
|
|
|
String geomWkt = item.getGeom();
|
|
|
- ReportImage imageTable = getReportImage(geomWkt, 300);
|
|
|
+ ReportImage imageTable = getWktImage(geomWkt, 300);
|
|
|
|
|
|
// 在合并后的单元格中创建一个新的段落
|
|
|
XWPFParagraph paraImag = row.getCell(0).addParagraph();
|
|
@@ -538,12 +551,25 @@ public class ReportServiceImpl implements IReportService {
|
|
|
* 获取报告图片
|
|
|
*
|
|
|
* @param wkt
|
|
|
+ * @param with
|
|
|
* @return
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
- private ReportImage getReportImage(String wkt, int with) throws IOException {
|
|
|
- ReportImage reportImage = new ReportImage();
|
|
|
+ private ReportImage getWktImage(String wkt, int with) throws IOException {
|
|
|
String path = reportImg(wkt);
|
|
|
+ ReportImage reportImage = getPathImage(path, with);
|
|
|
+ return reportImage;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据图片路径获取报告图片
|
|
|
+ *
|
|
|
+ * @param path
|
|
|
+ * @return
|
|
|
+ * @throws IOException
|
|
|
+ */
|
|
|
+ private ReportImage getPathImage(String path, int with) throws IOException {
|
|
|
+ ReportImage reportImage = new ReportImage();
|
|
|
|
|
|
System.out.println("图片路径path:" + path);
|
|
|
|