From cdfb23e312706438a4673acf19f19c37402ae98a Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Wed, 31 Aug 2022 22:23:23 +0800
Subject: [PATCH] fix

---
 src/main/java/com/xcong/farmer/cms/core/node/Template.java |   35 ++++++++++++++++-------------------
 1 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/main/java/com/xcong/farmer/cms/core/node/Template.java b/src/main/java/com/xcong/farmer/cms/core/node/Template.java
index 51d5c27..50a66cc 100644
--- a/src/main/java/com/xcong/farmer/cms/core/node/Template.java
+++ b/src/main/java/com/xcong/farmer/cms/core/node/Template.java
@@ -24,22 +24,15 @@
     private String path = "";
 
     private Document document;
-    private Map<String, Map<String, Object>> params = new HashMap<>();
     private Map<String, Object> system;
     private List<PartNode> partNodes = new ArrayList<>();
 
-
-    // 页面中包含的标签
-    public static Set<String> TAGS;
     public volatile static boolean HAS_PAGING = false;
 
     public Template() {
-        TAGS = new HashSet<>();
     }
 
     public Template(File file, Map<String, Object> system) {
-        TAGS = new HashSet<>();
-
         Document document = null;
         try {
             document = Jsoup.parse(file, "utf-8");
@@ -70,8 +63,20 @@
             if (!new Integer(1).equals(page)) {
                 this.name = name + "_" + page;
             }
-        } else {
-
+        } else if ("search".equals(templateType)){
+            Object templateName = system.get("templateName");
+            if (templateName != null) {
+                this.name = String.valueOf(templateName);
+            } else {
+                this.name = "search";
+            }
+        } else if ("message".equals(templateType)) {
+            Object templateName = system.get("templateName");
+            if (templateName != null) {
+                this.name = String.valueOf(templateName);
+            } else {
+                this.name = "message";
+            }
         }
 
     }
@@ -97,7 +102,7 @@
             sb.append(partNode.getHtml());
         }
         document = Jsoup.parse(sb.toString());
-        String outPath = path(outputPath);
+        String outPath = path(outputPath) + system.get("companyCode");
 
         String html = document.html();
         try {
@@ -107,7 +112,7 @@
                 file.mkdirs();
             }
 
-            FileOutputStream outputStream = new FileOutputStream(path +this.name + suffix);
+            FileOutputStream outputStream = new FileOutputStream(path + this.name + suffix);
             outputStream.write(html.getBytes());
             outputStream.close();
         } catch (IOException e) {
@@ -144,14 +149,6 @@
 
     public List<PartNode> getPartNodes() {
         return partNodes;
-    }
-
-    public Map<String, Map<String, Object>> getParams() {
-        return params;
-    }
-
-    public void putParams(String key, Map<String, Object> value) {
-        this.params.put(key, value);
     }
 
     public void systemData(Map<String, Object> data) {

--
Gitblit v1.9.1