From f75fac3aaaf1e3783f2edb4d4e3261ffda7f9499 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Tue, 16 Aug 2022 16:19:53 +0800 Subject: [PATCH] fix --- src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java | 32 ++++++++++++++++++-------------- 1 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java b/src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java index 05e363f..e4ca7ce 100644 --- a/src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java +++ b/src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java @@ -18,7 +18,7 @@ * @date 2022-07-01 **/ @Slf4j -public class TemplateConfiguration extends Configuration{ +public class TemplateConfiguration extends Configuration { private TemplateLoader templateLoader; @@ -36,21 +36,25 @@ } map.put("apiUrl", API_URL); - String companyCode = (String) map.get("companyCode"); + try { + String companyCode = (String) map.get("companyCode"); - log.info("解析开始执行--#类型:{}#--#模板名称:{}#--#ID:{}#", map.get("templateType"), templateName, map.get("id")); - this.templateLoader.data(map); - Template template = template(FileUtils.path(templatePath, companyCode), templateName); - template.output(outputPath); - - // 判断是否有分页,有则执行。从第二页开始 - int i = 2; - while(Template.HAS_PAGING) { - map.put("page", i); + log.info("解析开始执行--#类型:{}#--#模板名称:{}#--#ID:{}#", map.get("templateType"), templateName, map.get("id")); this.templateLoader.data(map); - Template pageTemplate = template(FileUtils.path(templatePath, companyCode), templateName); - pageTemplate.output(outputPath); - i++; + Template template = template(FileUtils.path(templatePath, companyCode), templateName); + template.output(outputPath); + + // 判断是否有分页,有则执行。从第二页开始 + int i = 2; + while (Template.HAS_PAGING) { + map.put("page", i); + this.templateLoader.data(map); + Template pageTemplate = template(FileUtils.path(templatePath, companyCode), templateName); + pageTemplate.output(outputPath); + i++; + } + } catch (Exception e) { + log.error("页面编译异常", e); } } -- Gitblit v1.9.1