Commit 0dc93a93 authored by mingsoft's avatar mingsoft
Browse files

5.2.4版本更新

parent f2b0c101
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -26,7 +26,7 @@ import java.util.MissingResourceException; ...@@ -26,7 +26,7 @@ import java.util.MissingResourceException;
* @Author: 铭飞开源团队--huise * @Author: 铭飞开源团队--huise
* @Date: 2019/8/9 20:47 * @Date: 2019/8/9 20:47
*/ */
public class BaseAction extends net.mingsoft.mdiy.action.BaseAction{ public class BaseAction extends net.mingsoft.basic.action.BaseAction{
@Override @Override
protected String getResString(String key) { protected String getResString(String key) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
......
...@@ -290,11 +290,17 @@ public class CategoryAction extends BaseAction { ...@@ -290,11 +290,17 @@ public class CategoryAction extends BaseAction {
CategoryEntity _category = new CategoryEntity(); CategoryEntity _category = new CategoryEntity();
_category.setCategoryParentIds(category.getId()); _category.setCategoryParentIds(category.getId());
List<CategoryEntity> categoryList = categoryBiz.queryChilds(_category); List<CategoryEntity> categoryList = categoryBiz.queryChilds(_category);
for(CategoryEntity item:categoryList){ if(categoryList.size()>0) {
if(item.getId().equals(category.getCategoryId())){ for(CategoryEntity item:categoryList){
return ResultData.build().error(getResString("cannot.select.child")); if(item.getId().equals(category.getCategoryId())){
return ResultData.build().error(getResString("cannot.select.child"));
}
} }
category.setLeaf(true);
} else {
category.setLeaf(false);
} }
// 这里不能使用mybitsplus 存在业务 // 这里不能使用mybitsplus 存在业务
categoryBiz.updateEntity(category); categoryBiz.updateEntity(category);
return ResultData.build().success(category); return ResultData.build().success(category);
......
...@@ -32,8 +32,12 @@ import net.mingsoft.basic.constant.e.BusinessTypeEnum; ...@@ -32,8 +32,12 @@ import net.mingsoft.basic.constant.e.BusinessTypeEnum;
import net.mingsoft.basic.util.BasicUtil; import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.basic.util.StringUtil; import net.mingsoft.basic.util.StringUtil;
import net.mingsoft.cms.bean.ContentBean; import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.biz.IContentBiz; import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.cms.entity.ContentEntity; import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.mdiy.biz.IModelBiz;
import net.mingsoft.mdiy.entity.ModelEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
...@@ -42,10 +46,13 @@ import org.springframework.validation.BindingResult; ...@@ -42,10 +46,13 @@ import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 文章管理控制层 * 文章管理控制层
...@@ -65,6 +72,14 @@ public class ContentAction extends BaseAction { ...@@ -65,6 +72,14 @@ public class ContentAction extends BaseAction {
@Autowired @Autowired
private IContentBiz contentBiz; private IContentBiz contentBiz;
@Autowired
private ICategoryBiz categoryBiz;
@Resource(name="mdiyModelBizImpl")
private IModelBiz modelBiz;
/** /**
* 返回主界面index * 返回主界面index
*/ */
...@@ -227,7 +242,20 @@ public class ContentAction extends BaseAction { ...@@ -227,7 +242,20 @@ public class ContentAction extends BaseAction {
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
for(int i = 0;i<contents.size();i++){ for(int i = 0;i<contents.size();i++){
ids.add(contents.get(i).getId()); ids.add(contents.get(i).getId());
//获取栏目实体
CategoryEntity categoryEntity = categoryBiz.getById(contents.get(i).getCategoryId());
//如果栏目绑定的模型ID为空
if (categoryEntity.getMdiyModelId() == null){
break;
}
//获取到配置模型实体
ModelEntity modelEntity = modelBiz.getById(categoryEntity.getMdiyModelId());
//删除模型表的数据
Map<String, String> map = new HashMap<>();
map.put("link_id", contents.get(i).getId());
modelBiz.deleteBySQL(modelEntity.getModelTableName(), map);
} }
contentBiz.removeByIds(ids); contentBiz.removeByIds(ids);
return ResultData.build().success(); return ResultData.build().success();
} }
......
...@@ -173,7 +173,10 @@ public class GeneraterAction extends BaseAction { ...@@ -173,7 +173,10 @@ public class GeneraterAction extends BaseAction {
// 获取栏目列表模版 // 获取栏目列表模版
for (CategoryEntity column : columns) { for (CategoryEntity column : columns) {
//如果是链接就跳过生成
if(column.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) {
continue;
}
ContentBean contentBean = new ContentBean(); ContentBean contentBean = new ContentBean();
contentBean.setCategoryId(column.getId()); contentBean.setCategoryId(column.getId());
contentBean.setCategoryType(column.getCategoryType()); contentBean.setCategoryType(column.getCategoryType());
...@@ -184,7 +187,7 @@ public class GeneraterAction extends BaseAction { ...@@ -184,7 +187,7 @@ public class GeneraterAction extends BaseAction {
case LIST: // 列表 case LIST: // 列表
// 判断模板文件是否存在 // 判断模板文件是否存在
if (!FileUtil.exist(ParserUtil.buildTemplatePath(column.getCategoryListUrl()))) { if (StringUtils.isEmpty(column.getCategoryListUrl()) || !FileUtil.exist(ParserUtil.buildTemplatePath(column.getCategoryListUrl()))) {
LOG.error("模板不存在:{}", column.getCategoryUrl()); LOG.error("模板不存在:{}", column.getCategoryUrl());
continue; continue;
} }
...@@ -192,6 +195,13 @@ public class GeneraterAction extends BaseAction { ...@@ -192,6 +195,13 @@ public class GeneraterAction extends BaseAction {
CmsParserUtil.generateList(column, articleIdList.size(),htmlDir); CmsParserUtil.generateList(column, articleIdList.size(),htmlDir);
break; break;
case COVER:// 单页 case COVER:// 单页
// 判断模板文件是否存在
if (StringUtils.isEmpty(column.getCategoryUrl()) || !FileUtil.exist(ParserUtil.buildTemplatePath(column.getCategoryUrl()))) {
LOG.error("模板不存在:{}", column.getCategoryUrl());
continue;
}
if (articleIdList.size() == 0) { if (articleIdList.size() == 0) {
CategoryBean columnArticleIdBean = new CategoryBean(); CategoryBean columnArticleIdBean = new CategoryBean();
CopyOptions copyOptions = CopyOptions.create(); CopyOptions copyOptions = CopyOptions.create();
...@@ -226,16 +236,19 @@ public class GeneraterAction extends BaseAction { ...@@ -226,16 +236,19 @@ public class GeneraterAction extends BaseAction {
ContentBean contentBean = new ContentBean(); ContentBean contentBean = new ContentBean();
contentBean.setBeginTime(dateTime); contentBean.setBeginTime(dateTime);
// 生成所有栏目的文章
if ("0".equals(columnId)) { if ("0".equals(columnId)) {
categoryList = categoryBiz.list(Wrappers.<CategoryEntity>lambdaQuery() categoryList = categoryBiz.list();
.isNull(CategoryEntity::getCategoryParentIds)); } else { //选择栏目更新
} else { CategoryEntity categoryEntity = new CategoryEntity();
CategoryEntity category = (CategoryEntity) categoryBiz.getById(columnId); categoryEntity.setId(columnId);
categoryList.add(category); categoryList = categoryBiz.queryChilds(categoryEntity);
} }
for (CategoryEntity category : categoryList) { for (CategoryEntity category : categoryList) {
//如果是链接就跳过生成
if(category.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) {
continue;
}
contentBean.setCategoryId(category.getId()); contentBean.setCategoryId(category.getId());
contentBean.setCategoryType(category.getCategoryType()); contentBean.setCategoryType(category.getCategoryType());
//将文章列表标签中的中的参数 //将文章列表标签中的中的参数
...@@ -248,6 +261,11 @@ public class GeneraterAction extends BaseAction { ...@@ -248,6 +261,11 @@ public class GeneraterAction extends BaseAction {
continue; continue;
} }
} else if (category.getCategoryType().equals(CategoryTypeEnum.COVER.toString())) { } else if (category.getCategoryType().equals(CategoryTypeEnum.COVER.toString())) {
// 判断模板文件是否存在
if (!FileUtil.exist(ParserUtil.buildTemplatePath(category.getCategoryListUrl())) || StringUtils.isEmpty(category.getCategoryListUrl())) {
LOG.error("模板不存在:{}", category.getCategoryUrl());
continue;
}
CategoryBean columnArticleIdBean = new CategoryBean(); CategoryBean columnArticleIdBean = new CategoryBean();
CopyOptions copyOptions = CopyOptions.create(); CopyOptions copyOptions = CopyOptions.create();
copyOptions.setIgnoreError(true); copyOptions.setIgnoreError(true);
...@@ -275,7 +293,7 @@ public class GeneraterAction extends BaseAction { ...@@ -275,7 +293,7 @@ public class GeneraterAction extends BaseAction {
public String viewIndex(HttpServletRequest request, @PathVariable String position, HttpServletResponse response) { public String viewIndex(HttpServletRequest request, @PathVariable String position, HttpServletResponse response) {
AppEntity app = BasicUtil.getApp(); AppEntity app = BasicUtil.getApp();
// 组织主页预览地址 // 组织主页预览地址
String indexPosition = app.getAppHostUrl() + File.separator + htmlDir+ File.separator + app.getAppDir() String indexPosition = app.getAppHostUrl() + htmlDir+ File.separator + app.getAppDir()
+ File.separator + position + ParserUtil.HTML_SUFFIX; + File.separator + position + ParserUtil.HTML_SUFFIX;
return "redirect:" + indexPosition; return "redirect:" + indexPosition;
} }
......
...@@ -74,6 +74,7 @@ import java.util.Map; ...@@ -74,6 +74,7 @@ import java.util.Map;
* *
* @author 铭飞开源团队 * @author 铭飞开源团队
* @date 2018年12月17日 * @date 2018年12月17日
* @date 2021年8月26日取消默认search.htm
*/ */
@Controller("dynamicPageAction") @Controller("dynamicPageAction")
@RequestMapping("/mcms") @RequestMapping("/mcms")
...@@ -98,11 +99,6 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -98,11 +99,6 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
private ICategoryBiz categoryBiz; private ICategoryBiz categoryBiz;
/**
* 搜索标签;
*/
public static final String SEARCH = "search";
/** /**
* 自定义模型 * 自定义模型
*/ */
...@@ -320,9 +316,10 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -320,9 +316,10 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
@RequestMapping(value = "search",method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "search",method = {RequestMethod.GET, RequestMethod.POST})
@ResponseBody @ResponseBody
public String search(HttpServletRequest request, HttpServletResponse response) { public String search(HttpServletRequest request, HttpServletResponse response) {
String search = BasicUtil.getString("tmpl", "search.htm");
//设置分页类 //设置分页类
PageBean page = new PageBean(); PageBean page = new PageBean();
page.setSize(ParserUtil.getPageSize(SEARCH + ParserUtil.HTM_SUFFIX, 20)); page.setSize(ParserUtil.getPageSize(search, 20));
//参数集合,提供给解析使用 //参数集合,提供给解析使用
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
...@@ -461,7 +458,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -461,7 +458,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
//查询数量 //查询数量
int count = contentBiz.getSearchCount(contentModel, fieldValueList, searchMap, BasicUtil.getApp().getAppId(), categoryIds); int count = contentBiz.getSearchCount(contentModel, fieldValueList, searchMap, BasicUtil.getApp().getAppId(), categoryIds);
page.setRcount(count); page.setRcount(count);
params.put(SEARCH, searchMap); params.put("search", searchMap);
//站点编号 //站点编号
if (BasicUtil.getWebsiteApp() != null) { if (BasicUtil.getWebsiteApp() != null) {
...@@ -473,15 +470,8 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -473,15 +470,8 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
params.put(ParserUtil.APP_DIR, BasicUtil.getApp().getAppDir()); params.put(ParserUtil.APP_DIR, BasicUtil.getApp().getAppDir());
} }
params.put(ParserUtil.PAGE, page);
params.put(ParserUtil.HTML, htmlDir);
//动态解析
params.put(ParserUtil.IS_DO, false);
//设置动态请求的模块路径
params.put(ParserUtil.MODEL_NAME, "mcms");
searchMap.put("pageNo", 0); searchMap.put("pageNo", 0);
// ParserUtil.read(SEARCH + ParserUtil.HTM_SUFFIX, map, page); // ParserUtil.read(search, map, page);
int total = PageUtil.totalPage(count, page.getSize()); int total = PageUtil.totalPage(count, page.getSize());
...@@ -512,10 +502,6 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -512,10 +502,6 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
page.setPreUrl(preUrl); page.setPreUrl(preUrl);
page.setLastUrl(lastUrl); page.setLastUrl(lastUrl);
params.put(SEARCH, searchMap);
if (BasicUtil.getWebsiteApp() != null) {
params.put(ParserUtil.APP_DIR, BasicUtil.getWebsiteApp().getAppDir());
}
params.put(ParserUtil.PAGE, page); params.put(ParserUtil.PAGE, page);
params.put(ParserUtil.HTML, htmlDir); params.put(ParserUtil.HTML, htmlDir);
//动态解析 //动态解析
...@@ -527,7 +513,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction { ...@@ -527,7 +513,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
String content = ""; String content = "";
try { try {
//根据模板路径,参数生成 //根据模板路径,参数生成
content = ParserUtil.rendering(SEARCH + ParserUtil.HTM_SUFFIX, params); content = ParserUtil.rendering(search, params);
} catch (TemplateNotFoundException e) { } catch (TemplateNotFoundException e) {
e.printStackTrace(); e.printStackTrace();
} catch (MalformedTemplateNameException e) { } catch (MalformedTemplateNameException e) {
......
...@@ -35,7 +35,7 @@ import java.util.List; ...@@ -35,7 +35,7 @@ import java.util.List;
public interface ICategoryBiz extends IBaseBiz<CategoryEntity> { public interface ICategoryBiz extends IBaseBiz<CategoryEntity> {
/** /**
* 查询当前分类下的所有子分类 * 查询当前分类下的所有子分类,包含自身
* @param category * @param category
* @return * @return
*/ */
......
...@@ -200,7 +200,6 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i ...@@ -200,7 +200,6 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
CategoryEntity category = (CategoryEntity) categoryDao.selectById(categoryId); CategoryEntity category = (CategoryEntity) categoryDao.selectById(categoryId);
//删除父类 //删除父类
if (category != null) { if (category != null) {
category.setCategoryParentIds(null);
List<CategoryEntity> childrenList = categoryDao.queryChildren(category); List<CategoryEntity> childrenList = categoryDao.queryChildren(category);
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
for (int i = 0; i < childrenList.size(); i++) { for (int i = 0; i < childrenList.size(); i++) {
...@@ -217,8 +216,6 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i ...@@ -217,8 +216,6 @@ public class CategoryBizImpl extends BaseBizImpl<ICategoryDao, CategoryEntity> i
List<CategoryEntity> childNode = categoryDao.queryChildren(parentNode); List<CategoryEntity> childNode = categoryDao.queryChildren(parentNode);
//判断删除的是否为主节点 //判断删除的是否为主节点
if (parentNode != null) { if (parentNode != null) {
//清空CategoryParentIds,避免查找不必要的数据,只需要当前的父级栏目
parentNode.setCategoryParentIds(null);
UpdateWrapper<CategoryEntity> updateWrapper = new UpdateWrapper<>(); UpdateWrapper<CategoryEntity> updateWrapper = new UpdateWrapper<>();
//如果没有子节点进行更新代码 //如果没有子节点进行更新代码
if (childNode.size() == 1) { if (childNode.size() == 1) {
......
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
category_parent_ids=#{categoryParentIds}, category_parent_ids=#{categoryParentIds},
<if test="categoryType != null and categoryType != ''">category_type=#{categoryType},</if> <if test="categoryType != null and categoryType != ''">category_type=#{categoryType},</if>
<if test="categorySort != null">category_sort=#{categorySort},</if> <if test="categorySort != null">category_sort=#{categorySort},</if>
<if test="categoryListUrl != null and categoryListUrl != ''">category_list_url=#{categoryListUrl},</if> category_list_url=#{categoryListUrl},
<if test="categoryUrl != null and categoryUrl != ''">category_url=#{categoryUrl},</if> category_url=#{categoryUrl},
<if test="categoryKeyword != null ">category_keyword=#{categoryKeyword},</if> <if test="categoryKeyword != null ">category_keyword=#{categoryKeyword},</if>
<if test="categoryDescrip != null ">category_descrip=#{categoryDescrip},</if> <if test="categoryDescrip != null ">category_descrip=#{categoryDescrip},</if>
<if test="categoryImg != null and categoryImg != ''">category_img=#{categoryImg},</if> <if test="categoryImg != null and categoryImg != ''">category_img=#{categoryImg},</if>
...@@ -109,15 +109,8 @@ ...@@ -109,15 +109,8 @@
</if> </if>
and and
( (
<if test="categoryParentIds != null and categoryParentIds!=''">
find_in_set(#{categoryParentIds},CATEGORY_PARENT_IDS)>0
</if>
<if test="categoryParentIds == null or categoryParentIds ==''">
find_in_set('${id}',CATEGORY_PARENT_IDS)>0 find_in_set('${id}',CATEGORY_PARENT_IDS)>0
</if>
<if test="id != null">
or id=#{id} or id=#{id}
</if>
) )
and del=0 and del=0
</where> </where>
......
...@@ -38,6 +38,8 @@ import net.mingsoft.mdiy.biz.impl.ModelBizImpl; ...@@ -38,6 +38,8 @@ import net.mingsoft.mdiy.biz.impl.ModelBizImpl;
import net.mingsoft.mdiy.entity.ModelEntity; import net.mingsoft.mdiy.entity.ModelEntity;
import net.mingsoft.mdiy.util.ParserUtil; import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.io.File; import java.io.File;
...@@ -46,7 +48,6 @@ import java.util.ArrayList; ...@@ -46,7 +48,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutorService;
/** /**
* 文章解析工具类 * 文章解析工具类
...@@ -55,6 +56,7 @@ public class CmsParserUtil { ...@@ -55,6 +56,7 @@ public class CmsParserUtil {
private final static String FIELD = "field"; private final static String FIELD = "field";
protected final static Logger LOG = LoggerFactory.getLogger(CmsParserUtil.class);
/** /**
* 指定模板,指定路径进行生成静态页面,会自定识别pc与移动端 * 指定模板,指定路径进行生成静态页面,会自定识别pc与移动端
...@@ -226,6 +228,7 @@ public class CmsParserUtil { ...@@ -226,6 +228,7 @@ public class CmsParserUtil {
} }
// 文章的模板路径 // 文章的模板路径
String columnUrl = categoryBean.getCategoryUrl(); String columnUrl = categoryBean.getCategoryUrl();
LOG.debug("columnUrl {}",columnUrl);
// 文章的栏目模型编号 // 文章的栏目模型编号
Integer columnContentModelId = null; Integer columnContentModelId = null;
if (articleIdList.get(artId).getMdiyModelId() != null && categoryBean.getMdiyModelId() > 0) { if (articleIdList.get(artId).getMdiyModelId() != null && categoryBean.getMdiyModelId() > 0) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment