Commit 049098d8 authored by mingsoft's avatar mingsoft
Browse files

5.2.5版本更新

parent 6135f0ec
......@@ -26,7 +26,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.mingsoft.base.entity.BaseEntity;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.annotation.LogAnn;
import net.mingsoft.basic.bean.EUListBean;
......
......@@ -34,10 +34,12 @@ import net.mingsoft.basic.util.StringUtil;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.constant.e.CategoryTypeEnum;
import net.mingsoft.cms.entity.CategoryEntity;
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;
......@@ -316,7 +318,4 @@ public class ContentAction extends BaseAction {
contentBiz.saveOrUpdate(content);
return ResultData.build().success(content);
}
}
......@@ -25,8 +25,6 @@ package net.mingsoft.cms.action;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.annotation.LogAnn;
import net.mingsoft.basic.biz.IModelBiz;
......@@ -40,7 +38,6 @@ import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.constant.e.CategoryTypeEnum;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.cms.util.CmsParserUtil;
import net.mingsoft.mdiy.bean.PageBean;
import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
......@@ -58,9 +55,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName: GeneraterAction
......@@ -188,7 +183,7 @@ public class GeneraterAction extends BaseAction {
// 判断模板文件是否存在
if (StringUtils.isEmpty(column.getCategoryListUrl()) || !FileUtil.exist(ParserUtil.buildTemplatePath(column.getCategoryListUrl()))) {
LOG.error("模板不存在:{}", column.getCategoryUrl());
LOG.error("{} 模板不存在:{}", column.getCategoryTitle(),column.getCategoryUrl());
continue;
}
......@@ -198,7 +193,7 @@ public class GeneraterAction extends BaseAction {
// 判断模板文件是否存在
if (StringUtils.isEmpty(column.getCategoryUrl()) || !FileUtil.exist(ParserUtil.buildTemplatePath(column.getCategoryUrl()))) {
LOG.error("模板不存在:{}", column.getCategoryUrl());
LOG.error("{} 模板不存在:{}", column.getCategoryTitle(),column.getCategoryUrl());
continue;
}
......@@ -257,13 +252,13 @@ public class GeneraterAction extends BaseAction {
if (category.getCategoryType().equals(CategoryTypeEnum.LIST.toString())) {
// 判断模板文件是否存在
if (!FileUtil.exist(ParserUtil.buildTemplatePath(category.getCategoryListUrl())) || StringUtils.isEmpty(category.getCategoryListUrl())) {
LOG.error("模板不存在:{}", category.getCategoryUrl());
LOG.error("{} 模板不存在:{}", category.getCategoryTitle(),category.getCategoryListUrl());
continue;
}
} else if (category.getCategoryType().equals(CategoryTypeEnum.COVER.toString())) {
// 判断模板文件是否存在
if (!FileUtil.exist(ParserUtil.buildTemplatePath(category.getCategoryListUrl())) || StringUtils.isEmpty(category.getCategoryListUrl())) {
LOG.error("模板不存在:{}", category.getCategoryUrl());
LOG.error("{} 模板不存在:{}", category.getCategoryTitle(),category.getCategoryListUrl());
continue;
}
CategoryBean columnArticleIdBean = new CategoryBean();
......
......@@ -22,7 +22,6 @@
package net.mingsoft.cms.biz.impl;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
......
......@@ -109,10 +109,6 @@ private static final long serialVersionUID = 1574925152617L;
* 文章跳转链接地址
*/
private String contentUrl;
/**
* 文章管理的应用id
*/
/**
* 点击次数
*/
......@@ -291,5 +287,4 @@ private static final long serialVersionUID = 1574925152617L;
public String getContentUrl() {
return this.contentUrl;
}
}
package net.mingsoft.cms.upgrade;
import net.mingsoft.basic.util.SpringUtil;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.entity.CategoryEntity;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author by 铭飞开源团队
* @Description
* @date 2020/6/19 15:58
*/
public class Upgrade {
/**
* 更新栏目分类的顶级节点和叶子节点
*/
public void upgrade(){
ICategoryBiz categoryBiz = SpringUtil.getBean(ICategoryBiz.class);
List<CategoryEntity> list = categoryBiz.queryAll();
list.forEach(x->{
//将parentId第一行设为顶级节点
String topId = "0";
String parentId = x.getParentids();
if (parentId != null) {
topId = parentId.split(",")[0];
}
x.setTopId(topId);
String id = x.getId();
boolean leaf = true;
//判断是否叶子,循环查找,如果有节点的父节点中包含该节点的id则判断为否跳出循环
for (int i = 0; i< list.size(); i++) {
String pId = list.get(i).getParentids();
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);
});
}
}
/**
* The MIT License (MIT)
* Copyright (c) 2020 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.config;
import com.alibaba.druid.support.http.WebStatFilter;
import com.alibaba.druid.support.spring.stat.DruidStatInterceptor;
import org.springframework.aop.Advisor;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.aop.support.JdkRegexpMethodPointcut;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author by 铭飞开源团队
* @Description TODO
* @date 2020/1/10 11:21
*/
@Configuration
@ConditionalOnProperty(prefix="spring",name = "datasource.druid.stat-view-servlet.enabled", havingValue = "true")
public class DruidConfig {
/**
* druid监控 配置URI拦截策略
*/
@Bean
public FilterRegistrationBean druidStatFilter() {
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new WebStatFilter());
// 添加过滤规则.
filterRegistrationBean.addUrlPatterns("/*");
// 添加不需要忽略的格式信息.
filterRegistrationBean.addInitParameter("exclusions",
"/static/*,*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid,/druid/*");
// 用于session监控页面的用户名显示 需要登录后主动将username注入到session里
filterRegistrationBean.addInitParameter("principalSessionName", "username");
return filterRegistrationBean;
}
/**
* druid数据库连接池监控
*/
@Bean
public DruidStatInterceptor druidStatInterceptor() {
return new DruidStatInterceptor();
}
@Bean
public JdkRegexpMethodPointcut druidStatPointcut() {
JdkRegexpMethodPointcut druidStatPointcut = new JdkRegexpMethodPointcut();
String patterns = "net.mingsoft.*.biz.*";
// 可以set多个
druidStatPointcut.setPatterns(patterns);
return druidStatPointcut;
}
/**
* druid 为druidStatPointcut添加拦截
*
* @return
*/
@Bean
public Advisor druidStatAdvisor() {
return new DefaultPointcutAdvisor(druidStatPointcut(), druidStatInterceptor());
}
}
/**
* The MIT License (MIT)
* Copyright (c) 2020 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.config;
import java.io.IOException;
import java.util.Properties;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
import com.jagregory.shiro.freemarker.ShiroTags;
import freemarker.template.TemplateException;
@Configuration
public class FreemarkerConfig {
@Autowired
protected freemarker.template.Configuration configuration;
@Autowired
protected org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer configurer;
@Autowired
protected org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver resolver;
@Autowired
protected org.springframework.web.servlet.view.InternalResourceViewResolver springResolver;
@PostConstruct
public void init() throws IOException, TemplateException {
configuration.setSharedVariable("shiro", new ShiroTags());
}
}
/**
* The MIT License (MIT)
* Copyright (c) 2020 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.config;
import cn.hutool.core.codec.Base64;
import net.mingsoft.basic.realm.ManagerAuthRealm;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.CookieRememberMeManager;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.servlet.SimpleCookie;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.LinkedHashMap;
import java.util.Map;
@Configuration
public class ShiroConfig {
@Value("${ms.manager.path}")
private String managerPath;
/**
* 开启Shiro的注解(如@RequiresRoles , @RequiresPermissions),需借助SspringAOP扫描使用Sshiro注解的类,并在必要时进行安全逻辑验证
* 配置以下两个bean(Defaul tAdvisorAutoProxyCreator和uthorizat ionAttributeSourceAdvisor)即可实现此功能
*/
@Bean
public DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator(){
DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator();
advisorAutoProxyCreator.setProxyTargetClass(true);
return advisorAutoProxyCreator;
}
/**
* 开启shiro aop注解支持
* 使用代理方式;所以需要开启代码支持
* @param securityManager
*/
@Bean
public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager){
AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor();
authorizationAttributeSourceAdvisor.setSecurityManager(securityManager);
return authorizationAttributeSourceAdvisor;
}
@Bean
public AuthorizationAttributeSourceAdvisor getAuthorizationAttributeSourceAdvisor(
DefaultWebSecurityManager securityManager) {
AuthorizationAttributeSourceAdvisor advisor = new AuthorizationAttributeSourceAdvisor();
advisor.setSecurityManager(securityManager);
return advisor;
}
@Bean
public DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() {
DefaultAdvisorAutoProxyCreator autoProxyCreator = new DefaultAdvisorAutoProxyCreator();
autoProxyCreator.setProxyTargetClass(true);
return autoProxyCreator;
}
@Bean
public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager) {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
// 必须设置 SecurityManager
shiroFilterFactoryBean.setSecurityManager(securityManager);
// setLoginUrl 如果不设置值,默认会自动寻找Web工程根目录下的"/login.jsp"页面 或 "/login" 映射
shiroFilterFactoryBean.setLoginUrl(managerPath + "/login.do");
// 设置无权限时跳转的 url;
shiroFilterFactoryBean.setUnauthorizedUrl(managerPath + "/404.do");
// 设置拦截器
Map<String, String> filterChainDefinitionMap = new LinkedHashMap<>();
// 游客,开发权限
filterChainDefinitionMap.put("/static/**", "anon");
filterChainDefinitionMap.put("/html/**", "anon");
// 开放登陆接口
filterChainDefinitionMap.put(managerPath + "/login.do", "anon");
filterChainDefinitionMap.put(managerPath + "/checkLogin.do", "anon");
// 其余接口一律拦截
// 主要这行代码必须放在所有权限设置的最后,不然会导致所有 url 都被拦截
filterChainDefinitionMap.put(managerPath + "/**", "user");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
/**
* cookie对象
* @return
*/
public SimpleCookie rememberMeCookie() {
// 设置cookie名称,对应login.html页面的<input type="checkbox" name="rememberMe"/>
SimpleCookie cookie = new SimpleCookie("rememberMe");
// 设置cookie的过期时间,单位为秒,这里为一天
cookie.setMaxAge(86400);
return cookie;
}
/**
* cookie管理对象
* @return
*/
public CookieRememberMeManager rememberMeManager() {
CookieRememberMeManager cookieRememberMeManager = new CookieRememberMeManager();
cookieRememberMeManager.setCookie(rememberMeCookie());
// rememberMe cookie加密的密钥
cookieRememberMeManager.setCipherKey(Base64.decode("4AvVhmFLUs0KTA3Kprsdag=="));
return cookieRememberMeManager;
}
/**
* 注入 securityManager
*/
@Bean
public SecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
// 设置realm.
securityManager.setRealm(customRealm());
//cookie管理配置对象
securityManager.setRememberMeManager(rememberMeManager());
return securityManager;
}
/**
* 自定义身份认证 realm;
* <p>
* 必须写这个类,并加上 @Bean 注解,目的是注入 CustomRealm, 否则会影响 CustomRealm类 中其他类的依赖注入
*/
@Bean
public ManagerAuthRealm customRealm() {
return new ManagerAuthRealm();
}
}
/**
* The MIT License (MIT)
* Copyright (c) 2020 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
@ConditionalOnProperty(prefix="ms",name = "swagger-enable", havingValue = "true")
public class SwaggerConfig {
@Value("${ms.manager.path}")
private String mangerPath ;
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
.apis(RequestHandlerSelectors.basePackage("net.mingsoft")).paths(PathSelectors.regex("^((?!("+mangerPath+"|static)).)+$"))
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder().title("api文档").description("restful 风格接口")
// 服务条款网址
// .termsOfServiceUrl("")
.version("1.0")
// .contact(new Contact("hello", "url", "email"))
.build();
}
}
/**
* The MIT License (MIT)
* Copyright (c) 2020 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.config;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Component;
import io.swagger.models.Path;
import io.swagger.models.Swagger;
@Aspect
@EnableAspectJAutoProxy
@Component
public class SwaggerSuffixAspect {
@AfterReturning(pointcut = "execution(public io.swagger.models.Swagger springfox.documentation.swagger2.mappers.ServiceModelToSwagger2MapperImpl.mapDocumentation(..))", returning = "swagger")
public void doBeforeBussinessCheck(Swagger swagger) {
Map<String, Path> paths = swagger.getPaths();
if (null != paths) {
Map<String, Path> newPaths = new HashMap<String, Path>(paths);
paths.clear();
Iterator<String> it = newPaths.keySet().iterator();
while (it.hasNext()) {
String oldKey = it.next();
String newKey = oldKey + ".do";
paths.put(newKey, newPaths.get(oldKey));
}
newPaths = null;
}
}
}
/**
* The MIT License (MIT)
* Copyright (c) 2020 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package net.mingsoft.config;
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 net.mingsoft.basic.interceptor.ActionInterceptor;
import net.mingsoft.basic.resolver.MSLocaleResolver;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
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.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
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 {
/**
* 上传路径
*/
@Value("${ms.upload.path}")
private String uploadFloderPath;
@Value("${ms.upload.template}")
private String template;
/**
* 上传路径映射
*/
@Value("${ms.upload.mapping}")
private String uploadMapping;
/**
* 上传路径映射
*/
@Value("${ms.html-dir:html}")
private String htmlDir;
@Bean
public ActionInterceptor actionInterceptor() {
return new ActionInterceptor();
}
@Bean
public ConfigurationCustomizer configurationCustomizer() {
return configuration -> configuration.setUseDeprecatedExecutor(false);
}
/**zF
* 增加对rest api鉴权的spring mvc拦截器
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 排除配置
registry.addInterceptor(actionInterceptor()).excludePathPatterns("/static/**", "/app/**", "/webjars/**",
"/*.html", "/*.htm");
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler(uploadMapping).addResourceLocations(File.separator+uploadFloderPath+File.separator,"file:"+uploadFloderPath+File.separator,"classpath:/template/");
registry.addResourceHandler("/template/**").addResourceLocations(File.separator+template+File.separator,"file:"+template+File.separator,"classpath:/html/");
//注意这里的htmlDir资源不能使用File.separator替代"/",会导致Windows一键版访问失效
registry.addResourceHandler("/".concat(htmlDir).concat("/**")).addResourceLocations("/".concat(htmlDir).concat("/"),"file:".concat(htmlDir).concat("/"));
//三种映射方式 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("/api/**").addResourceLocations("/api/","file:api/", "classpath:/api/");
if(new File(uploadFloderPath).isAbsolute()){
//如果指定了绝对路径,上传的文件都映射到uploadMapping下
registry.addResourceHandler(uploadMapping).addResourceLocations("file:"+uploadFloderPath+ File.separator
//映射其他路径文件
//,file:F://images
);
}
}
/**
* druid数据库连接池监控
*/
@Bean
public BeanTypeAutoProxyCreator beanTypeAutoProxyCreator() {
BeanTypeAutoProxyCreator beanTypeAutoProxyCreator = new BeanTypeAutoProxyCreator();
beanTypeAutoProxyCreator.setTargetBeanType(DruidDataSource.class);
beanTypeAutoProxyCreator.setInterceptorNames("druidStatInterceptor");
return beanTypeAutoProxyCreator;
}
//XSS过滤器
@Bean
public FilterRegistrationBean xssFilterRegistration() {
XSSEscapeFilter xssFilter = new XSSEscapeFilter();
FilterRegistrationBean registration = new FilterRegistrationBean(xssFilter);
xssFilter.includes.add(".*/search.do");
registration.setName("XSSFilter");
registration.addUrlPatterns("/*");
registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
return registration;
}
/**
* RequestContextListener注册
*/
@Bean
public ServletListenerRegistrationBean<RequestContextListener> requestContextListenerRegistration() {
return new ServletListenerRegistrationBean<>(new RequestContextListener());
}
/**
* 设置默认首页
*/
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("forward:/index.do");
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
WebMvcConfigurer.super.addViewControllers(registry);
}
/**
* 解决com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException 问题,提交实体不存在的字段异常
*/
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
// TODO Auto-generated method stub
converters.add(mappingJackson2HttpMessageConverter());
WebMvcConfigurer.super.configureMessageConverters(converters);
}
@Bean
public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter(){
MappingJackson2HttpMessageConverter converter = new MappingJackson2HttpMessageConverter();
ObjectMapper objectMapper = new ObjectMapper();
//添加此配置
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
converter.setObjectMapper(objectMapper);
return converter;
}
@Bean
public ExecutorService crawlExecutorPool() {
// 创建线程池
ExecutorService pool =
new ThreadPoolExecutor(20, 20,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
return pool;
}
/**
* 国际化配置拦截
* @return
*/
@Bean
public MSLocaleResolver localeResolver(){
return new MSLocaleResolver();
}
}
......@@ -208,7 +208,7 @@
<el-form-item label="缩略图" prop="categoryImg" >
<el-upload
:file-list="form.categoryImg"
:action="ms.base+'/file/upload.do'"
:action="ms.manager+'/file/upload.do'"
:on-remove="categoryImghandleRemove"
:style="{width:''}"
:limit="1"
......@@ -418,7 +418,11 @@
if (that.form.categoryType == '2') {
that.form.categoryListUrl = '';
}
//栏目属性为链接则不需要列表和详情模板
if(that.form.categoryType == '3'){
that.form.categoryListUrl = '';
that.form.categoryUrl = '';
}
that.saveDisabled = true;
var data = JSON.parse(JSON.stringify(that.form));
......@@ -446,9 +450,12 @@
that.$notify({
title: '成功',
message: '保存成功',
type: 'success'
type: 'success',
duration: 1000,
onClose:function (){
location.href = ms.manager + "/cms/category/index.do";
}
});
location.href = ms.manager + "/cms/category/index.do";
} else {
that.$notify({
title: '失败',
......
......@@ -159,7 +159,7 @@
<el-form-item label="文章缩略图" prop="contentImg">
<el-upload
:file-list="form.contentImg"
:action="ms.base+'/file/upload.do'"
:action="ms.manager+'/file/upload.do'"
:on-remove="contentImghandleRemove"
:style="{width:''}"
:limit="1"
......
......@@ -28,7 +28,7 @@
</el-tree>
</el-scrollbar>
</div>
<iframe :src="action" class="ms-iframe-style">
<iframe :src="action" class="ms-iframe-style" style="background:url('${base}/static/images/loading.gif') no-repeat center;">
</iframe>
</el-container>
</div>
......@@ -56,7 +56,7 @@
this.action = ms.manager + "/cms/content/form.do?categoryId=" + data.id + "&type=2";
//id=0时为最顶级节点全部节点
} else if (data.id == 0){
this.action = ms.manager + "/cms/content/main.do?leaf=true";
this.action = ms.manager + "/cms/content/main.do?leaf=false";
}
},
treeList: function () {
......@@ -135,6 +135,11 @@
height: 40px !important;
line-height: 46px !important;
}
#index .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content {
background-color: rgb(137 140 145);
color: #fff;
border-radius: 2px;
}
body{
overflow: hidden;
}
......
......@@ -154,6 +154,8 @@
el: 'eq',
model: 'contentDisplay',
name: '是否显示',
key:'value',
title: 'label',
type: 'radio',
label: true,
multiple: false
......@@ -173,7 +175,7 @@
type: 'input'
}, {
action: 'and',
field: 'content_datetime',
field: 'ct.content_datetime',
model: 'contentDatetime',
el: 'gt',
name: '发布时间',
......@@ -213,23 +215,16 @@
model: 'contentUrl',
name: '文章跳转链接地址',
type: 'input'
}, {
action: 'and',
field: 'appid',
el: 'eq',
model: 'appid',
name: '文章管理的应用id',
type: 'number'
}, {
},{
action: 'and',
field: 'create_date',
field: 'ct.create_date',
el: 'eq',
model: 'createDate',
name: '创建时间',
type: 'date'
}, {
action: 'and',
field: 'update_date',
field: 'ct.update_date',
el: 'eq',
model: 'updateDate',
name: '修改时间',
......
......@@ -2,35 +2,7 @@
<head>
<meta charset="utf-8" />
<title>后台主界面</title>
<meta http-equiv="content-type" content="text/html" />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
<meta name="viewport"
content="initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no,width=device-width"/>
<meta name="format-detection" content="telephone=no"/>
<meta name="app-mobile-web-app-capable" content="yes"/>
<meta name="app-mobile-web-app-status-bar-style" content="black-translucent"/>
<script src="${base}/static/plugins/vue/2.6.9/vue.min.js"></script>
<!--通用图标-->
<link rel="stylesheet" href="${base}/static/plugins/iconfont/1.0.0/iconfont.css" />
<script src="${base}/static/plugins/element-ui/2.12.0/index.js"></script>
<link rel="stylesheet" href="${base}/static/plugins/element-ui/2.12.0/index.css" />
<!--网络请求框架-->
<script src="${base}/static/plugins/axios/0.18.0/axios.min.js"></script>
<script src="${base}/static/plugins/qs/6.6.0/qs.min.js"></script>
<!--铭飞-->
<script src="${base}/static/plugins/ms/1.0.0/ms.js"></script>
<script src="${base}/static/plugins/ms/1.0.0/ms.http.js"></script>
<script src="${base}/static/plugins/ms/1.0.0/ms.util.js"></script>
<link rel="stylesheet" href="${base}/static/plugins/minireset/0.0.2/minireset.min.css" />
<script>
ms.base = '${base}';
ms.manager = '${managerPath}';
</script>
<style>
[v-cloak]{
display: none;
}
</style>
<#include "../../include/head-file.ftl">
</head>
<body class="custom-body">
<div id="app" v-cloak>
......@@ -43,12 +15,15 @@
</div>
<div class="class-6" >
</div>
<div class="panel" >
<div v-if="alwaysList.length>0" class="panel-title">
<div class="panel" style="min-height:200px;">
<div class="panel-title" style="display:inline;">
常用功能
<el-tooltip effect="dark" content="鼠标移至上方功能大全,点击菜单右侧五角星即可添加到常用功能。" placement="left">
<i class="el-icon-question"></i>
</el-tooltip>
</div>
<div class="v-space"></div>
<div class="panel-content" style="flex-direction: row;flex-wrap: wrap; flex: unset">
<div class="panel-content" style="flex-direction: row;flex-wrap: wrap; flex: unset;margin-top:20px;">
<div class="mitem"
@click="window.parent.indexVue.openParentMenuInTitle(item.title)"
v-for="item in alwaysList">
......@@ -146,7 +121,7 @@
<div class="class-66" >
<!--图片开始-->
<img
src="${base}/static/images/1577687056305.png"
src="https://cdn.mingsoft.net/images/icon-qq.png"
class="class-67" />
<!--图片结束-->
</div>
......@@ -163,7 +138,7 @@
<div class="class-72" >
<!--图片开始-->
<img
src="${base}/static/images/1577687056305.png"
src="https://cdn.mingsoft.net/images/icon-qq.png"
class="class-73" />
<!--图片结束-->
</div>
......@@ -180,7 +155,7 @@
<div class="class-78" >
<!--图片开始-->
<img
src="${base}/static/images/1577687056305.png"
src="https://cdn.mingsoft.net/images/icon-qq.png"
class="class-79" />
<!--图片结束-->
</div>
......@@ -197,7 +172,7 @@
<div class="class-84" >
<!--图片开始-->
<img
src="${base}/static/images/1577687056305.png"
src="https://cdn.mingsoft.net/images/icon-qq.png"
class="class-85" />
<!--图片结束-->
</div>
......@@ -297,7 +272,7 @@
<div class="class-126" >
<!--图片开始-->
<img
src="${base}/static/images/1577687023678.png"
src="https://cdn.mingsoft.net/images/icon-telephone.png"
class="class-127" />
<!--图片结束-->
</div>
......@@ -314,7 +289,7 @@
<div class="class-132" >
<!--图片开始-->
<img
src="${base}/static/images/1577687056305.png"
src="https://cdn.mingsoft.net/images/icon-qq.png"
class="class-133" />
<!--图片结束-->
</div>
......@@ -1089,7 +1064,7 @@
.class-44
{
color:#333333;
background-image:url(${base}/static/images/1578104008987.png);
background-image:url(https://cdn.mingsoft.net/images/mmall.png);
outline:none;
outline-offset:-1px;
background-size:cover;
......@@ -1131,7 +1106,7 @@
.class-47
{
color:#333333;
background-image:url(${base}/static/images/1578367666376.png);
background-image:url(https://cdn.mingsoft.net/images/weixin.png);
outline:none;
outline-offset:-1px;
background-size:cover;
......@@ -1173,7 +1148,7 @@
.class-50
{
color:#333333;
background-image:url(${base}/static/images/1578366770290.png);
background-image:url(https://cdn.mingsoft.net/images/mapp.png);
outline:none;
outline-offset:-1px;
background-size:cover;
......@@ -1215,7 +1190,7 @@
.class-53
{
color:#333333;
background-image:url(${base}/static/images/1578368816112.png);
background-image:url(https://cdn.mingsoft.net/images/secondaryDevelopment.png);
outline:none;
outline-offset:-1px;
background-size:cover;
......@@ -1301,7 +1276,7 @@
.class-59
{
color:#333333;
background-image:url(${base}/static/images/1577257489392.png);
background-image:url(https://cdn.mingsoft.net/images/icon-voice.png);
outline:none;
outline-offset:-1px;
background-size:contain;
......@@ -1347,7 +1322,7 @@
.class-62
{
color:#333333;
background-image:url(${base}/static/images/1577151868190.png);
background-image:url(https://cdn.mingsoft.net/images/icon-file.png);
outline:none;
outline-offset:-1px;
height:40px;
......@@ -1763,7 +1738,7 @@
.class-96
{
color:#333333;
background-image:url(${base}/static/images/1578031206821.png);
background-image:url(https://cdn.mingsoft.net/images/icon-menu.png);
outline:none;
outline-offset:-1px;
background-size:contain;
......@@ -1807,7 +1782,7 @@
.class-99
{
color:#333333;
background-image:url(${base}/static/images/1578031321635.png);
background-image:url(https://cdn.mingsoft.net/images/icon-approve.png);
outline:none;
outline-offset:-1px;
background-size:contain;
......@@ -1851,7 +1826,7 @@
.class-102
{
color:#333333;
background-image:url(${base}/static/images/1578031484700.png);
background-image:url(https://cdn.mingsoft.net/images/icon-office.png);
outline:none;
outline-offset:-1px;
background-size:contain;
......@@ -1895,7 +1870,7 @@
.class-105
{
color:#333333;
background-image:url(${base}/static/images/1578031264207.png);
background-image:url(https://cdn.mingsoft.net/images/icon-remote.png);
outline:none;
outline-offset:-1px;
background-size:contain;
......@@ -1939,7 +1914,7 @@
.class-108
{
color:#333333;
background-image:url(${base}/static/images/1578031682848.png);
background-image:url(https://cdn.mingsoft.net/images/icon-voiceAssistance.png);
outline:none;
outline-offset:-1px;
background-size:contain;
......@@ -1983,7 +1958,7 @@
.class-111
{
color:#333333;
background-image:url(${base}/static/images/1578031639173.png);
background-image:url(https://cdn.mingsoft.net/images/icon-vip.png);
outline:none;
outline-offset:-1px;
background-size:contain;
......@@ -2027,7 +2002,7 @@
.class-114
{
color:#333333;
background-image:url(${base}/static/images/1578031215338.png);
background-image:url(https://cdn.mingsoft.net/images/icon-invoice.png);
outline:none;
outline-offset:-1px;
background-size:contain;
......@@ -2071,7 +2046,7 @@
.class-117
{
color:#333333;
background-image:url(${base}/static/images/1578031228196.png);
background-image:url(https://cdn.mingsoft.net/images/icon-authorize.png);
outline:none;
outline-offset:-1px;
background-size:contain;
......@@ -2115,7 +2090,7 @@
.class-120
{
color:#333333;
background-image:url(${base}/static/images/1578031234719.png);
background-image:url(https://cdn.mingsoft.net/images/icon-letterOfAuthorization.png);
outline:none;
outline-offset:-1px;
background-size:contain;
......@@ -2855,4 +2830,4 @@
#app{
overflow-x: hidden;
}
</style>
</style>
\ No newline at end of file
html,
body {
html, body {
min-height: 100vh;
width: 100vw;
background-color: #eee;
......@@ -10,12 +9,15 @@ body {
color: #333 !important;
overflow: hidden;
}
html *,
body * {
html *, body * {
text-decoration: none !important;
font-family: Verdana, Arial, Helvetica, sans-serif;
box-sizing: border-box;
}
/**
*框架样式
*/
.ms-ellipsis {
overflow: hidden;
text-overflow: ellipsis;
......@@ -26,14 +28,6 @@ body * {
display: flex;
align-items: center;
}
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
font-weight: initial;
font-size: 12px;
color: #999;
resize: none;
}
a:link,a:visited,a:active{text-decoration: none; color:#409EFF;}
.ms-index{
display: flex;
......@@ -48,7 +42,6 @@ a:link,a:visited,a:active{text-decoration: none; color:#409EFF;}
padding: 14px ;
background: #fff;
}
.ms-header {
padding: 10px;
margin: 0;
......@@ -69,10 +62,8 @@ a:link,a:visited,a:active{text-decoration: none; color:#409EFF;}
.ms-tr {
text-align: right;
}
.el-button+.el-button {
margin-left: 0
}
.ms-loading {background:url('/static/images/loading.gif') no-repeat center;}
/*表单提示*/
.ms-form-tip,.ms-form-tip-err {
color: #909399;
font-size: 12px;
......@@ -80,18 +71,16 @@ a:link,a:visited,a:active{text-decoration: none; color:#409EFF;}
padding: 4px 0;
}
.ms-form-tip-err{
color:#f56c6c
color:#f56c6c
}
.ms-alert-tip{
margin-bottom: 10px;
}
.ms-select{
display: block;
}
.ms-datetimerange{
width: 100% !important;
}
/*搜索*/
.ms-search{
background: #fff;
padding: 10px 14px 0 14px;
......@@ -101,23 +90,58 @@ color:#f56c6c
line-height: 60px;
text-align: center;
}
.ms-datetimerange{
width: 100% !important;
}
.ms-table-pagination {
height: calc(100% - 75px);
}
#myPageTop {
width: 252px;
/*滚动条*/
.ms-scrollbar .el-scrollbar__bar.is-vertical{
width: 6px !important;
}
.ms-scrollbar .el-scrollbar__view{
padding-right: 17px;
}
/*后台管理界面的el-menu通用样式*/
.ms-index .el-menu {
border-right: none;
background-color: unset;
}
.ms-index .el-menu-item {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
}
#form .ms-container{
height:calc(100vh - 38px);
}
a:link,a:visited,a:active{text-decoration: none; color:#409EFF;}
/*样式重写*/
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
font-weight: initial;
font-size: 12px;
color: #999;
resize: none;
}
#myPageTop input {
width: 242px;
.el-button+.el-button {
margin-left: 0
}
.el-button .iconfont{
font-size: 12px;
margin-right: 5px;
line-height: 1px!important;
}
#form .ms-container{
height:calc(100vh - 38px);
}
[v-cloak]{
display: none;
......@@ -135,20 +159,4 @@ color:#f56c6c
.el-scrollbar__wrap{
overflow-x: hidden!important;
}
.ms-scrollbar .el-scrollbar__bar.is-vertical{
width: 6px !important;
}
.ms-scrollbar .el-scrollbar__view{
padding-right: 17px;
}
/**后台管理界面的el-menu通用样式**/
.ms-index .el-menu {
border-right: none;
background-color: unset;
}
.ms-index .el-menu-item {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
}
......@@ -16,6 +16,7 @@
.ms-theme-light.ms-admin-menu-aside-submenu .el-menu-item:hover{
background-color:rgba(255,255,255,0.3) !important;
}
/*深色系*/
.ms-theme-dark .ms-admin-logo > div span{
color: rgba(56,58,63,1);
......
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