Commit c1b81d0d authored by wujj's avatar wujj
Browse files

Merge remote-tracking branch 'origin/5.2'

# Conflicts:
#	doc/mcms-5.1.sql
#	pom.xml
parents c791bf40 1a95a697
package net.mingsoft.cms.upgrade;
import cn.hutool.core.util.StrUtil;
import io.swagger.models.auth.In;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.basic.util.SpringUtil;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.basic.util.PinYinUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author by 铭飞开源团队
......@@ -17,30 +20,44 @@ import java.util.List;
public class Upgrade {
/**
* 菜单拼音升级
* 更新栏目分类的顶级节点和叶子节点
*/
public void upgrade(){
ICategoryBiz categoryBiz = SpringUtil.getBean(ICategoryBiz.class);
List<CategoryEntity> list = categoryBiz.queryAll();
//先更新所有栏目的拼音
list.forEach(x->{
String pingYin = PinYinUtil.getPingYin(x.getCategoryTitle());
CategoryEntity category=new CategoryEntity();
category.setCategoryPinyin(pingYin);
category.setAppId(BasicUtil.getAppId());
CategoryEntity categoryBizEntity = (CategoryEntity)categoryBiz.getEntity(category);
x.setCategoryPinyin(pingYin);
//拼音存在则拼接id
if(categoryBizEntity!=null&&!categoryBizEntity.getId().equals(x.getId())){
x.setCategoryPinyin(pingYin+x.getId());
//将parentId第一行设为顶级节点
String topId = "0";
String parentId = x.getParentid();
if (parentId != null) {
topId = parentId.split(",")[0];
}
categoryBiz.update(x);
});
//再更新路径
list.forEach(x->{
if(StrUtil.isBlank(x.getCategoryId())||x.getCategoryId().equals("0")){
categoryBiz.updateEntity(x);
x.setTopId(topId);
String id = x.getId();
boolean leaf = true;
//判断是否叶子,循环查找,如果有节点的父节点中包含该节点的id则判断为否跳出循环
for (int i = 0; i< list.size(); i++) {
String pId = list.get(i).getParentid();
if (pId == null) {
continue;
}
leaf = !pId.contains(id);
//如果不是叶子就跳出循环,不需要再判断了
if (!leaf) {
break;
}
}
x.setLeaf(leaf);
//更新
Map<String, String> fields = new HashMap<>();
fields.put("leaf", x.getLeaf()?"1":"0");
fields.put("top_id", x.getTopId());
Map<String, String> where = new HashMap<>();
where.put("id", x.getId());
categoryBiz.updateBySQL("cms_category", fields, where);
});
}
......
......@@ -160,15 +160,15 @@ public class CmsParserUtil extends ParserUtil {
Map<Object, Object> contentModelMap = new HashMap<Object, Object>();
ModelEntity contentModel = null;
// 记录已经生成了文章编号
List<Integer> generateIds = new ArrayList<>();
ExecutorService pool=SpringUtil.getBean(ExecutorService.class);
List<String> generateIds = new ArrayList<>();
ExecutorService pool= SpringUtil.getBean(ExecutorService.class);
// 生成文章
for (int artId = 0; artId < articleIdList.size();) {
String writePath = null;
//设置分页类
PageBean page = new PageBean();
// 文章编号
int articleId = articleIdList.get(artId).getArticleId();
String articleId = articleIdList.get(artId).getArticleId();
// 文章的栏目路径
String articleColumnPath = articleIdList.get(artId).getCategoryPath();
// 该文章相关分类
......
package net.mingsoft.config;
import java.io.File;
import java.util.List;
import java.util.concurrent.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.springframework.aop.Advisor;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.spring.stat.BeanTypeAutoProxyCreator;
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.mingsoft.basic.filter.XSSEscapeFilter;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.aop.support.JdkRegexpMethodPointcut;
import net.mingsoft.basic.interceptor.ActionInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
......@@ -21,21 +17,16 @@ import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.context.request.RequestContextListener;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import com.alibaba.druid.support.spring.stat.BeanTypeAutoProxyCreator;
import com.alibaba.druid.support.spring.stat.DruidStatInterceptor;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import net.mingsoft.basic.interceptor.ActionInterceptor;
import net.mingsoft.basic.util.BasicUtil;
import java.io.File;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@Configuration
public class WebConfig implements WebMvcConfigurer {
......@@ -45,6 +36,9 @@ public class WebConfig implements WebMvcConfigurer {
*/
@Value("${ms.upload.path}")
private String uploadFloderPath;
@Value("${ms.upload.template}")
private String template;
/**
* 上传路径映射
*/
......@@ -55,7 +49,10 @@ public class WebConfig implements WebMvcConfigurer {
return new ActionInterceptor();
}
@Bean
public ConfigurationCustomizer configurationCustomizer() {
return configuration -> configuration.setUseDeprecatedExecutor(false);
}
/**
* 增加对rest api鉴权的spring mvc拦截器
*/
......@@ -68,12 +65,12 @@ public class WebConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/upload/**").addResourceLocations("/upload/","file:upload/");
registry.addResourceHandler("/templets/**").addResourceLocations("/templets/","file:templets/");
registry.addResourceHandler(uploadMapping).addResourceLocations(File.separator+uploadFloderPath+File.separator,"file:"+uploadFloderPath+File.separator);
registry.addResourceHandler("/templets/**").addResourceLocations(File.separator+template+File.separator,"file:"+template+File.separator);
registry.addResourceHandler("/html/**").addResourceLocations("/html/","file:html/");
//三种映射方式 webapp下、当前目录下、jar内
registry.addResourceHandler("/app/**").addResourceLocations("/app/","file:app/", "classpath:/app/");
registry.addResourceHandler("/static/**","/**").addResourceLocations("/static/","file:static/","classpath:/static/","classpath:/META-INF/resources/");
registry.addResourceHandler("/static/**").addResourceLocations("/static/","file:static/","classpath:/static/","classpath:/META-INF/resources/");
registry.addResourceHandler("/api/**").addResourceLocations("/api/","file:api/", "classpath:/api/");
if(new File(uploadFloderPath).isAbsolute()){
//如果指定了绝对路径,上传的文件都映射到uploadMapping下
......
#spring:
# datasource:
# url: jdbc:mysql://192.168.0.8:3316/mcms-dev-5.2-1?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
# username: admin
# password: 123456789
# filters: wall,mergeStat
# type: com.alibaba.druid.pool.DruidDataSource
spring:
datasource:
url: jdbc:mysql://localhost:3306/db-mcms-open?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: root
password: root
driver-class-name: dm.jdbc.driver.DmDriver
url: jdbc:dm://192.168.0.8:5236
username: SYSDBA
password: SYSDBA
filters: wall,mergeStat
type: com.alibaba.druid.pool.DruidDataSource
type: com.alibaba.druid.pool.DruidDataSource
\ No newline at end of file
spring:
datasource:
url: jdbc:mysql://192.168.0.8:3316/mcms-5.1?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
url: jdbc:mysql://192.168.0.8:3316/mcms-5.2?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: mcms
password: mcms
filters: wall,mergeStat
......
server:
port: 8080
port: 5107
servlet.session.timeout: P0DT60M0S #D天H小时M分钟S秒,字符T是紧跟在时分秒之前的,每个单位都必须由数字开始,且时分秒顺序不能乱
# ssl: #https证书配置 配置了之后只能通过https访问应用
# key-store: ms.pfx 证书文件
......@@ -13,16 +13,20 @@ logging:
path: log #会在项目的根目录下生成log目录,里面会生成对应的日期目录,日期目录下面生成日志压缩包备份文件,默认按每10M分割一个日志文件,例如:log/2020-01/app-2020-01-03-18.1.log.gz(表示2020年1月3号下午六点的第一个备份),也可以根据实际情况写绝对路径,例如:d:/log
ms:
# scheme: https #解决使用代理服务器代理应用时标签解析域名依旧为http的问题
mwebsite:
#站群需要appid过滤的表
tables: cms_category,cms_content,mdiy_dict,mdiy_model,mdiy_page,people,people_address,role
# scheme: https #解决使用代理服务器代理应用时标签解析域名依旧为http的问题
swagger:
enable: true #启用swagger文档,生产的时候务必关掉 访问地址:http://ip|域名/项目发布名/swagger-ui.html
manager:
path: /ms #后台访问的路径,如:http://项目/ms/login.do,生产的时候建议修改
view-path: /WEB-INF/manager #后台视图层路径配置
chcek-code: true #默认开启验证码验证,false验证码不验证
check-code: false #默认开启验证码验证,false验证码不验证
upload:
template: template
enable-web: true #启用web层的上传
template: template #模板文件夹支持重命名,不支持路径
path: upload #文件上传路径,可以根据实际写绝对路径
mapping: /upload/** #修改需要谨慎,系统第一次部署可以随意修改,如果已经有了上传数据,再次修改会导致之前上传的文件404
denied: .exe,.jsp
......@@ -75,7 +79,15 @@ spring:
time_format: HH:mm:ss
datetime_format: yyyy-MM-dd HH:mm:ss
number_format: 0.##
mybatis:
http:
encoding:
force: true
charset: utf-8
enabled: true
mybatis-plus:
global-config:
db-config:
column-format: "\"%s\"" #增加这个需要增加 ms-db
id-type: assign_id
configuration:
database-id: mysql
\ No newline at end of file
......@@ -169,6 +169,24 @@
</el-form-item>
</el-col>
</el-row>
<el-row
:gutter="0"
justify="start" align="top">
<el-col :span="12">
<el-form-item label="栏目拼音" prop="categoryPinyin">
<el-input
v-model="form.categoryPinyin"
:disabled="false"
:readonly="false"
:style="{width: '100%'}"
:clearable="true"
placeholder="默认拼音根据名称生成">
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
</el-col>
</el-row>
<el-form-item label="栏目管理关键字" prop="categoryKeyword" >
<template slot='label'>栏目关键字
<el-popover slot="label" placement="top-start" title="提示" trigger="hover">
......@@ -249,7 +267,7 @@
// 栏目管理名称
categoryTitle: '',
// 所属栏目
categoryId: '',
categoryId: null,
// 栏目管理属性
categoryType: '1',
// 自定义顺序
......@@ -258,6 +276,8 @@
categoryListUrl: '',
// 内容模板
categoryUrl: '',
// 栏目拼音
categoryPinyin: '',
// 栏目管理关键字
categoryKeyword: '',
// 栏目管理描述
......@@ -418,7 +438,9 @@
ms.http.get(ms.manager + "/mdiy/model/list.do", {
modelType: 'zdymx_wz'
}).then(function (data) {
that.mdiyModelIdOptions = data.data.rows;
if(data.result){
that.mdiyModelIdOptions = data.data.rows;
}
}).catch(function (err) {
console.log(err);
});
......@@ -460,10 +482,12 @@
ms.http.post(ms.manager + "/cms/content/list.do", {
contentCategoryId: id
}).then(function (data) {
if (data.data.total > 0) {
that.categoryTypeDisabled = true;
} else {
that.categoryTypeDisabled = false;
if(data.result){
if (data.data.total > 0) {
that.categoryTypeDisabled = true;
} else {
that.categoryTypeDisabled = false;
}
}
}).catch(function (err) {
console.log(err);
......@@ -494,7 +518,10 @@
dictType: '栏目属性',
pageSize: 99999
}).then(function (res) {
that.categoryFlagOptions = res.rows;
if(res.result){
res = res.data;
that.categoryFlagOptions = res.rows;
}
}).catch(function (err) {
console.log(err);
});
......@@ -533,11 +560,18 @@
this.categoryUrlOptionsGet();
this.categoryFlagOptionsGet();
this.form.id = ms.util.getParameter("id");
this.form.childId = ms.util.getParameter("childId");// 判断是否增加子栏目
if (this.form.id) {
// 判断三种状态,默认为新增状态
this.categoryTypeDisabled = false;// 控制栏目分类是否可编辑
if (this.form.id != undefined && (this.form.childId == undefined || this.form.childId == "undefined")) {
// 切换编辑状态,id不为空 childId 为空
this.categoryTypeDisabled = true;
this.get(this.form.id);
} else {
this.categoryTypeDisabled = false;
} else if (this.form.childId) {
// 切换新增子栏目状态,id&childId 不为空
this.form.id = null;
this.form.categoryId = this.form.childId;
}
}
});
......
......@@ -47,7 +47,7 @@
</el-table-column>
<el-table-column label="链接地址" align="left" prop="categoryPath" show-overflow-tooltip>
<template slot-scope="scope">
<span style="cursor: pointer" class="copyBtn" :data-clipboard-text="'${'$'}{global.url}'+scope.row.categoryPath+'/index.html'" @click="copyUrl">{{"{ms:global.url/}"+scope.row.categoryPath+"/index.html"}}</span>
<span style="cursor: pointer" class="copyBtn" :data-clipboard-text="'${'$'}{ms:global.url}'+scope.row.categoryPath+'/index.html'" @click="copyUrl">{{"{ms:global.url/}"+scope.row.categoryPath+"/index.html"}}</span>
</template>
</el-table-column>
<el-table-column label="列表地址" align="left" prop="categoryListUrl" show-overflow-tooltip>
......@@ -62,8 +62,11 @@
{{scope.row.categoryType == '2'?scope.row.categoryUrl:''}}
</template>
</el-table-column>
<el-table-column label="操作" width="120" align="center">
<el-table-column label="操作" width="150" align="center">
<template slot-scope="scope">
<@shiro.hasPermission name="cms:category:save">
<el-link type="primary" :underline="false" @click="save(scope.row.id, scope.row.id)"><i class="el-icon-plus"></i>子栏目</el-link>
</@shiro.hasPermission>
<@shiro.hasPermission name="cms:category:update">
<el-link type="primary" :underline="false" @click="save(scope.row.id)">编辑</el-link>
</@shiro.hasPermission>
......@@ -231,9 +234,9 @@
return value;
},
//新增
save: function (id) {
save: function (id, childId) {
if (id) {
location.href = this.manager + "/cms/category/form.do?id=" + id;
location.href = this.manager + "/cms/category/form.do?id=" + id + "&childId=" + childId;
} else {
location.href = this.manager + "/cms/category/form.do";
}
......
......@@ -543,7 +543,10 @@
dictType: '文章属性',
pageSize: 99999
}).then(function (data) {
that.contentTypeOptions = data.rows;
if(data.result){
data = data.data;
that.contentTypeOptions = data.rows;
}
}).catch(function (err) {
console.log(err);
});
......
......@@ -456,7 +456,10 @@
dictType: '文章属性',
pageSize: 99999
}).then(function (data) {
that.contentTypeOptions = data.rows;
if(data.result){
data = data.data;
that.contentTypeOptions = data.rows;
}
}).catch(function (err) {
console.log(err);
});
......
......@@ -507,7 +507,10 @@
dictList: function () {
var that = this;
ms.http.get(ms.base + '/mdiy/dict/list.do', {dictType: '消息类型', pageSize: 99999}).then(function (res) {
that.messageTypeList = res.rows;
if(res.result){
res = res.data;
that.messageTypeList = res.rows;
}
}).catch(function (err) {
console.log(err);
});
......
......@@ -448,9 +448,9 @@
var that = this;
axios.create({
withCredentials: true
}).get("https://ms.mingsoft.net/cms/content/list.do?contentCategoryId=202").then(function (res) {
}).get("https://mingsoft.net/cms/content/list.do?contentCategoryId=202").then(function (res) {
that.msNewsLast = res.data.data.rows[0].contentTitle.toString();
that.msNewsPath = 'https://ms.mingsoft.net/html/1/203/202/' + res.data.data.rows[0].id + '.html';
that.msNewsPath = 'https://mingsoft.net/html/1/203/202/' + res.data.data.rows[0].id + '.html';
});
this.setCallBackFun();
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
@media (max-width: 768px){
}
\ No newline at end of file
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