From 07326eeadfd578b7f9e19305b6ecdde992efaea7 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 07 Jul 2022 18:07:27 +0800
Subject: [PATCH] fix
---
src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java | 37 +++++++++++++++++++++++++++++--------
1 files changed, 29 insertions(+), 8 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..433f90a 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
@@ -7,8 +7,13 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import javax.validation.constraints.NotNull;
import java.util.HashMap;
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
@@ -20,25 +25,41 @@
@Autowired
private TemplateConfiguration cfg;
+ private final Executor executor = new ThreadPoolExecutor(5, 10, 600, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
+
@Override
- public void articleProcess(Long id, String templateName) {
- Map<String, Object> data = new HashMap<>();
- data.put("id", id);
-
+ 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.artile.html";
}
- cfg.process(data, templateName);
+
+ String finalTemplateName = templateName;
+ executor.execute(() -> cfg.process(data, finalTemplateName));
}
@Override
- public void columnProcess(String code, String templateName, boolean article) {
+ 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";
+ }
+ String finalTemplateName = templateName;
+ executor.execute(() -> cfg.process(data, finalTemplateName));
}
@Override
- public void columnProcess(Long id, String templateName, boolean article) {
+ public void indexProcess(@NotNull Map<String, Object> data, String templateName) {
+ if (StrUtil.isEmpty(templateName)) {
+ templateName = "index.html";
+ }
+ String finalTemplateName = templateName;
+ executor.execute(() -> cfg.process(data, finalTemplateName));
}
}
--
Gitblit v1.9.1