Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
0e6194e2
Commit
0e6194e2
authored
Jul 07, 2023
by
chenym
Browse files
test
parent
487a7090
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/cms/action/CategoryAction.java
View file @
0e6194e2
...
...
@@ -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
;
}
}
}
}
}
src/main/java/net/mingsoft/cms/action/GeneraterAction.java
View file @
0e6194e2
...
...
@@ -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.ContentBean
Request
;
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
);
ContentBean
Request
contentBean
Request
=
new
ContentBean
Request
();
contentBean
Request
.
setCategoryId
(
column
.
getId
());
contentBean
Request
.
setCategoryType
(
column
.
getCategoryType
());
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
Request
);
// 判断列表类型
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
);
ContentBean
Request
contentBean
Request
=
new
ContentBean
Request
();
contentBean
Request
.
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"
);
contentBean
Request
.
setCategoryId
(
category
.
getId
());
contentBean
Request
.
setCategoryType
(
category
.
getCategoryType
());
contentBean
Request
.
setOrderBy
(
"date"
);
//将文章列表标签中的中的参数
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
Request
);
// 分类是列表
if
(
category
.
getCategoryType
().
equals
(
CategoryTypeEnum
.
LIST
.
toString
()))
{
// 判断模板文件是否存在
...
...
src/main/java/net/mingsoft/cms/action/web/ContentAction.java
View file @
0e6194e2
...
...
@@ -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.ContentBean
Request
;
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
ContentBean
Request
content
)
{
BasicUtil
.
startPage
();
content
.
setSqlWhere
(
""
);
List
contentList
=
contentBiz
.
query
(
content
);
...
...
src/main/java/net/mingsoft/cms/action/web/MCmsAction.java
View file @
0e6194e2
...
...
@@ -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
(
"<"
,
"<"
).
replaceAll
(
">"
,
">"
);
value
=
value
.
replaceAll
(
"\\("
,
"("
).
replace
(
"\\)"
,
")"
);
value
=
value
.
replaceAll
(
"'"
,
"'"
);
...
...
@@ -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
(
"<"
,
"<"
).
replaceAll
(
">"
,
">"
);
value
=
value
.
replaceAll
(
"\\("
,
"("
).
replace
(
"\\)"
,
")"
);
value
=
value
.
replaceAll
(
"'"
,
"'"
);
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
JSON
Util
.
toJsonStr
(
this
);
return
JSON
.
toJSONString
(
this
);
}
}
private
void
notControlPheon
(
JSONObject
map
,
String
noControll
)
{
if
(
map
.
getString
(
noControll
)
==
null
)
{
return
;
}
String
set
=
map
.
getString
(
noControll
);
}
}
src/main/java/net/mingsoft/cms/action/web/SqlSession.java
View file @
0e6194e2
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
));
}
}
src/main/java/net/mingsoft/cms/biz/ICategoryBiz.java
View file @
0e6194e2
...
...
@@ -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
);
}
src/main/java/net/mingsoft/cms/biz/IContentBiz.java
View file @
0e6194e2
...
...
@@ -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.ContentBean
Request
;
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 contentBean
Request
* @return
*/
List
<
CategoryBean
>
queryIdsByCategoryIdForParser
(
ContentBean
contentBean
);
List
<
CategoryBean
>
queryIdsByCategoryIdForParser
(
ContentBean
Request
contentBean
Request
);
/**
* 查询文章,不包括单篇
* @param contentBean
* @param contentBean
Request
* @return
*/
List
<
CategoryBean
>
queryContent
(
ContentBean
contentBean
);
List
<
CategoryBean
>
queryContent
(
ContentBean
Request
contentBean
Request
);
int
getSearchCount
(
ModelEntity
contentModel
,
List
diyList
,
Map
whereMap
,
int
appId
,
String
categoryIds
);
/**
* 根据文章属性查询,不包括单篇
* @param contentBean
* @param contentBean
Request
* @return
*/
List
<
CategoryBean
>
queryIdsByCategoryIdForParserAndNotCover
(
ContentBean
contentBean
);
List
<
CategoryBean
>
queryIdsByCategoryIdForParserAndNotCover
(
ContentBean
Request
contentBean
Request
);
/**
* 根据解析标签arclist的sql获取list
...
...
src/main/java/net/mingsoft/cms/constant/Const.java
View file @
0e6194e2
...
...
@@ -31,4 +31,6 @@ public class Const {
* 资源文件
*/
public
final
static
String
RESOURCES
=
"net.mingsoft.cms.resources.resources"
;
public
static
String
field
=
""
;
}
src/main/java/net/mingsoft/cms/dao/IContentDao.java
View file @
0e6194e2
...
...
@@ -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.ContentBean
Request
;
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
(
ContentBean
Request
contentBean
Request
);
/**
* 查询文章编号集合,不包括单篇
* @contentBean
* @return
*/
public
List
<
CategoryBean
>
queryIdsByCategoryIdForParserAndNotCover
(
ContentBean
contentBean
);
public
List
<
CategoryBean
>
queryIdsByCategoryIdForParserAndNotCover
(
ContentBean
Request
contentBean
Request
);
/**
* 查询文章,不包括单篇
* @contentBean
* @return
*/
public
List
<
CategoryBean
>
queryContent
(
ContentBean
contentBean
);
public
List
<
CategoryBean
>
queryContent
(
ContentBean
Request
contentBean
Request
);
/**
* 根据查询文章实体总数
...
...
src/main/java/net/mingsoft/cms/dao/IContentDao.xml
View file @
0e6194e2
...
...
@@ -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.ContentBean
Request
"
>
<id
column=
"id"
property=
"id"
/>
<!--编号 -->
<result
column=
"content_title"
property=
"contentTitle"
/>
<!--文章标题 -->
<result
column=
"content_short_title"
property=
"contentShortTitle"
/>
<!--文章副标题 -->
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment