From a508775d5c69e61e605c8f00fc18e70279444869 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 11 Jul 2022 21:49:04 +0800
Subject: [PATCH] add companyCode

---
 src/main/java/com/xcong/farmer/cms/core/template/TemplateConfiguration.java |   10 +++++++---
 1 files changed, 7 insertions(+), 3 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 1c3b7f6..22ac0dc 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
@@ -1,5 +1,6 @@
 package com.xcong.farmer.cms.core.template;
 
+import com.xcong.farmer.cms.common.utils.FileUtils;
 import com.xcong.farmer.cms.core.node.PartNode;
 import com.xcong.farmer.cms.core.node.Template;
 import lombok.extern.slf4j.Slf4j;
@@ -32,10 +33,13 @@
         if (this.templateLoader == null) {
             throw new RuntimeException("TemplateLoader do not able to be null");
         }
+        map.put("apiUrl", API_URL);
+
+        String companyCode = (String) map.get("companyCode");
 
         log.info("解析开始执行--#类型:{}#--#模板名称:{}#--#ID:{}#", map.get("templateType"), templateName, map.get("id"));
         this.templateLoader.data(map);
-        Template template = template(templateName);
+        Template template = template(FileUtils.path(templatePath, companyCode), templateName);
         template.output(outputPath);
 
         // 判断是否有分页,有则执行。从第二页开始
@@ -43,13 +47,13 @@
         while(Template.HAS_PAGING) {
             map.put("page", i);
             this.templateLoader.data(map);
-            Template pageTemplate = template(templateName);
+            Template pageTemplate = template(FileUtils.path(templatePath, companyCode), templateName);
             pageTemplate.output(outputPath);
             i++;
         }
     }
 
-    public Template template(String templateName) {
+    public Template template(String templatePath, String templateName) {
         return template(new File(path(templatePath) + templateName));
     }
 

--
Gitblit v1.9.1