Commit 422785ee authored by wdy's avatar wdy

检验报告图片非空判断&标准库条件查询

parent e935c165
...@@ -359,28 +359,30 @@ public class PdfTemplateManagementServiceImpl implements PdfTemplateManagementSe ...@@ -359,28 +359,30 @@ 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.stream(samplePhoto.split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList()); if (samplePhoto != null) {
int result = pictureList.size(); List<String> pictureList = Arrays.stream(samplePhoto.split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList());
while (result % 4 != 0) { int result = pictureList.size();
result++; while (result % 4 != 0) {
} result++;
for (int i = 0; i < result; i++) { }
PdfPCell cell = new PdfPCell(); for (int i = 0; i < result; i++) {
cell.setBorder(Rectangle.NO_BORDER); PdfPCell cell = new PdfPCell();
Optional<String> optionalElement = i < pictureList.size() cell.setBorder(Rectangle.NO_BORDER);
? Optional.of(pictureList.get(i)) Optional<String> optionalElement = i < pictureList.size()
: Optional.empty(); ? Optional.of(pictureList.get(i))
if (optionalElement.isPresent() && StrUtil.isNotEmpty(optionalElement.get())) { : Optional.empty();
Image image = Image.getInstance(new URL((minioEndpoint + optionalElement.get()).replace(" ", "%20"))); if (optionalElement.isPresent() && StrUtil.isNotEmpty(optionalElement.get())) {
image.scaleAbsolute(100, 100); Image image = Image.getInstance(new URL((minioEndpoint + optionalElement.get()).replace(" ", "%20")));
cell.addElement(image); image.scaleAbsolute(100, 100);
} else { cell.addElement(image);
Paragraph paragraph = new Paragraph(); } else {
cell.addElement(paragraph); Paragraph paragraph = new Paragraph();
cell.addElement(paragraph);
}
pictureTable.addCell(cell);
} }
pictureTable.addCell(cell); document.addContent(pictureTable);
} }
document.addContent(pictureTable);
} }
/** /**
......
...@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.List;
@ApiModel(value = "StandardEditRequest", description = "编辑标准") @ApiModel(value = "StandardEditRequest", description = "编辑标准")
@Data @Data
...@@ -36,4 +37,7 @@ public class StandardEditRequest { ...@@ -36,4 +37,7 @@ public class StandardEditRequest {
@ApiModelProperty("实施日期") @ApiModelProperty("实施日期")
private Date implementationDate; private Date implementationDate;
@ApiModelProperty("实施日期")
List<Long> dictList;
} }
...@@ -9,6 +9,17 @@ import lombok.Data; ...@@ -9,6 +9,17 @@ import lombok.Data;
@Data @Data
public class StandardListRequest extends PageDomain { public class StandardListRequest extends PageDomain {
@ApiModelProperty("关键字") @ApiModelProperty("标准号")
private String keyWord; private String standardNo;
@ApiModelProperty("标准名称")
private String name;
@ApiModelProperty("标准分类")
private String standardType;
@ApiModelProperty("标准状态")
private String standardStatus;
} }
...@@ -19,8 +19,17 @@ ...@@ -19,8 +19,17 @@
SELECT id, name, standard_no, file,standard_type,standard_status,release_date,implementation_date SELECT id, name, standard_no, file,standard_type,standard_status,release_date,implementation_date
FROM t_standard FROM t_standard
<where> <where>
<if test="keyWord != null and keyWord != ''"> <if test="standardType != null and standardType != ''">
name like concat('%',#{keyWord},'%') OR standard_no like concat('%',#{keyWord},'%') standard_type = #{standardType}
</if>
<if test="standardNo != null and standardNo != ''">
and standard_no like concat('%', #{standardNo}, '%')
</if>
<if test="name != null and name != ''">
and name like concat('%', #{name}, '%')
</if>
<if test="standardStatus != null and standardStatus != ''">
and standard_status = #{standardStatus}
</if> </if>
</where> </where>
</select> </select>
......
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