Commit aac088b9 authored by 廖旭伟's avatar 廖旭伟

修复form表单可能会重复生成的bug

parent c22f51d0
...@@ -28,10 +28,7 @@ import com.mortals.xhx.module.certificate.dao.CertificateCatalogDao; ...@@ -28,10 +28,7 @@ import com.mortals.xhx.module.certificate.dao.CertificateCatalogDao;
import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity; import com.mortals.xhx.module.certificate.model.CertificateCatalogEntity;
import com.mortals.xhx.module.certificate.service.CertificateCatalogService; import com.mortals.xhx.module.certificate.service.CertificateCatalogService;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
...@@ -126,7 +123,13 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi ...@@ -126,7 +123,13 @@ public class CertificateCatalogServiceImpl extends AbstractCRUDServiceImpl<Certi
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);
......
...@@ -163,8 +163,8 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -163,8 +163,8 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
DocTemplateVO docTemplate = new DocTemplateVO(catalog.getOriginalUrl(),applyLogEntity.getOriFormContent()); DocTemplateVO docTemplate = new DocTemplateVO(catalog.getOriginalUrl(),applyLogEntity.getOriFormContent());
String paths = preview(docTemplate, context); String paths = preview(docTemplate, context);
String[] vals = paths.split(";"); String[] vals = paths.split(";");
applyLogEntity.setOriginalUrl(vals[1]); applyLogEntity.setOriginalUrl(vals[0]);
applyLogEntity.setOriPreview(vals[0]); applyLogEntity.setOriPreview(vals[1]);
applyLogEntity.setCreateTime(new Date()); applyLogEntity.setCreateTime(new Date());
if(context!=null && context.getUser()!=null) { if(context!=null && context.getUser()!=null) {
applyLogEntity.setCreateUserId(context.getUser().getId()); applyLogEntity.setCreateUserId(context.getUser().getId());
...@@ -182,8 +182,8 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -182,8 +182,8 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
DocTemplateVO docTemplate = new DocTemplateVO(catalog.getDuplicateUrl(),applyLogEntity.getDupFormContent()); DocTemplateVO docTemplate = new DocTemplateVO(catalog.getDuplicateUrl(),applyLogEntity.getDupFormContent());
String paths = preview(docTemplate, context); String paths = preview(docTemplate, context);
String[] vals = paths.split(";"); String[] vals = paths.split(";");
applyLogEntity.setDuplicateUrl(vals[1]); applyLogEntity.setDuplicateUrl(vals[0]);
applyLogEntity.setDupPreview(vals[0]); applyLogEntity.setDupPreview(vals[1]);
applyLogEntity.setCreateTime(new Date()); applyLogEntity.setCreateTime(new Date());
if(context!=null && context.getUser()!=null) { if(context!=null && context.getUser()!=null) {
applyLogEntity.setCreateUserId(context.getUser().getId()); applyLogEntity.setCreateUserId(context.getUser().getId());
...@@ -204,16 +204,16 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap ...@@ -204,16 +204,16 @@ public class ApplyLogServiceImpl extends AbstractCRUDServiceImpl<ApplyLogDao, Ap
DocTemplateVO docTemplate = new DocTemplateVO(catalog.getOriginalUrl(),applyLogEntity.getOriFormContent()); DocTemplateVO docTemplate = new DocTemplateVO(catalog.getOriginalUrl(),applyLogEntity.getOriFormContent());
String paths = preview(docTemplate, context); String paths = preview(docTemplate, context);
String[] vals = paths.split(";"); String[] vals = paths.split(";");
applyLogEntity.setOriginalUrl(vals[1]); applyLogEntity.setOriginalUrl(vals[0]);
applyLogEntity.setOriPreview(vals[0]); applyLogEntity.setOriPreview(vals[1]);
CertificateClassifyEntity classifyEntity = certificateClassifyService.get(catalog.getClassifyId()); CertificateClassifyEntity classifyEntity = certificateClassifyService.get(catalog.getClassifyId());
if(classifyEntity!=null && classifyEntity.getClassifyType()== ClassifyType.PRINCIPAL_AND_VICE.getValue()) { if(classifyEntity!=null && classifyEntity.getClassifyType()== ClassifyType.PRINCIPAL_AND_VICE.getValue()) {
docTemplate.setFormContent(applyLogEntity.getDupFormContent()); docTemplate.setFormContent(applyLogEntity.getDupFormContent());
docTemplate.setTemplatePath(catalog.getDuplicateUrl()); docTemplate.setTemplatePath(catalog.getDuplicateUrl());
String paths1 = preview(docTemplate, context); String paths1 = preview(docTemplate, context);
String[] vals1 = paths1.split(";"); String[] vals1 = paths1.split(";");
applyLogEntity.setDuplicateUrl(vals1[1]); applyLogEntity.setDuplicateUrl(vals1[0]);
applyLogEntity.setDupPreview(vals1[0]); applyLogEntity.setDupPreview(vals1[1]);
} }
applyLogEntity.setCreateTime(new Date()); applyLogEntity.setCreateTime(new Date());
if(context!=null && context.getUser()!=null) { if(context!=null && context.getUser()!=null) {
......
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