Commit 1b8a91d6 authored by 赵啸非's avatar 赵啸非

添加文档模板说明文件

parent 997e1f19
......@@ -15,6 +15,7 @@ import com.deepoove.poi.data.PictureRenderData;
import com.deepoove.poi.data.PictureType;
import com.deepoove.poi.data.Pictures;
import com.deepoove.poi.plugin.table.MultipleRowTableRenderPolicy;
import com.deepoove.poi.util.RegexUtils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.mortals.framework.exception.AppException;
......@@ -270,7 +271,6 @@ public class DocBaseinfoServiceImpl extends AbstractCRUDServiceImpl<DocBaseinfoD
@Override
public String submitOtherSystem(String form, Long templateId, String previewPath, String mergeDocPath, Context context) {
String redirectPath = "";
DocTemplateEntity docTemplateEntity = docTemplateService.get(templateId);
if (!ObjectUtils.isEmpty(docTemplateEntity)) {
......@@ -299,6 +299,7 @@ public class DocBaseinfoServiceImpl extends AbstractCRUDServiceImpl<DocBaseinfoD
//转换表单参数为map集合
ObjectMapper mapper = new ObjectMapper();
ConfigureBuilder builder = Configure.builder();
builder.buildGrammerRegex(RegexUtils.createGeneral("{{", "}}"));
try {
Map<String, Object> data = mapper.readValue(docFormVo.getFormContent(), Map.class);
//遍历查看是否有图片数据,多选框
......
......@@ -40,8 +40,8 @@ public class DocFormController extends BaseCRUDJsonBodyMappingController<DocForm
public static void main(String[] args) {
DocFormEntity docFormEntity = new DocFormEntity();
docFormEntity.setFormContent("{\"i_1_标题\":\"1231\",\"date_1_会议时间\":\"2022 年 09 月 14 日\",\"i_1_会议地点\":\"312313\",\"dt_1_汇报\":[{\"i_1_汇报人\":\"12313\",\"date_1_汇报时间\":\"\",\"t_1_汇报内容\":\"12313\",\"index\":0},{\"i_1_汇报人\":\"333\",\"date_1_汇报时间\":\"\",\"t_1_汇报内容\":\"3333\",\"index\":1}],\"i_1_记录人\":\"11123\",\"ck_1_政治面貌_<党员-非党员-党员先锋岗>\":[\"党员\"],\"r_1_证件类型_<身份证-军官证-残疾证>\":\"身份证\",\"s_1_设备类型_<呼叫器-窗口屏-评价器>\":\"窗口屏\",\"@image_1_照片\":\"/file/uploadfile/1663825533953.jpg\"}");
docFormEntity.setTemplateId(50L);
docFormEntity.setFormContent("{\"i_1_标题\":\"测试标题\",\"date_1_会议时间\":\"2022 年 09 月 24 日\",\"i_1_会议地点\":\"人民北路\",\"dt_1_汇报\":[{\"汇报_i_1_汇报人\":\"张三\",\"汇报_date_1_汇报时间\":\"\",\"汇报_t_1_汇报内容\":\"今天出去吃饭了\",\"index\":0},{\"汇报_i_1_汇报人\":\"李四\",\"汇报_date_1_汇报时间\":\"\",\"汇报_t_1_汇报内容\":\"今天去拜访客户了\",\"index\":1}],\"i_1_记录人\":\"王五\",\"ck_1_政治面貌_<党员-非党员-党员先锋岗>\":[\"党员\"],\"r_1_证件类型_<身份证-军官证-残疾证>\":\"身份证\",\"s_1_设备类型_<呼叫器-窗口屏-评价器>\":\"窗口屏\",\"@image_1_照片\":\"/file/uploadfile/1663833519018.jpg\"}");
docFormEntity.setTemplateId(1L);
System.out.println(JSON.toJSONString(docFormEntity));
......
......@@ -252,12 +252,17 @@ public class DocTemplateServiceImpl extends AbstractCRUDServiceImpl<DocTemplateD
builderTable.useDefaultEL(false);
builderTable.buildGramer("[", "]");
XWPFTemplate templateTable = XWPFTemplate.compile(filepath, builderTable.build());
templateTable.getElementTemplates().forEach(col -> {
for (MetaTemplate col : templateTable.getElementTemplates()) {
String colVal = StrUtil.strip(col.variable(), "[", "]");
if (!StrUtil.startWith(colVal, label)) {
continue;
}
List<String> colKeys = StrSplitter.split(colVal, "_", true, true);
if (colKeys.size() > 2) {
String colLabel = colKeys.get(2);
String colType = colKeys.get(0);
//提取当前table中的列元素
if (colKeys.size() > 3) {
String colLabel = colKeys.get(3);
String colType = colKeys.get(1);
TableColItem tableColItem = new TableColItem();
tableColItem.setLabel(colLabel);
tableColItem.setColType(colType);
......@@ -265,7 +270,7 @@ public class DocTemplateServiceImpl extends AbstractCRUDServiceImpl<DocTemplateD
colList.add(tableColItem);
System.out.println("列元素" + col.variable());
}
});
}
cons.setColList(colList);
DesignComponent designComponent = DesignComponent.createType(type);
ListItem listItem = designComponent.buildDefaultComponent(cons);
......
......@@ -31,8 +31,8 @@ Content-Type: application/json
{
"deleted": 0,
"formContent": "{\"i_1_标题\":\"1231\",\"date_1_会议时间\":\"2022 年 09 月 14 日\",\"i_1_会议地点\":\"312313\",\"dt_1_汇报\":[{\"i_1_汇报人\":\"12313\",\"date_1_汇报时间\":\"\",\"t_1_汇报内容\":\"12313\",\"index\":0},{\"i_1_汇报人\":\"333\",\"date_1_汇报时间\":\"\",\"t_1_汇报内容\":\"3333\",\"index\":1}],\"i_1_记录人\":\"11123\",\"ck_1_政治面貌_<党员-非党员-党员先锋岗>\":[\"党员\"],\"r_1_证件类型_<身份证-军官证-残疾证>\":\"身份证\",\"s_1_设备类型_<呼叫器-窗口屏-评价器>\":\"窗口屏\",\"@image_1_照片\":\"/file/uploadfile/1663825533953.jpg\"}",
"templateId": 52
"formContent": "{\"i_1_标题\":\"测试标题\",\"date_1_会议时间\":\"2022 年 09 月 24 日\",\"i_1_会议地点\":\"人民北路\",\"dt_1_汇报\":[{\"汇报_i_1_汇报人\":\"张三\",\"汇报_date_1_汇报时间\":\"\",\"汇报_t_1_汇报内容\":\"今天出去吃饭了\",\"index\":0},{\"汇报_i_1_汇报人\":\"李四\",\"汇报_date_1_汇报时间\":\"\",\"汇报_t_1_汇报内容\":\"今天去拜访客户了\",\"index\":1}],\"i_1_记录人\":\"王五\",\"ck_1_政治面貌_<党员-非党员-党员先锋岗>\":[\"党员\"],\"r_1_证件类型_<身份证-军官证-残疾证>\":\"身份证\",\"s_1_设备类型_<呼叫器-窗口屏-评价器>\":\"窗口屏\",\"@image_1_照片\":\"/file/uploadfile/1663833519018.jpg\"}",
"templateId": 1
}
......
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