From ee1595b58a75285cb12b43a8822496d74909376f Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 07 Jul 2022 20:09:13 +0800
Subject: [PATCH] fix
---
src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java | 38 ++++++++++++++++++++++++++++++--------
1 files changed, 30 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 433f90a..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;
@@ -9,6 +10,7 @@
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;
@@ -25,7 +27,6 @@
@Autowired
private TemplateConfiguration cfg;
- private final Executor executor = new ThreadPoolExecutor(5, 10, 600, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
@Override
@@ -34,11 +35,34 @@
data.put("templatePath", templatePath);
data.put("templateName", data.get("id"));
if (StrUtil.isEmpty(templateName)) {
- templateName = "defualt.artile.html";
+ templateName = "defualt.article.html";
}
- String finalTemplateName = templateName;
- executor.execute(() -> cfg.process(data, finalTemplateName));
+ cfg.process(data, templateName);
+ }
+
+ @Override
+ 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 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
@@ -49,8 +73,7 @@
templateName = "defualt.list.html";
}
- String finalTemplateName = templateName;
- executor.execute(() -> cfg.process(data, finalTemplateName));
+ cfg.process(data, templateName);
}
@Override
@@ -59,7 +82,6 @@
templateName = "index.html";
}
- String finalTemplateName = templateName;
- executor.execute(() -> cfg.process(data, finalTemplateName));
+ cfg.process(data, templateName);
}
}
--
Gitblit v1.9.1