Commit 0e6194e2 authored by chenym's avatar chenym
Browse files

test

parent 487a7090
......@@ -47,7 +47,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -516,18 +515,8 @@ public class CategoryAction extends BaseAction {
System.out.println("ok");
}
public void testsplit(String currentUrl, Set<String> urls){
Boolean isTrue=false;
for(String url:urls){
if(!StringUtil.isBlank(url)){
String paths[] =url.split("/");
if(currentUrl.contains("/"+paths[1])){
isTrue=true;
break;
}
}
}
}
}
......@@ -26,14 +26,9 @@ package net.mingsoft.cms.action;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateException;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.ZipUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.ApiOperation;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.annotation.LogAnn;
......@@ -42,13 +37,12 @@ import net.mingsoft.basic.constant.e.BusinessTypeEnum;
import net.mingsoft.basic.entity.AppEntity;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.bean.CategoryBean;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.bean.ContentBeanRequest;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.constant.e.CategoryDisplayEnum;
import net.mingsoft.cms.constant.e.CategoryTypeEnum;
import net.mingsoft.cms.entity.CategoryEntity;
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.cms.util.CmsParserUtil;
import net.mingsoft.mdiy.util.ParserUtil;
import org.apache.commons.lang3.StringUtils;
......@@ -65,12 +59,9 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @ClassName: GeneraterAction
......@@ -192,10 +183,10 @@ public class GeneraterAction extends BaseAction {
if (column.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) {
continue;
}
ContentBean contentBean = new ContentBean();
contentBean.setCategoryId(column.getId());
contentBean.setCategoryType(column.getCategoryType());
articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBean);
ContentBeanRequest contentBeanRequest = new ContentBeanRequest();
contentBeanRequest.setCategoryId(column.getId());
contentBeanRequest.setCategoryType(column.getCategoryType());
articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBeanRequest);
// 判断列表类型
switch (CategoryTypeEnum.get(column.getCategoryType())) {
//TODO 暂时先用字符串代替
......@@ -248,8 +239,8 @@ public class GeneraterAction extends BaseAction {
// 网站风格物理路径
List<CategoryBean> articleIdList = null;
List<CategoryEntity> categoryList = new ArrayList<CategoryEntity>();
ContentBean contentBean = new ContentBean();
contentBean.setBeginTime(dateTime);
ContentBeanRequest contentBeanRequest = new ContentBeanRequest();
contentBeanRequest.setBeginTime(dateTime);
// 时间格式化
Date contentUpdateTime = null;
......@@ -276,11 +267,11 @@ public class GeneraterAction extends BaseAction {
if (category.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) {
continue;
}
contentBean.setCategoryId(category.getId());
contentBean.setCategoryType(category.getCategoryType());
contentBean.setOrderBy("date");
contentBeanRequest.setCategoryId(category.getId());
contentBeanRequest.setCategoryType(category.getCategoryType());
contentBeanRequest.setOrderBy("date");
//将文章列表标签中的中的参数
articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBean);
articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBeanRequest);
// 分类是列表
if (category.getCategoryType().equals(CategoryTypeEnum.LIST.toString())) {
// 判断模板文件是否存在
......
......@@ -30,7 +30,7 @@ import io.swagger.annotations.ApiOperation;
import net.mingsoft.base.entity.ResultData;
import net.mingsoft.basic.bean.EUListBean;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.bean.ContentBeanRequest;
import net.mingsoft.cms.biz.IContentBiz;
import net.mingsoft.cms.biz.IHistoryLogBiz;
import net.mingsoft.cms.entity.ContentEntity;
......@@ -81,7 +81,7 @@ public class ContentAction extends net.mingsoft.cms.action.BaseAction{
})
@PostMapping("/list")
@ResponseBody
public ResultData list(@ModelAttribute @ApiIgnore ContentBean content) {
public ResultData list(@ModelAttribute @ApiIgnore ContentBeanRequest content) {
BasicUtil.startPage();
content.setSqlWhere("");
List contentList = contentBiz.query(content);
......
......@@ -7,10 +7,10 @@
* 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:
* <p>
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* <p>
* 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
......@@ -23,7 +23,8 @@ package net.mingsoft.cms.action.web;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.PageUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import freemarker.core.ParseException;
import freemarker.template.MalformedTemplateNameException;
import freemarker.template.TemplateNotFoundException;
......@@ -96,10 +97,15 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
* @param request 搜索id
* @param response
*/
@RequestMapping(value = "search",method = {RequestMethod.GET, RequestMethod.POST},produces= MediaType.TEXT_HTML_VALUE+";charset=utf-8")
@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");
List<String> list = new ArrayList<>();
list.add(search);
ResultEntity resultEntity = new ResultEntity();
clearXss(resultEntity, search);
System.out.println("调用同类中其他方法");
//设置分页类
PageBean page = new PageBean();
page.setSize(ParserUtil.getPageSize(search, 20));
......@@ -224,7 +230,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
Map<String, Object> searchMap = field;
searchMap.put("categoryIds",categoryIds);
searchMap.put("categoryIds", categoryIds);
StringBuilder urlParams = new StringBuilder();
searchMap.forEach((k, v) -> {
......@@ -254,7 +260,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
}
//对项目名预处理
String contextPath = BasicUtil.getContextPath();
if (StringUtils.isNotBlank(contextPath) && "/".equalsIgnoreCase(contextPath) ){
if (StringUtils.isNotBlank(contextPath) && "/".equalsIgnoreCase(contextPath)) {
contextPath = "";
}
params.putIfAbsent(ParserUtil.CONTEXT_PATH, contextPath);
......@@ -316,11 +322,9 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
// 清除路径中的转义字符
private String clearXss(String value) {
if (value == null || "".equals(value)) {
return value;
}
value = value.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
value = value.replaceAll("\\(", "&#40;").replace("\\)", "&#41;");
value = value.replaceAll("'", "&#39;");
......@@ -332,6 +336,23 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
return value;
}
private void clearXss(ResultEntity data, String value) {
if (value == null || "".equals(value)) {
return;
}
value = value.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
value = value.replaceAll("\\(", "&#40;").replace("\\)", "&#41;");
value = value.replaceAll("'", "&#39;");
value = value.replaceAll("eval\\((.*)\\)", "");
value = value.replaceAll("[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']",
"\"\"");
value = value.replace("script", "");
data.setMessage(value);
List list = data.getData();
list.add(value);
data.setData(list);
}
/**
* 存储自定义模型字段和接口参数
*
......@@ -360,8 +381,14 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
@Override
public String toString() {
return JSONUtil.toJsonStr(this);
return JSON.toJSONString(this);
}
}
private void notControlPheon(JSONObject map, String noControll) {
if (map.getString(noControll) == null) {
return;
}
String set = map.getString(noControll);
}
}
package net.mingsoft.cms.action.web;
import net.mingsoft.basic.util.BasicUtil;
import net.mingsoft.cms.biz.ICategoryBiz;
import net.mingsoft.cms.biz.impl.CategoryBizImpl;
import net.mingsoft.cms.entity.CategoryEntity;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.w3c.dom.Element;
import javax.sql.DataSource;
import javax.swing.text.Document;
import java.util.ArrayList;
import java.util.List;
@Service
public class SqlSession {
private SqlSessionFactory sessionFactory;
String abc;
@Autowired
private DataSource dataSource;
@Autowired
private ICategoryBiz categoryBiz;
public SqlSessionFactory testBoradReturnType() throws Exception {
......@@ -31,6 +43,31 @@ public class SqlSession {
s = 1;
} else if ("2".equals(store)) {
s = 2;
}else {
s=3;
}
}
public void listEmpty(CategoryEntity category) {
BasicUtil.startPage();
category.setSqlWhere("");
String str = categoryBiz.setTopId(category);
if("".equals(str)){
System.out.println("empty set");
}
}
public void errorTest(){
CategoryBizImpl str= new CategoryBizImpl();
String temp= str.listObjs().toString().replaceAll("(.*/proxy/download_file/)(.*)", "cid:$2");
/* String temp= str.listObjs().toString().replaceAll("(.*///proxy/download_file/)(.*)", "cid:$2"); */
List<Integer> miniUserIdList = new ArrayList<>();
miniUserIdList.forEach(item -> str.listObjs().toString());
miniUserIdList.forEach(item -> miniUserIdList.add(item));
}
}
......@@ -50,6 +50,7 @@ public interface ICategoryBiz extends IBaseBiz<CategoryEntity> {
*/
void updateEntity(CategoryEntity entity);
String setTopId(CategoryEntity entity);
/**只更新自身
* @param entity
*/
......@@ -58,4 +59,6 @@ public interface ICategoryBiz extends IBaseBiz<CategoryEntity> {
void delete(String categoryId);
void copyCategory(CategoryEntity entity);
boolean checkLength(String str);
}
......@@ -24,7 +24,7 @@ package net.mingsoft.cms.biz;
import net.mingsoft.base.biz.IBaseBiz;
import net.mingsoft.cms.bean.CategoryBean;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.bean.ContentBeanRequest;
import net.mingsoft.cms.entity.ContentEntity;
import net.mingsoft.mdiy.entity.ModelEntity;
......@@ -43,24 +43,24 @@ public interface IContentBiz extends IBaseBiz<ContentEntity> {
/**
* 根据文章属性查询
* @param contentBean
* @param contentBeanRequest
* @return
*/
List<CategoryBean> queryIdsByCategoryIdForParser(ContentBean contentBean);
List<CategoryBean> queryIdsByCategoryIdForParser(ContentBeanRequest contentBeanRequest);
/**
* 查询文章,不包括单篇
* @param contentBean
* @param contentBeanRequest
* @return
*/
List<CategoryBean> queryContent(ContentBean contentBean);
List<CategoryBean> queryContent(ContentBeanRequest contentBeanRequest);
int getSearchCount(ModelEntity contentModel, List diyList, Map whereMap, int appId, String categoryIds);
/**
* 根据文章属性查询,不包括单篇
* @param contentBean
* @param contentBeanRequest
* @return
*/
List<CategoryBean> queryIdsByCategoryIdForParserAndNotCover(ContentBean contentBean);
List<CategoryBean> queryIdsByCategoryIdForParserAndNotCover(ContentBeanRequest contentBeanRequest);
/**
* 根据解析标签arclist的sql获取list
......
......@@ -31,4 +31,6 @@ public class Const {
* 资源文件
*/
public final static String RESOURCES = "net.mingsoft.cms.resources.resources";
public static String field="";
}
......@@ -24,7 +24,7 @@ package net.mingsoft.cms.dao;
import net.mingsoft.base.dao.IBaseDao;
import net.mingsoft.cms.bean.CategoryBean;
import net.mingsoft.cms.bean.ContentBean;
import net.mingsoft.cms.bean.ContentBeanRequest;
import net.mingsoft.cms.entity.ContentEntity;
import org.apache.ibatis.annotations.Param;
......@@ -46,21 +46,21 @@ public interface IContentDao extends IBaseDao<ContentEntity> {
* @contentBean
* @return
*/
public List<CategoryBean> queryIdsByCategoryIdForParser(ContentBean contentBean);
public List<CategoryBean> queryIdsByCategoryIdForParser(ContentBeanRequest contentBeanRequest);
/**
* 查询文章编号集合,不包括单篇
* @contentBean
* @return
*/
public List<CategoryBean> queryIdsByCategoryIdForParserAndNotCover(ContentBean contentBean);
public List<CategoryBean> queryIdsByCategoryIdForParserAndNotCover(ContentBeanRequest contentBeanRequest);
/**
* 查询文章,不包括单篇
* @contentBean
* @return
*/
public List<CategoryBean> queryContent(ContentBean contentBean);
public List<CategoryBean> queryContent(ContentBeanRequest contentBeanRequest);
/**
* 根据查询文章实体总数
......
......@@ -26,7 +26,7 @@
<result column="del" property="del" /><!--删除标记 -->
</resultMap>
<resultMap id="resultContentMap" type="net.mingsoft.cms.bean.ContentBean">
<resultMap id="resultContentMap" type="net.mingsoft.cms.bean.ContentBeanRequest">
<id column="id" property="id" /><!--编号 -->
<result column="content_title" property="contentTitle" /><!--文章标题 -->
<result column="content_short_title" property="contentShortTitle" /><!--文章副标题 -->
......
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