From 77e1b14b622a17b2ad824bae24209dfba9ee9e6e Mon Sep 17 00:00:00 2001
From: wzy <wzy19931122ai@163.com>
Date: Sun, 07 Aug 2022 14:25:40 +0800
Subject: [PATCH] fix:addBelong
---
src/main/java/com/xcong/farmer/cms/modules/core/service/impl/CmsCoreServiceImpl.java | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 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 811b5da..21dd11e 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
@@ -4,6 +4,7 @@
import cn.hutool.core.util.StrUtil;
import com.xcong.farmer.cms.core.template.TemplateConfiguration;
import com.xcong.farmer.cms.modules.core.service.ICmsCoreService;
+import com.xcong.farmer.cms.modules.system.mapper.WebSetMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -28,12 +29,16 @@
@Autowired
private TemplateConfiguration cfg;
+ @Autowired
+ private WebSetMapper webSetMapper;
+
@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"));
+ globalData(data);
if (StrUtil.isEmpty(templateName)) {
templateName = "defualt.article.html";
}
@@ -74,6 +79,7 @@
public void columnProcess(Map<String, Object> data, String templateName) {
data.put("templateType", "column");
data.put("page", 1);
+ globalData(data);
if (StrUtil.isEmpty(templateName)) {
templateName = "defualt.list.html";
}
@@ -89,6 +95,7 @@
@Override
public void indexProcess(@NotNull Map<String, Object> data, String templateName) {
data.put("templateType", "index");
+ globalData(data);
if (StrUtil.isEmpty(templateName)) {
templateName = "index.html";
}
@@ -100,4 +107,32 @@
log.error("发布首页错误", e);
}
}
+
+ @Override
+ public void process(Map<String, Object> data, String templateType, String templateName) {
+ data.put("templateType", templateType);
+ globalData(data);
+
+ if ("search".equals(templateType) && StrUtil.isBlank(templateName)) {
+ templateName = "search.html";
+ }
+
+ if ("message".equals(templateType) && StrUtil.isBlank(templateName)) {
+ templateName = "message.html";
+ }
+
+ try {
+ cfg.process(data, templateName);
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.error("发布错误", e);
+ }
+ }
+
+ private void globalData(Map<String, Object> data) {
+ Long companyId = (Long) data.get("companyId");
+ Map<String, String> globalSetting = webSetMapper.selectSiteGlobalSetting(companyId);
+
+ data.putAll(globalSetting);
+ }
}
--
Gitblit v1.9.1