Commit 44093198 authored by 盖献康's avatar 盖献康

Merge branch 'gaixiankang' into 'dev'

检验报告PDF

See merge request !263
parents f12ff361 36eac3bc
...@@ -30,6 +30,7 @@ import java.lang.reflect.Field; ...@@ -30,6 +30,7 @@ import java.lang.reflect.Field;
import java.net.URL; import java.net.URL;
import java.util.*; import java.util.*;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* PDF模板管理Service业务层处理 * PDF模板管理Service业务层处理
...@@ -145,7 +146,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -145,7 +146,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
PdfPTable pictureTable = new PdfPTable(new float[]{25, 25, 25, 25}); PdfPTable pictureTable = new PdfPTable(new float[]{25, 25, 25, 25});
pictureTable.setWidthPercentage(90); pictureTable.setWidthPercentage(90);
pictureTable.setSpacingBefore(10); pictureTable.setSpacingBefore(10);
List<String> pictureList = Arrays.asList(data.getSamplePhotos().split(",")); List<String> pictureList = Arrays.stream(data.getSamplePhotos().split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList());
int result = pictureList.size(); int result = pictureList.size();
while (result % 4 != 0) { while (result % 4 != 0) {
result++; result++;
...@@ -153,7 +154,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -153,7 +154,7 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe
for (int i = 0; i < result; i++) { for (int i = 0; i < result; i++) {
PdfPCell cell = new PdfPCell(); PdfPCell cell = new PdfPCell();
cell.setBorder(Rectangle.NO_BORDER); cell.setBorder(Rectangle.NO_BORDER);
Optional<String> optionalElement = i < pictureList.size() Optional<String> optionalElement = i < pictureList.size() - 1
? Optional.of(pictureList.get(i)) ? Optional.of(pictureList.get(i))
: Optional.empty(); : Optional.empty();
if (optionalElement.isPresent() && StrUtil.isNotEmpty(optionalElement.get())) { if (optionalElement.isPresent() && StrUtil.isNotEmpty(optionalElement.get())) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment