package com.xnx3.wangmarket.admin.service.impl;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Service;
import com.xnx3.DateUtil;
import com.xnx3.StringUtil;
import com.xnx3.j2ee.dao.SqlDAO;
import com.xnx3.j2ee.util.AttachmentUtil;
import com.xnx3.j2ee.util.ConsoleUtil;
import com.xnx3.j2ee.util.SafetyUtil;
import com.xnx3.j2ee.util.Sql;
import com.xnx3.j2ee.vo.BaseVO;
import com.xnx3.wangmarket.admin.Func;
import com.xnx3.wangmarket.admin.G;
import com.xnx3.wangmarket.admin.bean.NewsDataBean;
import com.xnx3.wangmarket.admin.cache.Template;
import com.xnx3.wangmarket.admin.cache.TemplateCMS;
import com.xnx3.wangmarket.admin.cache.generateSite.DefaultGenerateHtmlInterfaceImpl;
import com.xnx3.wangmarket.admin.cache.generateSite.GenerateHtmlInterface;
import com.xnx3.wangmarket.admin.entity.InputModel;
import com.xnx3.wangmarket.admin.entity.News;
import com.xnx3.wangmarket.admin.entity.NewsData;
import com.xnx3.wangmarket.admin.entity.Site;
import com.xnx3.wangmarket.admin.entity.SiteColumn;
import com.xnx3.wangmarket.admin.entity.SiteVar;
import com.xnx3.wangmarket.admin.entity.TemplatePage;
import com.xnx3.wangmarket.admin.entity.TemplatePageData;
import com.xnx3.wangmarket.admin.entity.TemplateVarData;
import com.xnx3.wangmarket.admin.pluginManage.bean.GenerateSiteColumnNewsDatasourceBean;
import com.xnx3.wangmarket.admin.pluginManage.interfaces.manage.GenerateHtmlStorateInterfaceManage;
import com.xnx3.wangmarket.admin.pluginManage.interfaces.manage.GenerateSiteColumnNewsDatasourceInterfaceManage;
import com.xnx3.wangmarket.admin.pluginManage.interfaces.manage.NewsPluginManage;
import com.xnx3.wangmarket.admin.service.InputModelService;
import com.xnx3.wangmarket.admin.service.SiteColumnService;
import com.xnx3.wangmarket.admin.service.SiteVarService;
import com.xnx3.wangmarket.admin.service.TemplateService;
import com.xnx3.wangmarket.admin.util.SessionUtil;
import com.xnx3.wangmarket.admin.util.SiteUtil;
import com.xnx3.wangmarket.admin.util.TemplateUtil;
import com.xnx3.wangmarket.admin.vo.GenerateSiteVO;
import com.xnx3.wangmarket.admin.vo.SiteColumnTreeVO;
import com.xnx3.wangmarket.admin.vo.TemplatePageListVO;
import com.xnx3.wangmarket.admin.vo.TemplatePageVO;
import com.xnx3.wangmarket.admin.vo.TemplateVO;
import com.xnx3.wangmarket.admin.vo.TemplateVarAndDataMapVO;
import com.xnx3.wangmarket.admin.vo.TemplateVarListVO;
import com.xnx3.wangmarket.admin.vo.TemplateVarVO;
import net.sf.json.JSONObject;
@Service("TemplateService")
public class TemplateServiceImpl implements TemplateService {
public static String sessionTemplatePageListVO = "templatePageListVO"; //Session中存储模版页面列表,session的名字
//新建模版页面的默认内容
public static String html = "<!DOCTYPE html>\n"
+ "<html>\n"
+ "<head>\n"
+ "<meta charset=\"utf-8\">\n"
+ "<title>模版页面</title>\n"
+ "<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n"
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\">\n"
+ "<!--XNX3HTMLEDIT--></head>\n"
+ "<body>\n\n\n"
+ "模版的内容\n\n\n</body>\n"
+ "</html>";
@Resource
private SqlDAO sqlDAO;
@Resource
private InputModelService inputModelService;
@Resource
private SiteColumnService siteColumnService;
@Resource
private SiteVarService siteVarService;
public TemplatePageListVO getTemplatePageListByCache(HttpServletRequest request, Site site) {
TemplatePageListVO vo = null;
if(request != null) {
vo = (TemplatePageListVO) request.getSession().getAttribute(sessionTemplatePageListVO);
}
if(vo == null){
//登陆后第一次取,缓存中还尚未存储,那么读数据表,取出后存入缓存
//根据登录网站当前所使用的模板名字,来进行筛选要取出的模板页面
String templateNameWhere = "";
if(site.getTemplateName() != null && site.getTemplateName().length() > 0){
templateNameWhere = " AND template_page.template_name = '"+ site.getTemplateName() +"'";
}
//从数据库中取
List<TemplatePage> templateList = sqlDAO.findBySqlQuery("SELECT * FROM template_page WHERE siteid = "+site.getId() + templateNameWhere, TemplatePage.class);
List<TemplatePageVO> templatePageVOList = new ArrayList<TemplatePageVO>();
for (int i = 0; i < templateList.size(); i++) {
TemplatePageVO templatePageVO = new TemplatePageVO();
templatePageVO.setTemplatePage(templateList.get(i));
templatePageVOList.add(templatePageVO);
}
//加入缓存中存储。只加入了templatePage,data未加入,使用时用哪个再加入哪个
vo = new TemplatePageListVO();
vo.setList(templatePageVOList);
if(request != null) {
request.getSession().setAttribute(sessionTemplatePageListVO, vo);
}
}
return vo;
}
public TemplatePageListVO getTemplatePageListByCache(HttpServletRequest request) {
Site site = SessionUtil.getSite();
return getTemplatePageListByCache(request, site);
}
public TemplatePageListVO getTemplatePageListByDatabase(Site site) {
TemplatePageListVO vo = new TemplatePageListVO();
//根据登录网站当前所使用的模板名字,来进行筛选要取出的模板页面
String templateNameWhere = "";
if(site.getTemplateName() != null && site.getTemplateName().length() > 0){
templateNameWhere = " AND template_page.template_name = '"+ site.getTemplateName() +"'";
}
//从数据库中取
List<TemplatePage> templateList = sqlDAO.findBySqlQuery("SELECT * FROM template_page WHERE siteid = "+site.getId() + templateNameWhere, TemplatePage.class);
List<TemplatePageVO> templatePageVOList = new ArrayList<TemplatePageVO>();
for (int i = 0; i < templateList.size(); i++) {
TemplatePageVO templatePageVO = new TemplatePageVO();
templatePageVO.setTemplatePage(templateList.get(i));
templatePageVOList.add(templatePageVO);
}
vo.setList(templatePageVOList);
return vo;
}
public BaseVO updateTemplatePageForCache(TemplatePage templatePage,
TemplatePageData templatePageData, HttpServletRequest request) {
TemplatePageListVO vo = (TemplatePageListVO) request.getSession().getAttribute(sessionTemplatePageListVO);
//判断一下,当然,这个应该不会为空,避免空指针
if(vo == null){
vo = getTemplatePageListByCache(request);
}
List<TemplatePageVO> templatePageVOList = vo.getList();
boolean find = false;
for (int i = 0; i < templatePageVOList.size(); i++) {
TemplatePageVO templatePageVO = templatePageVOList.get(i);
if(templatePageVO.getTemplatePage().getId() - templatePage.getId() == 0){
templatePageVO.setTemplatePage(templatePage);
//如果用户单纯只是更改templatePage的属性,是不会修改data的内容的。若不修改data内容,是不传递data的。这里判断一下,免得吧之前的覆盖为null
if(templatePageData != null){
templatePageVO.setTemplatePageData(templatePageData);
}
find = true;
break;
}
}
//如果再session缓存中没有找到此项要更新的模版页,那么可能这个模版页是新增的
if(find == false){
TemplatePageVO tpv = new TemplatePageVO();
tpv.setTemplatePage(templatePage);
tpv.setTemplatePageData(templatePageData);
templatePageVOList.add(tpv);
}
request.getSession().setAttribute(sessionTemplatePageListVO, vo);
return new BaseVO();
}
public String getTemplatePageTextByCache(int templatePageId, HttpServletRequest request) {
TemplatePageListVO vo = (TemplatePageListVO) request.getSession().getAttribute(sessionTemplatePageListVO);
//判断一下,当然,这个
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
私有化部署自己的 SAAS 云建站系统,跟可通过后台任意开通多个网站,每个网站使用自己的账号进行独立管理。延续了织梦、帝国 CMS 的模版方式,性能高度优化,一台 1 核 1G 服务器可建立上万个独立网站。 网站使用方面,有模版页面、模版变量、栏目绑定模版、内容管理等
资源推荐
资源详情
资源评论
收起资源包目录
私有化部署自己的 SAAS 云建站系统 (555个子文件)
jquery-weui.css 67KB
weui.min.css 35KB
style.css 26KB
styleedit.css 22KB
styleedit.css 22KB
styleedit.css 22KB
styleedit.css 22KB
styleedit.css 21KB
styleedit.css 21KB
styleedit.css 21KB
layerGlobal.css 16KB
style.css 15KB
style.css 10KB
style.css 7KB
style.css 6KB
style.css 5KB
style.css 5KB
site_two_subMenu.css 1KB
style.css 1KB
wangmarket.db 100KB
.gitattributes 87B
.gitignore 3KB
default.html 8KB
index.html 7KB
index.html 6KB
index.html 5KB
index.html 5KB
index.html 2KB
index.html 2KB
head.html 2KB
head.html 2KB
head.html 2KB
index.html 2KB
useExplain.html 2KB
head.html 2KB
head.html 2KB
head.html 2KB
head.html 2KB
index.html 2KB
foot.html 1KB
foot.html 1KB
foot.html 1KB
foot.html 1KB
useExplain.html 1KB
useExplain.html 1KB
useExplain.html 1KB
top.html 1KB
top.html 1KB
top.html 1KB
useExplain.html 1KB
top.html 1KB
useExplain.html 1KB
useExplain.html 1KB
useExplain.html 1KB
page.html 992B
page.html 992B
page.html 992B
page.html 992B
page.html 870B
page.html 870B
page.html 870B
news_list.html 767B
news_list.html 765B
newsimage_list.html 757B
newsimage_list.html 757B
newsimage_list.html 757B
news_list.html 747B
newsimage_list.html 554B
newsimage_list.html 554B
newsimage_list.html 554B
newsimage_list.html 554B
news_list.html 543B
news_list.html 543B
news_list.html 543B
news_list.html 543B
top.html 535B
useExplain.html 508B
newsimage_list_item.html 453B
newsimage_list_item.html 453B
newsimage_list_item.html 453B
newsimage_list_item.html 453B
page.html 409B
newsimage_list_item.html 390B
newsimage_list_item.html 388B
newsimage_list_item.html 388B
top.html 376B
top.html 374B
page.html 369B
page.html 369B
page.html 369B
foot.html 310B
foot.html 310B
foot.html 310B
news_list_item.html 309B
news_list_item.html 309B
news_list_item.html 309B
news_list_item.html 309B
news_list_item.html 220B
news_list_item.html 220B
news_list_item.html 220B
共 555 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6656
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Screenshot_20240430_144340_com.ss.android.ugc.live.jpg
- 回到山沟沟.mp3
- 基于matlab实现自适应波束形成RLS及LMS算法仿真源程序1.rar
- 基于matlab实现自己编写的基于卡尔曼滤波的利用加速度传感器的计步器,测试数据是传感器放在腰部和手臂 .rar
- 基于matlab实现阵列信号处理,波束形成.rar
- 111111111111111111
- 基于matlab实现计步器编程;对当前的计步器装置的数值算法模拟 .rar
- Mdb学习查看PW;access;mdb;pw;password;patch
- 基于matlab实现关于语音信号声源定位DOA估计所用的一些传统算法.rar
- 基于ultralytics-yolov8, 将其检测/分类/分割/姿态等任务移植到rk3588上
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功