Commit e452f146 authored by msgroup's avatar msgroup Committed by mingsoft
Browse files

up: 5.3.0 待发布

parent 35422a17
Showing with 76 additions and 380 deletions
+76 -380
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.12.RELEASE</version>
<version>2.7.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>net.mingsoft</groupId>
......@@ -44,24 +44,24 @@
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-base</artifactId>
<version>2.1.16</version>
<version>2.1.17</version>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-basic</artifactId>
<version>2.1.16</version>
<version>2.1.17</version>
</dependency>
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>ms-mdiy</artifactId>
<version>2.1.16</version>
<version>2.1.17</version>
</dependency>
<!--store入口依赖(源码不开发),如果不需要MStore可以直接去掉依赖-->
<dependency>
<groupId>net.mingsoft</groupId>
<artifactId>store-client</artifactId>
<version>2.1.16.1</version>
<version>17</version>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>
......
......@@ -152,7 +152,7 @@ public class CategoryAction extends BaseAction {
@RequiresPermissions("cms:category:save")
public ResultData save(@ModelAttribute @ApiIgnore CategoryEntity category) {
//验证缩略图参数值是否合法
if (!category.getCategoryImg().matches("^\\[.{1,}]$") || category.getCategoryImg() == null) {
if (category.getCategoryImg() == null || !category.getCategoryImg().matches("^\\[.{1,}]$")) {
category.setCategoryImg("");
}
//验证栏目管理名称的值是否合法
......@@ -172,7 +172,7 @@ public class CategoryAction extends BaseAction {
//判断拼音是否重复
if (StrUtil.isNotBlank(category.getCategoryPinyin())) {
if (!category.getCategoryPinyin().matches("^[a-zA-Z0-9]*$")){
return ResultData.build().error(this.getResString("err.format"));
return ResultData.build().error(this.getResString("err.error",this.getResString("category.pinyin")));
}
CategoryEntity _category = new CategoryEntity();
_category.setCategoryPinyin(category.getCategoryPinyin());
......@@ -237,7 +237,7 @@ public class CategoryAction extends BaseAction {
@RequiresPermissions("cms:category:update")
public ResultData update(@ModelAttribute @ApiIgnore CategoryEntity category) {
//验证缩略图参数值是否合法
if (!category.getCategoryImg().matches("^\\[.{1,}]$") || category.getCategoryImg() == null) {
if (category.getCategoryImg() == null || !category.getCategoryImg().matches("^\\[.{1,}]$")) {
category.setCategoryImg("");
}
//验证栏目管理名称的值是否合法
......@@ -257,7 +257,7 @@ public class CategoryAction extends BaseAction {
//判断拼音是否重复并且是否和原拼音相同
if (StrUtil.isNotBlank(category.getCategoryPinyin()) && !categoryBiz.getById(category.getId()).getCategoryPinyin().equals(category.getCategoryPinyin())) {
if (!category.getCategoryPinyin().matches("^[a-zA-Z0-9]*$")){
return ResultData.build().error(this.getResString("err.format"));
return ResultData.build().error(this.getResString("err.error",this.getResString("category.pinyin")));
}
CategoryEntity _category = new CategoryEntity();
_category.setCategoryPinyin(category.getCategoryPinyin());
......
......@@ -26,6 +26,8 @@ package net.mingsoft.cms.action;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.date.DateException;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.annotation.LogAnn;
......@@ -58,6 +60,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -131,7 +134,7 @@ public class GeneraterAction extends BaseAction {
// 获取文件所在路径 首先判断用户输入的模版文件是否存在
if (!FileUtil.exist(ParserUtil.buildTemplatePath())) {
return ResultData.build().error(getResString("templet.file"));
return ResultData.build().error(getResString("template.file"));
} else {
CmsParserUtil.generate(tmpFileName, generateFileName, htmlDir);
......@@ -208,7 +211,7 @@ public class GeneraterAction extends BaseAction {
BeanUtil.copyProperties(column, columnArticleIdBean, copyOptions);
articleIdList.add(columnArticleIdBean);
}
CmsParserUtil.generateBasic(articleIdList, htmlDir);
CmsParserUtil.generateBasic(articleIdList, htmlDir,null);
break;
}
}
......@@ -235,6 +238,14 @@ public class GeneraterAction extends BaseAction {
ContentBean contentBean = new ContentBean();
contentBean.setBeginTime(dateTime);
// 时间格式化
Date contentUpdateTime = null;
try {
contentUpdateTime = DateUtil.parse(dateTime);
} catch (DateException e) {
e.printStackTrace();
return ResultData.build().error(getResString("err.error",this.getResString("datetime.format")));
}
if ("0".equals(columnId)) {
categoryList = categoryBiz.list();
} else { //选择栏目更新
......@@ -252,7 +263,7 @@ public class GeneraterAction extends BaseAction {
contentBean.setCategoryType(category.getCategoryType());
contentBean.setOrderBy("date");
//将文章列表标签中的中的参数
articleIdList = contentBiz.queryIdsByCategoryIdForParserAndNotCover(contentBean);
articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBean);
// 分类是列表
if (category.getCategoryType().equals(CategoryTypeEnum.LIST.toString())) {
// 判断模板文件是否存在
......@@ -265,7 +276,7 @@ public class GeneraterAction extends BaseAction {
}
// 有符合条件的就更新
if (articleIdList.size() > 0) {
CmsParserUtil.generateBasic(articleIdList, htmlDir);
CmsParserUtil.generateBasic(articleIdList, htmlDir,contentUpdateTime);
}
}
......
......@@ -23,7 +23,7 @@ package net.mingsoft.cms.action.web;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.PageUtil;
import com.alibaba.fastjson.JSON;
import cn.hutool.json.JSONUtil;
import freemarker.core.ParseException;
import freemarker.template.MalformedTemplateNameException;
import freemarker.template.TemplateNotFoundException;
......@@ -355,7 +355,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
@Override
public String toString() {
return JSON.toJSONString(this);
return JSONUtil.toJsonStr(this);
}
}
......
......@@ -7,7 +7,7 @@
package net.mingsoft.cms.aop;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import net.mingsoft.base.entity.ResultData;
......@@ -78,7 +78,7 @@ public class CategoryAop extends net.mingsoft.basic.aop.BaseAop {
// 获取返回值
Object obj = pjp.proceed(pjp.getArgs());
ResultData resultData = JSONObject.parseObject(JSONObject.toJSON(obj).toString(), ResultData.class);
ResultData resultData = JSONUtil.toBean(JSONUtil.toJsonStr(obj), ResultData.class);
CategoryEntity parent = categoryDao.selectById(category.getCategoryId());
if (parent == null) {
return resultData;
......@@ -90,7 +90,7 @@ public class CategoryAop extends net.mingsoft.basic.aop.BaseAop {
// 将父栏目的内容模板清空
parent.setCategoryUrl("");
categoryDao.updateById(parent);
CategoryEntity returnCategory = JSONObject.parseObject(resultData.get(ResultData.DATA_KEY).toString(), CategoryEntity.class);
CategoryEntity returnCategory = JSONUtil.toBean(resultData.get(ResultData.DATA_KEY).toString(), CategoryEntity.class);
// 获取父栏目ID集合
String categoryIds = StringUtils.isEmpty(parent.getCategoryParentIds())
? returnCategory.getId() : parent.getCategoryParentIds() + "," + returnCategory.getId();
......
......@@ -22,7 +22,11 @@
package net.mingsoft.cms.bean;
import com.fasterxml.jackson.annotation.JsonFormat;
import net.mingsoft.cms.entity.CategoryEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 文章实体
......@@ -37,8 +41,20 @@ public class CategoryBean extends CategoryEntity {
*/
private String articleId;
/**
* 文章更新时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
private Date contentUpdateDate;
public Date getContentUpdateDate() {
return contentUpdateDate;
}
public void setContentUpdateDate(Date contentUpdateDate) {
this.contentUpdateDate = contentUpdateDate;
}
public String getArticleId() {
return articleId;
......
......@@ -101,7 +101,7 @@ public class ContentBizImpl extends BaseBizImpl<IContentDao, ContentEntity> imp
@Override
public List<CategoryBean> queryIdsByCategoryIdForParserAndNotCover(ContentBean contentBean) {
return this.contentDao.queryIdsByCategoryIdForParser(contentBean);
return this.contentDao.queryIdsByCategoryIdForParserAndNotCover(contentBean);
}
@Override
......
......@@ -52,6 +52,7 @@
<resultMap id="resultBean" type="net.mingsoft.cms.bean.CategoryBean">
<id column="id" property="id" /><!--编号 -->
<id column="article_Id" property="articleId" /><!--编号 -->
<result column="content_update_date" property="contentUpdateDate" /><!--文章更新时间-->
<result column="category_title" property="categoryTitle" /><!--栏目管理名称 -->
<result column="category_id" property="categoryId" /><!--所属栏目 -->
<result column="category_type" property="categoryType" /><!--栏目管理属性 -->
......@@ -287,7 +288,7 @@
<!-- 根据站点编号、开始、结束时间和栏目编号查询文章编号集合 -->
<select id="queryIdsByCategoryIdForParser" resultMap="resultBean" >
select
ct.id article_id,ct.content_img litpic,c.*
ct.id article_id,ct.content_img litpic,c.*,ct.update_date as content_update_date
FROM cms_content ct
LEFT JOIN cms_category c ON ct.category_id = c.id
where ct.del=0 and ct.content_display=0
......@@ -300,14 +301,7 @@
<if test="categoryId!=null and categoryId!='' and categoryType==2">
and ct.category_id=#{categoryId}
</if>
<if test="beginTime!=null and beginTime!=''">
<if test="_databaseId == 'mysql'">
AND ct.UPDATE_DATE &gt;= #{beginTime}
</if>
<if test="_databaseId == 'oracle'">
and ct.UPDATE_DATE &gt;= to_date(#{beginTime}, 'yyyy-mm-dd hh24:mi:ss')
</if>
</if>
<if test="endTime!=null and endTime!=''">
<if test="_databaseId == 'mysql'">
and ct.UPDATE_DATE &gt;= #{endTime}
......
......@@ -28,8 +28,6 @@ import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.config.MSProperties;
import net.mingsoft.mdiy.util.ConfigUtil;
import java.io.File;
/**
* 分类实体
*
......@@ -42,6 +40,7 @@ public class CategoryEntity extends BaseEntity {
private static final long serialVersionUID = 1574925152750L;
private static Boolean shortLinkSwitch = null;
@TableId(type = IdType.ASSIGN_ID)
private String id;
......@@ -490,11 +489,14 @@ public class CategoryEntity extends BaseEntity {
* @return url路径的字符串
*/
public String getUrl() {
if (shortLinkSwitch == null) {
shortLinkSwitch = ConfigUtil.getBoolean("短链配置", "shortLinkSwitch", false);
}
String appDir = "";
String htmlDir = MSProperties.diy.htmlDir;
String categoryPath = this.getCategoryPath();
String categoryPinyin = this.getCategoryPinyin();
if (!(ConfigUtil.getBoolean("短链配置", "shortLinkSwitch", false))) {
if (!shortLinkSwitch) {
//未开启短链
appDir = "/" + BasicUtil.getApp().getAppDir();
return url = "/" + htmlDir + appDir + categoryPath + "/index.html";
......
......@@ -22,7 +22,6 @@
package net.mingsoft.cms.entity;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
......@@ -82,7 +81,6 @@ private static final long serialVersionUID = 1574925152617L;
/**
* 发布时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
private Date contentDatetime;
......
......@@ -33,6 +33,6 @@ category.id=belonging to the column
content.sort=custom order
category.diy.url=custom link
content.keyword=keyword
templet.file=template file not found
template.file=template file not found
category.pinyin=pinyin
err.format=category pinyin format error
\ No newline at end of file
datetime.format=datatime format
......@@ -33,6 +33,7 @@ category.id=\u6240\u5C5E\u680F\u76EE
content.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F
category.diy.url=\u81EA\u5B9A\u4E49\u94FE\u63A5
content.keyword=\u5173\u952E\u5B57
templet.file=\u672A\u627E\u5230\u6A21\u677F\u6587\u4EF6
template.file=\u672A\u627E\u5230\u6A21\u677F\u6587\u4EF6
category.pinyin=\u62FC\u97F3
err.format=\u680f\u76ee\u62fc\u97f3\u683c\u5f0f\u9519\u8bef
datetime.format=\u65f6\u95f4\u683c\u5f0f
......@@ -46,10 +46,7 @@ import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* 文章解析工具类
......@@ -191,7 +188,8 @@ public class CmsParserUtil {
* @throws MalformedTemplateNameException
* @throws TemplateNotFoundException
*/
public static void generateBasic(List<CategoryBean> articleIdList, String htmlDir) {
public static void generateBasic(List<CategoryBean> articleIdList, String htmlDir,Date datetime) {
Map<String, Object> parserParams = new HashMap<String, Object>();
parserParams.put(ParserUtil.IS_DO, false);
......@@ -280,6 +278,7 @@ public class CmsParserUtil {
}
parserParams.put(ParserUtil.ID, articleId);
// 第一篇文章没有上一篇
if (artId > 0) {
CategoryBean preCaBean = articleIdList.get(artId - 1);
......@@ -288,6 +287,7 @@ public class CmsParserUtil {
page.setPreId(preCaBean.getArticleId());
// }
}
// 最后一篇文章没有下一篇
if (artId + 1 < articleIdList.size()) {
CategoryBean nextCaBean = articleIdList.get(artId + 1);
......@@ -297,6 +297,14 @@ public class CmsParserUtil {
// }
}
// 文章更新时间在指定时间之前 跳过
if (datetime != null && categoryBean.getContentUpdateDate().before(datetime)){
artId++;
continue;
}
parserParams.put(ParserUtil.PAGE, page);
String finalWritePath = writePath;
......
......@@ -22,9 +22,9 @@
package net.mingsoft.config;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.spring.stat.BeanTypeAutoProxyCreator;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import net.mingsoft.basic.filter.XSSEscapeFilter;
import net.mingsoft.basic.interceptor.ActionInterceptor;
......@@ -206,7 +206,7 @@ public class WebConfig implements WebMvcConfigurer {
ConfigEntity configEntity = new ConfigEntity();
configEntity.setConfigName(configName);
configEntity = (ConfigEntity)this.configBiz.getOne(new QueryWrapper(configEntity));
return configEntity != null && !StringUtils.isEmpty(configEntity.getConfigData()) ? (Map) JSON.parseObject(configEntity.getConfigData(), HashMap.class) : null;
return configEntity != null && !StringUtils.isEmpty(configEntity.getConfigData()) ? (Map) JSONUtil.toBean(configEntity.getConfigData(), HashMap.class) : null;
} else {
return null;
}
......
......@@ -75,6 +75,7 @@ html *, body * {
}
.ms-alert-tip{
margin-bottom: 10px;
flex-shrink: 0;
}
.ms-select{
......
This diff is collapsed.
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