package com.ruoyi.inspect.util;
|
|
import com.deepoove.poi.config.Configure;
|
import com.deepoove.poi.render.RenderContext;
|
import com.deepoove.poi.template.ElementTemplate;
|
|
import java.util.Arrays;
|
import java.util.HashSet;
|
import java.util.Set;
|
|
/**
|
* 报告中的签名和印章会在编制、审核、批准等不同阶段分别写入。
|
* 保留后续阶段需要使用的图片占位符,避免在前面的渲染阶段被提前清除。
|
*/
|
public class PreserveReportPicturePlaceholderHandler implements Configure.ValidErrorHandler {
|
|
private static final Set<String> DEFERRED_PICTURE_TAGS = new HashSet<>(Arrays.asList(
|
"writeUrl",
|
"writeDateUrl",
|
"insUrl",
|
"examineUrl",
|
"examineDateUrl",
|
"ratifyUrl",
|
"ratifyDateUrl",
|
"seal1",
|
"seal2"
|
));
|
|
private final Configure.ClearHandler clearHandler = new Configure.ClearHandler();
|
|
@Override
|
public void handler(RenderContext<?> context) {
|
ElementTemplate template = context.getEleTemplate();
|
if (template != null
|
&& Character.valueOf('@').equals(template.getSign())
|
&& DEFERRED_PICTURE_TAGS.contains(template.getTagName())) {
|
return;
|
}
|
clearHandler.handler(context);
|
}
|
}
|