Skip to content

Commit

Permalink
5.2.9 预发布版本
Browse files Browse the repository at this point in the history
  • Loading branch information
MKFFT committed Sep 9, 2022
1 parent 38816bf commit eebc378
Show file tree
Hide file tree
Showing 18 changed files with 389 additions and 99 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ git clone https://gitee.com/mingSoft/MCMS.git<br/>

# 文档
* 使用手册 http://doc.mingsoft.net/mcms/
* 插件手册 http://doc.mingsoft.net/plugs-cms/

# 关于版本说明 [更多版本查看](https://www.mingsoft.net/html/default/cms/banben/index.html)
1. 开源版本永久免费发布源代码,开发者、企业可以终身免费使用,每个月团队会收集开源系统的问题并在每月的28号进行更新;
Expand Down
18 changes: 11 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mcms</artifactId>
<version>5.2.8</version>
<version>5.2.9</version>
<name>${project.groupId}:${project.artifactId}</name>
<!-- 打包war包,注意不启用(resources》resource》excludes的配置并注释掉maven-assembly-plugin 插件配置 -->
<!--<packaging>war</packaging>-->
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<log4j.version>2.17.0</log4j.version>
<log4j.version>2.18.0</log4j.version>
</properties>
<repositories>
<repository>
Expand All @@ -44,26 +44,30 @@
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-base</artifactId>
<version>2.1.13</version>
<version>2.1.14</version>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-basic</artifactId>
<version>2.1.13.4</version>
<version>2.1.14</version>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mdiy</artifactId>
<version>2.1.13.1</version>
<version>2.1.14</version>
</dependency>

<!--store入口依赖(源码不开发),如果不需要MStore可以直接去掉依赖-->
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>store-client</artifactId>
<version>2.1.13</version>
<version>2.1.14</version>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>6.2.2</version>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/mingsoft/MSApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

import java.util.Locale;


@SpringBootApplication(scanBasePackages = {"net.mingsoft"})
@MapperScan(basePackages={"**.dao","com.baomidou.**.mapper"})
@ServletComponentScan(basePackages = {"net.mingsoft"})
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/net/mingsoft/cms/action/CategoryAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ public ResultData get(@ModelAttribute @ApiIgnore CategoryEntity category){
@LogAnn(title = "保存分类", businessType = BusinessTypeEnum.INSERT)
@RequiresPermissions("cms:category:save")
public ResultData save(@ModelAttribute @ApiIgnore CategoryEntity category) {
//验证缩略图参数值是否合法
if (!category.getCategoryImg().matches("^\\[.{1,}]$") || category.getCategoryImg()==null){
category.setCategoryImg("");
}
//验证栏目管理名称的值是否合法
if(StringUtil.isBlank(category.getCategoryTitle())){
return ResultData.build().error(getResString("err.empty", this.getResString("category.title")));
Expand Down Expand Up @@ -229,6 +233,10 @@ public ResultData delete(@RequestBody List<CategoryEntity> categorys) {
@LogAnn(title = "更新分类", businessType = BusinessTypeEnum.UPDATE)
@RequiresPermissions("cms:category:update")
public ResultData update(@ModelAttribute @ApiIgnore CategoryEntity category) {
//验证缩略图参数值是否合法
if (!category.getCategoryImg().matches("^\\[.{1,}]$") || category.getCategoryImg()==null){
category.setCategoryImg("");
}
//验证栏目管理名称的值是否合法
if(StringUtil.isBlank(category.getCategoryTitle())){
return ResultData.build().error(getResString("err.empty", this.getResString("category.title")));
Expand Down Expand Up @@ -298,7 +306,7 @@ public ResultData update(@ModelAttribute @ApiIgnore CategoryEntity category) {
@GetMapping("/verifyPingYin")
@ResponseBody
public ResultData verifyPingYin(@ModelAttribute @ApiIgnore CategoryEntity category){
int count = categoryBiz.count(Wrappers.<CategoryEntity>lambdaQuery()
long count = categoryBiz.count(Wrappers.<CategoryEntity>lambdaQuery()
.ne(StrUtil.isNotBlank(category.getId()), CategoryEntity::getId, category.getId())
.eq(CategoryEntity::getCategoryPinyin, category.getCategoryPinyin()));

Expand Down
17 changes: 14 additions & 3 deletions src/main/java/net/mingsoft/cms/action/ContentAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import net.mingsoft.basic.bean.EUListBean;
import net.mingsoft.basic.constant.e.BusinessTypeEnum;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.basic.util.SqlInjectionUtil;
import net.mingsoft.base.util.SqlInjectionUtil;
import net.mingsoft.basic.util.StringUtil;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.biz.ICategoryBiz;
Expand All @@ -40,6 +40,7 @@
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.mdiy.biz.IModelBiz;
import net.mingsoft.mdiy.entity.ModelEntity;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
Expand Down Expand Up @@ -85,6 +86,7 @@ public class ContentAction extends BaseAction {
/**
* 返回主界面index
*/
@ApiIgnore
@GetMapping("/index")
public String index(){
return "/cms/content/index";
Expand All @@ -93,6 +95,7 @@ public String index(){
/**
* 返回主界面main
*/
@ApiIgnore
@GetMapping("/main")
public String main(){
return "/cms/content/main";
Expand All @@ -119,7 +122,7 @@ public ResultData list(@ModelAttribute @ApiIgnore ContentBean content) {
// 检查SQL注入
SqlInjectionUtil.filterContent(content.getCategoryId());
BasicUtil.startPage();
List contentList = contentBiz.query(content);
List contentList = contentBiz.queryContent(content);
return ResultData.build().success(new EUListBean(contentList,(int) BasicUtil.endPage(contentList).getTotal()));
}

Expand Down Expand Up @@ -195,6 +198,10 @@ public ResultData getFromFengMian(@ModelAttribute @ApiIgnore ContentEntity conte
@LogAnn(title = "保存文章", businessType = BusinessTypeEnum.INSERT)
@RequiresPermissions("cms:content:save")
public ResultData save(@ModelAttribute @ApiIgnore ContentEntity content) {
//验证缩略图参数值是否合法
if (content.getContentImg()==null || !content.getContentImg().matches("^\\[.{1,}]$")){
content.setContentImg("");
}
//验证文章标题的值是否合法
if(StringUtil.isBlank(content.getContentTitle())){
return ResultData.build().error(getResString("err.empty", this.getResString("content.title")));
Expand Down Expand Up @@ -238,7 +245,7 @@ public ResultData delete(@RequestBody List<ContentEntity> contents) {
//获取栏目实体
CategoryEntity categoryEntity = categoryBiz.getById(contents.get(i).getCategoryId());
//如果栏目绑定的模型ID为空
if (categoryEntity.getMdiyModelId() == null){
if (StringUtils.isBlank(categoryEntity.getMdiyModelId())){
continue;
}
//获取到配置模型实体
Expand Down Expand Up @@ -279,6 +286,10 @@ public ResultData delete(@RequestBody List<ContentEntity> contents) {
@LogAnn(title = "更新文章", businessType = BusinessTypeEnum.UPDATE)
@RequiresPermissions("cms:content:update")
public ResultData update(@ModelAttribute @ApiIgnore ContentEntity content) {
//验证缩略图参数值是否合法
if (content.getContentImg()==null || !content.getContentImg().matches("^\\[.{1,}]$")){
content.setContentImg("");
}
//验证文章标题的值是否合法
if(StringUtil.isBlank(content.getContentTitle())){
return ResultData.build().error(getResString("err.empty", this.getResString("content.title")));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/mingsoft/cms/action/GeneraterAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public class GeneraterAction extends BaseAction {
@Value("${ms.manager.path}")
private String managerPath;

@Value("${ms.html-dir:html}")
@Value("${ms.diy.html-dir:html}")
private String htmlDir;

/**
Expand Down Expand Up @@ -251,7 +251,7 @@ public ResultData generateArticle(HttpServletRequest request, HttpServletRespons
contentBean.setCategoryId(category.getId());
contentBean.setCategoryType(category.getCategoryType());
//将文章列表标签中的中的参数
articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBean);
articleIdList = contentBiz.queryIdsByCategoryIdForParserAndNotCover(contentBean);
// 分类是列表
if (category.getCategoryType().equals(CategoryTypeEnum.LIST.toString())) {
// 判断模板文件是否存在
Expand Down
25 changes: 4 additions & 21 deletions src/main/java/net/mingsoft/cms/action/web/MCmsAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/




package net.mingsoft.cms.action.web;

import cn.hutool.core.util.ObjectUtil;
Expand All @@ -31,24 +28,19 @@
import freemarker.template.MalformedTemplateNameException;
import freemarker.template.TemplateNotFoundException;
import net.mingsoft.base.constant.Const;
import net.mingsoft.basic.exception.BusinessException;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.bean.CategoryBean;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.mdiy.bean.PageBean;
import net.mingsoft.mdiy.biz.IModelBiz;
import net.mingsoft.mdiy.biz.IPageBiz;
import net.mingsoft.mdiy.entity.ModelEntity;
import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
Expand All @@ -75,12 +67,6 @@
@RequestMapping("/mcms")
public class MCmsAction extends net.mingsoft.cms.action.BaseAction {

/**
* 自定义页面业务层
*/
@Autowired
private IPageBiz pageBiz;

/**
* 文章管理业务处理层
*/
Expand All @@ -101,19 +87,16 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
private IModelBiz modelBiz;


@Value("${ms.html-dir:html}")
@Value("${ms.diy.html-dir:html}")
private String htmlDir;




/**
* 实现前端页面的文章搜索
*
* @param request 搜索id
* @param response
*/
@RequestMapping(value = "search",method = {RequestMethod.GET, RequestMethod.POST})
@RequestMapping(value = "search",method = {RequestMethod.GET, RequestMethod.POST},produces= MediaType.TEXT_HTML_VALUE+";charset=utf-8")
@ResponseBody
public String search(HttpServletRequest request, HttpServletResponse response) {
String search = BasicUtil.getString("tmpl", "search.htm");
Expand Down Expand Up @@ -178,7 +161,7 @@ public String search(HttpServletRequest request, HttpServletResponse response) {
column = (CategoryEntity) categoryBiz.getById(typeId);
// 获取表单类型的id
if (column != null && ObjectUtil.isNotNull(column.getMdiyModelId())) {
contentModel = (ModelEntity) modelBiz.getEntity(column.getMdiyModelId());
contentModel = (ModelEntity) modelBiz.getById(column.getMdiyModelId());
if (contentModel != null) {
// 保存自定义模型的数据
Map<String, String> fieldMap = contentModel.getFieldMap();
Expand Down
77 changes: 73 additions & 4 deletions src/main/java/net/mingsoft/cms/aop/CategoryAop.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@
package net.mingsoft.cms.aop;

import cn.hutool.core.io.FileUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.exception.BusinessException;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.constant.e.CategoryTypeEnum;
import net.mingsoft.cms.dao.ICategoryDao;
import net.mingsoft.cms.dao.IContentDao;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.mdiy.biz.IDictBiz;
import net.mingsoft.mdiy.entity.DictEntity;
import net.mingsoft.cms.entity.ContentEntity;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -23,7 +31,6 @@

import java.io.File;
import java.util.List;
import java.util.stream.Collectors;


/**
Expand All @@ -38,11 +45,73 @@ public class CategoryAop extends net.mingsoft.basic.aop.BaseAop {
@Value("${ms.diy.html-dir:html}")
private String htmlDir;

@Autowired
private ICategoryDao categoryDao;

@Autowired
private IContentDao contentDao;

@Pointcut("execution(* net.mingsoft.cms.action.CategoryAction.delete(..)) ")
public void delete() {
}

/**
* 栏目保存接口切面
*/
@Pointcut("execution(* net.mingsoft.cms.action.CategoryAction.save(..)) ")
public void save() {}

/**
* 栏目更新接口切面
*/
@Pointcut("execution(* net.mingsoft.cms.action.CategoryAction.update(..)) ")
public void update() {}



@Around("save() || update()")
public ResultData move(ProceedingJoinPoint pjp) throws Throwable {
CategoryEntity category = getType(pjp, CategoryEntity.class);
if (category == null) {
throw new BusinessException("栏目不存在!");
}

// 获取返回值
Object obj = pjp.proceed(pjp.getArgs());
ResultData resultData = JSONObject.parseObject(JSONObject.toJSON(obj).toString(), ResultData.class);
CategoryEntity parent = categoryDao.selectById(category.getCategoryId());
if (parent == null) {
return resultData;
}
// 用于判断父级栏目之前是否是子栏目
// 只有父节点之前为子节点 && 父栏目类型为列表 && 子栏目为列表
boolean flag = parent.getLeaf() && StringUtils.equals(parent.getCategoryType(), CategoryTypeEnum.LIST.toString());
if (flag) {
// 将父栏目的内容模板清空
parent.setCategoryUrl("");
categoryDao.updateById(parent);
CategoryEntity returnCategory = JSONObject.parseObject(resultData.get(ResultData.DATA_KEY).toString(), CategoryEntity.class);
// 获取父栏目ID集合
String categoryIds = StringUtils.isEmpty(parent.getCategoryParentIds())
? returnCategory.getId() : parent.getCategoryParentIds() + "," + returnCategory.getId();
if (!StringUtils.equals(returnCategory.getCategoryType(), CategoryTypeEnum.LIST.toString())) {
// 如果子栏目不为列表,将直接删除父栏目下的文章
LambdaUpdateWrapper<ContentEntity> contentDeleteWrapper = new UpdateWrapper<ContentEntity>().lambda();
contentDeleteWrapper.eq(ContentEntity::getCategoryId, parent.getId());
contentDao.delete(contentDeleteWrapper);
}
// 将父栏目下的文章移动到子栏目下
LambdaUpdateWrapper<ContentEntity> contentWrapper = new UpdateWrapper<ContentEntity>().lambda();
contentWrapper.set(ContentEntity::getCategoryId, returnCategory.getId());
contentWrapper.eq(ContentEntity::getCategoryId, parent.getId());
contentDao.update(new ContentEntity(), contentWrapper);

return resultData;
}
return resultData;
}


/**
* 删除栏目后并删除文章对应的静态化文件
*
Expand Down
Loading

0 comments on commit eebc378

Please sign in to comment.