From fe87cd1b8168b9ef6f89e80bc5c1d6a5757af3c8 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 08 Jul 2022 11:46:31 +0800
Subject: [PATCH] 20220606

---
 src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java b/src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java
index 5a2579b..a405ee4 100644
--- a/src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java
+++ b/src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java
@@ -1,5 +1,6 @@
 package com.xcong.farmer.cms.modules.core.service.impl;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import com.xcong.farmer.cms.core.template.TemplateConfiguration;
 import com.xcong.farmer.cms.modules.core.service.ICmsCoreService;
@@ -7,8 +8,14 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.validation.constraints.NotNull;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
+import java.util.concurrent.Executor;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 
 /**
  * @author wzy
@@ -21,24 +28,60 @@
     @Autowired
     private TemplateConfiguration cfg;
 
-    @Override
-    public void articleProcess(Long id, String templateName) {
-        Map<String, Object> data = new HashMap<>();
-        data.put("id", id);
 
+    @Override
+    public void articleProcess(Map<String, Object> data, String templateName, String templatePath) {
+        data.put("templateType", "article");
+        data.put("templatePath", templatePath);
+        data.put("templateName", data.get("id"));
         if (StrUtil.isEmpty(templateName)) {
-            templateName = "artile.defualt.html";
+            templateName = "defualt.article.html";
         }
+
         cfg.process(data, templateName);
     }
 
     @Override
-    public void columnProcess(String code, String templateName, boolean article) {
+    public void articlesProcess(Map<String, Object> data, List<Long> ids, String templateName, String templatePath) {
+        if (CollUtil.isEmpty(ids)) {
+            return;
+        }
 
+        for (Long id : ids) {
+            data.put("id", id);
+            articleProcess(data, templateName, templatePath);
+        }
     }
 
     @Override
-    public void columnProcess(Long id, String templateName, boolean article) {
+    public void columnsProcess(Map<String, Object> data, List<Long> ids, String templateName) {
+        if (CollUtil.isEmpty(ids)) {
+            return;
+        }
 
+        for (Long id : ids) {
+            data.put("id", id);
+            columnProcess(data, templateName);
+        }
+    }
+
+    @Override
+    public void columnProcess(Map<String, Object> data, String templateName) {
+        data.put("templateType", "column");
+        data.put("page", 1);
+        if (StrUtil.isEmpty(templateName)) {
+            templateName = "defualt.list.html";
+        }
+
+        cfg.process(data, templateName);
+    }
+
+    @Override
+    public void indexProcess(@NotNull Map<String, Object> data, String templateName) {
+        if (StrUtil.isEmpty(templateName)) {
+            templateName = "index.html";
+        }
+
+        cfg.process(data, templateName);
     }
 }

--
Gitblit v1.9.1