Commit 60a7f56a authored by 廖旭伟's avatar 廖旭伟

修复模板生成表单可能出现重复表单的bug

parent 13887d77
Pipeline #2346 failed with stages
...@@ -201,7 +201,13 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD ...@@ -201,7 +201,13 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
config.initAttribute(); config.initAttribute();
root.setConfig(config); root.setConfig(config);
List<ListItem> collect = new ArrayList<>(); List<ListItem> collect = new ArrayList<>();
HashSet<String> hs = new HashSet<>(); //去除重复标签
for (MetaTemplate item : template.getElementTemplates()) { for (MetaTemplate item : template.getElementTemplates()) {
if(hs.contains(item.variable())){
continue;
}else {
hs.add(item.variable());
}
//识别简单输入 //识别简单输入
String val = StrUtil.strip(item.variable(), "{{", "}}"); String val = StrUtil.strip(item.variable(), "{{", "}}");
List<String> keys = StrSplitter.split(val, "_", true, true); List<String> keys = StrSplitter.split(val, "_", true, true);
...@@ -216,6 +222,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD ...@@ -216,6 +222,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
cons.setUploadFileUrl(uploadUrl); cons.setUploadFileUrl(uploadUrl);
if (type.equalsIgnoreCase(ComponentEnum.DYNAMIC_TABLE.getValue())) { if (type.equalsIgnoreCase(ComponentEnum.DYNAMIC_TABLE.getValue())) {
HashSet<String> dhs = new HashSet<>(); //去除重复标签
List<TableColItem> colList = new ArrayList<>(); List<TableColItem> colList = new ArrayList<>();
//表格 结构化绑定数据 //表格 结构化绑定数据
ConfigureBuilder builderTable = Configure.builder(); ConfigureBuilder builderTable = Configure.builder();
...@@ -225,6 +232,11 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD ...@@ -225,6 +232,11 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
XWPFTemplate templateTable = XWPFTemplate.compile(filepath, builderTable.build()); XWPFTemplate templateTable = XWPFTemplate.compile(filepath, builderTable.build());
for (MetaTemplate col : templateTable.getElementTemplates()) { for (MetaTemplate col : templateTable.getElementTemplates()) {
if(dhs.contains(col.variable())){
continue;
}else {
dhs.add(col.variable());
}
String colVal = StrUtil.strip(col.variable(), "[", "]"); String colVal = StrUtil.strip(col.variable(), "[", "]");
if (!StrUtil.startWith(colVal, label)) { if (!StrUtil.startWith(colVal, label)) {
continue; continue;
......
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