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
50b1dd92
Commit
50b1dd92
authored
Nov 28, 2020
by
wujj
Browse files
Merge remote-tracking branch 'origin/master'
parents
527f2b27
fd764fdb
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/cms/action/ContentAction.java
View file @
50b1dd92
...
...
@@ -123,9 +123,9 @@ public class ContentAction extends BaseAction {
*/
@ApiOperation
(
value
=
"根据封面获取文章列表接口"
)
@ApiImplicitParam
(
name
=
"categoryId"
,
value
=
"分类编号"
,
required
=
true
,
paramType
=
"query"
)
@GetMapping
(
"/get
By
FengMian"
)
@GetMapping
(
"/get
From
FengMian"
)
@ResponseBody
public
ResultData
get
By
FengMian
(
@ModelAttribute
@ApiIgnore
ContentEntity
content
){
public
ResultData
get
From
FengMian
(
@ModelAttribute
@ApiIgnore
ContentEntity
content
){
if
(
content
.
getCategoryId
()
==
null
)
{
return
ResultData
.
build
().
error
();
}
...
...
src/main/java/net/mingsoft/cms/action/GeneraterAction.java
View file @
50b1dd92
/**
The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
*
The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
* <p>
* 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:
* <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
...
...
@@ -36,7 +36,6 @@ import net.mingsoft.cms.biz.ICategoryBiz;
import
net.mingsoft.cms.biz.IContentBiz
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
net.mingsoft.cms.util.CmsParserUtil
;
import
net.mingsoft.mdiy.bean.AttributeBean
;
import
net.mingsoft.mdiy.bean.PageBean
;
import
net.mingsoft.mdiy.util.ParserUtil
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -75,245 +74,220 @@ import java.util.Map;
@Scope
(
"request"
)
public
class
GeneraterAction
extends
BaseAction
{
/*
* log4j日志记录
*/
protected
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
/*
* log4j日志记录
*/
protected
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
this
.
getClass
());
/**
* 文章管理业务层
*/
@Autowired
private
IContentBiz
contentBiz
;
/**
* 文章管理业务层
*/
@Autowired
private
IContentBiz
contentBiz
;
/**
* 栏目管理业务层
*/
@Autowired
private
ICategoryBiz
categoryBiz
;
/**
* 栏目管理业务层
*/
@Autowired
private
ICategoryBiz
categoryBiz
;
/**
* 模块管理业务层
*/
@Autowired
private
IModelBiz
modelBiz
;
/**
* 模块管理业务层
*/
@Autowired
private
IModelBiz
modelBiz
;
@Value
(
"${ms.manager.path}"
)
private
String
managerPath
;
@Value
(
"${ms.manager.path}"
)
private
String
managerPath
;
/**
/**
/**
* 更新主页
*
* @return
*/
@RequestMapping
(
"/index"
)
public
String
index
(
HttpServletRequest
request
,
ModelMap
model
)
{
return
"/cms/generate/index"
;
}
/**
* 更新主页
*
* @return
*/
@RequestMapping
(
"/index"
)
public
String
index
(
HttpServletRequest
request
,
ModelMap
model
)
{
return
"/cms/generate/index"
;
}
/**
* 生成主页
*
* @param request
* @param response
*/
@RequestMapping
(
"/generateIndex"
)
@RequiresPermissions
(
"cms:generate:index"
)
/**
* 生成主页
*
* @param request
* @param response
*/
@RequestMapping
(
"/generateIndex"
)
@RequiresPermissions
(
"cms:generate:index"
)
@LogAnn
(
title
=
"生成主页"
,
businessType
=
BusinessTypeEnum
.
UPDATE
)
@ResponseBody
public
ResultData
generateIndex
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
// 模版文件名称
String
tmpFileName
=
request
.
getParameter
(
"url"
);
// 生成后的文件名称
String
generateFileName
=
request
.
getParameter
(
"position"
);
@ResponseBody
public
ResultData
generateIndex
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
// 模版文件名称
String
tmpFileName
=
request
.
getParameter
(
"url"
);
// 生成后的文件名称
String
generateFileName
=
request
.
getParameter
(
"position"
);
// 获取文件所在路径 首先判断用户输入的模版文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
()))
{
return
ResultData
.
build
().
error
(
getResString
(
"templet.file"
));
}
else
{
// 获取文件所在路径 首先判断用户输入的模版文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
()))
{
return
ResultData
.
build
().
error
(
getResString
(
"templet.file"
));
}
else
{
CmsParserUtil
.
generate
(
tmpFileName
,
generateFileName
);
return
ResultData
.
build
().
success
();
}
}
}
}
/**
* 生成列表的静态页面
*
* @param request
* @param response
* @param categoryId
*/
@RequestMapping
(
"/{categoryId}/genernateColumn"
)
/**
* 生成列表的静态页面
*
* @param request
* @param response
* @param categoryId
*/
@RequestMapping
(
"/{categoryId}/genernateColumn"
)
@LogAnn
(
title
=
"生成栏目"
,
businessType
=
BusinessTypeEnum
.
UPDATE
)
@RequiresPermissions
(
"cms:generate:column"
)
@ResponseBody
public
ResultData
genernateColumn
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
String
categoryId
)
throws
IOException
{
// 获取站点id
AppEntity
app
=
BasicUtil
.
getApp
();
List
<
CategoryEntity
>
columns
=
new
ArrayList
<
CategoryEntity
>();
// 如果栏目id小于0则更新所有的栏目,否则只更新选中的栏目
if
(!
"0"
.
equals
(
categoryId
))
{
CategoryEntity
categoryEntity
=
new
CategoryEntity
();
categoryEntity
.
setId
(
categoryId
);
columns
=
categoryBiz
.
queryChilds
(
categoryEntity
);
}
else
{
// 获取所有的内容管理栏目
CategoryEntity
categoryEntity
=
new
CategoryEntity
();
columns
=
categoryBiz
.
query
(
categoryEntity
);
}
List
<
CategoryBean
>
articleIdList
=
null
;
// 1、设置模板文件夹路径
// 获取栏目列表模版
for
(
CategoryEntity
column
:
columns
)
{
ContentBean
contentBean
=
new
ContentBean
();
contentBean
.
setCategoryId
(
column
.
getId
());
// 分类是列表
if
(
column
.
getCategoryType
().
equals
(
"1"
))
{
@RequiresPermissions
(
"cms:generate:column"
)
@ResponseBody
public
ResultData
genernateColumn
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
String
categoryId
)
throws
IOException
{
// 获取站点id
AppEntity
app
=
BasicUtil
.
getApp
();
//栏目列表
List
<
CategoryEntity
>
columns
=
new
ArrayList
<
CategoryEntity
>();
if
(
"0"
.
equals
(
categoryId
))
{
// 0更新所有栏目
CategoryEntity
categoryEntity
=
new
CategoryEntity
();
columns
=
categoryBiz
.
query
(
categoryEntity
);
}
else
{
//选择栏目更新
CategoryEntity
categoryEntity
=
new
CategoryEntity
();
categoryEntity
.
setId
(
categoryId
);
columns
=
categoryBiz
.
queryChilds
(
categoryEntity
);
}
//文章列表
List
<
CategoryBean
>
articleIdList
=
null
;
// 获取栏目列表模版
for
(
CategoryEntity
column
:
columns
)
{
ContentBean
contentBean
=
new
ContentBean
();
contentBean
.
setCategoryId
(
column
.
getId
());
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
// 判断列表类型
switch
(
column
.
getCategoryType
())
{
//TODO 暂时先用字符串代替
case
"1"
:
// 列表
// 判断模板文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
column
.
getCategoryListUrl
())))
{
LOG
.
error
(
"模板不存在:{}"
,
column
.
getCategoryUrl
());
continue
;
}
//获取模板中列表标签中的条件
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
BasicUtil
.
getWebsiteApp
()
!=
null
){
map
.
put
(
ParserUtil
.
APP_ID
,
BasicUtil
.
getWebsiteApp
().
getAppId
());
}
PageBean
page
=
new
PageBean
();
map
.
put
(
ParserUtil
.
HTML
,
ParserUtil
.
HTML
);
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
map
.
put
(
ParserUtil
.
PAGE
,
page
);
AttributeBean
attributeBean
=
new
AttributeBean
();
// 获取文章列表模板标签属性
ParserUtil
.
read
(
column
.
getCategoryListUrl
(),
map
,
page
,
attributeBean
);
contentBean
.
setFlag
(
attributeBean
.
getFlag
());
contentBean
.
setNoflag
(
attributeBean
.
getNoflag
());
contentBean
.
setOrder
(
attributeBean
.
getOrder
());
contentBean
.
setOrderBy
(
attributeBean
.
getOrderby
());
}
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
// 判断列表类型
switch
(
column
.
getCategoryType
())
{
//TODO 暂时先用字符串代替
case
"1"
:
// 列表
CmsParserUtil
.
generateList
(
column
,
articleIdList
.
size
());
break
;
case
"2"
:
// 单页
if
(
articleIdList
.
size
()==
0
){
CategoryBean
columnArticleIdBean
=
new
CategoryBean
();
CopyOptions
copyOptions
=
CopyOptions
.
create
();
copyOptions
.
setIgnoreError
(
true
);
BeanUtil
.
copyProperties
(
column
,
columnArticleIdBean
,
copyOptions
);
articleIdList
.
add
(
columnArticleIdBean
);
}
CmsParserUtil
.
generateBasic
(
articleIdList
);
break
;
}
}
CmsParserUtil
.
generateList
(
column
,
articleIdList
.
size
());
break
;
case
"2"
:
// 单页
if
(
articleIdList
.
size
()
==
0
)
{
CategoryBean
columnArticleIdBean
=
new
CategoryBean
();
CopyOptions
copyOptions
=
CopyOptions
.
create
();
copyOptions
.
setIgnoreError
(
true
);
BeanUtil
.
copyProperties
(
column
,
columnArticleIdBean
,
copyOptions
);
articleIdList
.
add
(
columnArticleIdBean
);
}
CmsParserUtil
.
generateBasic
(
articleIdList
);
break
;
}
}
return
ResultData
.
build
().
success
();
}
}
/**
* 根据栏目id更新所有的文章
*
* @param request
* @param response
* @param columnId
*/
@RequestMapping
(
"/{columnId}/generateArticle"
)
@RequiresPermissions
(
"cms:generate:article"
)
/**
* 根据栏目id更新所有的文章
*
* @param request
* @param response
* @param columnId
*/
@RequestMapping
(
"/{columnId}/generateArticle"
)
@RequiresPermissions
(
"cms:generate:article"
)
@LogAnn
(
title
=
"生成文章"
,
businessType
=
BusinessTypeEnum
.
UPDATE
)
@ResponseBody
public
ResultData
generateArticle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
String
columnId
)
throws
IOException
{
String
dateTime
=
request
.
getParameter
(
"dateTime"
);
// 网站风格物理路径
List
<
CategoryBean
>
articleIdList
=
null
;
List
<
CategoryEntity
>
categoryList
=
null
;
AttributeBean
attributeBean
=
new
AttributeBean
();
ContentBean
contentBean
=
new
ContentBean
();
contentBean
.
setBeginTime
(
dateTime
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
BasicUtil
.
getWebsiteApp
()
!=
null
){
map
.
put
(
ParserUtil
.
APP_ID
,
BasicUtil
.
getWebsiteApp
().
getAppId
());
}
PageBean
page
=
new
PageBean
();
map
.
put
(
ParserUtil
.
HTML
,
ParserUtil
.
HTML
);
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
map
.
put
(
ParserUtil
.
PAGE
,
page
);
// 生成所有栏目的文章
if
(
"0"
.
equals
(
columnId
)){
CategoryEntity
categoryEntity
=
new
CategoryEntity
();
categoryList
=
categoryBiz
.
query
(
categoryEntity
);
for
(
CategoryEntity
category
:
categoryList
){
contentBean
.
setCategoryId
(
category
.
getId
());
// 分类是列表
if
(
category
.
getCategoryType
().
equals
(
"1"
)){
// 判断模板文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
category
.
getCategoryListUrl
()))
||
StringUtils
.
isEmpty
(
category
.
getCategoryListUrl
()))
{
LOG
.
error
(
"模板不存在:{}"
,
category
.
getCategoryUrl
());
continue
;
}
// 获取文章列表表属性
ParserUtil
.
read
(
category
.
getCategoryListUrl
(),
map
,
page
,
attributeBean
);
contentBean
.
setFlag
(
attributeBean
.
getFlag
());
contentBean
.
setNoflag
(
attributeBean
.
getNoflag
());
contentBean
.
setOrder
(
attributeBean
.
getOrder
());
contentBean
.
setOrderBy
(
attributeBean
.
getOrderby
());
}
//将文章列表标签中的中的参数
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
// 有符合条件的就更新
if
(
articleIdList
.
size
()
>
0
)
{
CmsParserUtil
.
generateBasic
(
articleIdList
);
}
}
}
else
{
CategoryEntity
category
=
(
CategoryEntity
)
categoryBiz
.
getById
(
columnId
);
contentBean
.
setCategoryId
(
columnId
);
// 分类是列表
if
(
category
.
getCategoryType
().
equals
(
"1"
)){
// 获取文章列表表属性
// 判断模板文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
category
.
getCategoryUrl
())))
{
LOG
.
error
(
"模板不存在:{}"
,
category
.
getCategoryUrl
());
@ResponseBody
public
ResultData
generateArticle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
String
columnId
)
throws
IOException
{
String
dateTime
=
request
.
getParameter
(
"dateTime"
);
// 网站风格物理路径
List
<
CategoryBean
>
articleIdList
=
null
;
List
<
CategoryEntity
>
categoryList
=
null
;
ContentBean
contentBean
=
new
ContentBean
();
contentBean
.
setBeginTime
(
dateTime
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
BasicUtil
.
getWebsiteApp
()
!=
null
)
{
map
.
put
(
ParserUtil
.
APP_ID
,
BasicUtil
.
getWebsiteApp
().
getAppId
());
}
PageBean
page
=
new
PageBean
();
map
.
put
(
ParserUtil
.
HTML
,
ParserUtil
.
HTML
);
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
map
.
put
(
ParserUtil
.
PAGE
,
page
);
// 生成所有栏目的文章
if
(
"0"
.
equals
(
columnId
))
{
CategoryEntity
categoryEntity
=
new
CategoryEntity
();
categoryList
=
categoryBiz
.
query
(
categoryEntity
);
for
(
CategoryEntity
category
:
categoryList
)
{
contentBean
.
setCategoryId
(
category
.
getId
());
// 分类是列表
if
(
category
.
getCategoryType
().
equals
(
"1"
))
{
// 判断模板文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
category
.
getCategoryListUrl
()))
||
StringUtils
.
isEmpty
(
category
.
getCategoryListUrl
()))
{
LOG
.
error
(
"模板不存在:{}"
,
category
.
getCategoryUrl
());
continue
;
}
}
//将文章列表标签中的中的参数
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
// 有符合条件的就更新
if
(
articleIdList
.
size
()
>
0
)
{
CmsParserUtil
.
generateBasic
(
articleIdList
);
}
}
}
else
{
CategoryEntity
category
=
(
CategoryEntity
)
categoryBiz
.
getById
(
columnId
);
contentBean
.
setCategoryId
(
columnId
);
// 分类是列表
if
(
category
.
getCategoryType
().
equals
(
"1"
))
{
// 获取文章列表表属性
// 判断模板文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
category
.
getCategoryUrl
())))
{
LOG
.
error
(
"模板不存在:{}"
,
category
.
getCategoryUrl
());
return
ResultData
.
build
().
error
(
getResString
(
"templet.file"
));
}
ParserUtil
.
read
(
category
.
getCategoryListUrl
(),
map
,
page
,
attributeBean
);
contentBean
.
setFlag
(
attributeBean
.
getFlag
());
contentBean
.
setNoflag
(
attributeBean
.
getNoflag
());
contentBean
.
setOrder
(
attributeBean
.
getOrder
());
contentBean
.
setOrderBy
(
attributeBean
.
getOrderby
());
}
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
// 有符合条件的就更新
if
(
articleIdList
.
size
()
>
0
)
{
CmsParserUtil
.
generateBasic
(
articleIdList
);
}
}
}
}
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
// 有符合条件的就更新
if
(
articleIdList
.
size
()
>
0
)
{
CmsParserUtil
.
generateBasic
(
articleIdList
);
}
}
return
ResultData
.
build
().
success
();
}
}
/**
* 用户预览主页
*
* @param request
* @return
*/
@RequestMapping
(
"/{position}/viewIndex"
)
public
String
viewIndex
(
HttpServletRequest
request
,
@PathVariable
String
position
,
HttpServletResponse
response
)
{
AppEntity
app
=
BasicUtil
.
getApp
();
// 组织主页预览地址
String
indexPosition
=
app
.
getAppHostUrl
()
+
File
.
separator
+
ParserUtil
.
HTML
+
File
.
separator
+
app
.
getAppId
()
+
File
.
separator
+
position
+
ParserUtil
.
HTML_SUFFIX
;
return
"redirect:"
+
indexPosition
;
}
/**
* 用户预览主页
*
* @param request
* @return
*/
@RequestMapping
(
"/{position}/viewIndex"
)
public
String
viewIndex
(
HttpServletRequest
request
,
@PathVariable
String
position
,
HttpServletResponse
response
)
{
AppEntity
app
=
BasicUtil
.
getApp
();
// 组织主页预览地址
String
indexPosition
=
app
.
getAppHostUrl
()
+
File
.
separator
+
ParserUtil
.
HTML
+
File
.
separator
+
app
.
getAppId
()
+
File
.
separator
+
position
+
ParserUtil
.
HTML_SUFFIX
;
return
"redirect:"
+
indexPosition
;
}
}
src/main/java/net/mingsoft/cms/action/web/MCmsAction.java
View file @
50b1dd92
This diff is collapsed.
Click to expand it.
src/main/java/net/mingsoft/cms/bean/ContentBean.java
View file @
50b1dd92
...
...
@@ -37,13 +37,7 @@ public class ContentBean extends ContentEntity {
*/
private
String
noflag
;
// public String getStaticUrl() {
// return staticUrl;
// }
//
// public void setStaticUrl(String staticUrl) {
// this.staticUrl = staticUrl;
// }
public
String
getBeginTime
()
{
return
beginTime
;
...
...
src/main/java/net/mingsoft/cms/biz/impl/ContentBizImpl.java
View file @
50b1dd92
...
...
@@ -34,7 +34,6 @@ import net.mingsoft.cms.dao.ICategoryDao;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
net.mingsoft.cms.entity.ContentEntity
;
import
net.mingsoft.cms.util.CmsParserUtil
;
import
net.mingsoft.mdiy.bean.AttributeBean
;
import
net.mingsoft.mdiy.bean.PageBean
;
import
net.mingsoft.mdiy.entity.ModelEntity
;
import
net.mingsoft.mdiy.util.ParserUtil
;
...
...
@@ -122,7 +121,6 @@ public class ContentBizImpl extends BaseBizImpl<IContentDao, ContentEntity> imp
// 网站风格物理路径
List
<
CategoryBean
>
articleIdList
=
null
;
List
<
CategoryEntity
>
categoryList
=
null
;
AttributeBean
attributeBean
=
new
AttributeBean
();
ContentBean
contentBean
=
new
ContentBean
();
contentBean
.
setBeginTime
(
dateTime
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
...
@@ -145,12 +143,7 @@ public class ContentBizImpl extends BaseBizImpl<IContentDao, ContentEntity> imp
LOG
.
error
(
"模板不存在:{}"
,
category
.
getCategoryUrl
());
continue
;
}
// 获取文章列表表属性
ParserUtil
.
read
(
category
.
getCategoryListUrl
(),
map
,
page
,
attributeBean
);
contentBean
.
setFlag
(
attributeBean
.
getFlag
());
contentBean
.
setNoflag
(
attributeBean
.
getNoflag
());
contentBean
.
setOrder
(
attributeBean
.
getOrder
());
contentBean
.
setOrderBy
(
attributeBean
.
getOrderby
());
}
articleIdList
=
queryIdsByCategoryIdForParser
(
contentBean
);
// 有符合条件的就更新
...
...
@@ -190,13 +183,7 @@ public class ContentBizImpl extends BaseBizImpl<IContentDao, ContentEntity> imp
map
.
put
(
ParserUtil
.
HTML
,
ParserUtil
.
HTML
);
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
map
.
put
(
ParserUtil
.
PAGE
,
page
);
AttributeBean
attributeBean
=
new
AttributeBean
();
// 获取文章列表模板标签属性
ParserUtil
.
read
(
column
.
getCategoryListUrl
(),
map
,
page
,
attributeBean
);
contentBean
.
setFlag
(
attributeBean
.
getFlag
());
contentBean
.
setNoflag
(
attributeBean
.
getNoflag
());
contentBean
.
setOrder
(
attributeBean
.
getOrder
());
contentBean
.
setOrderBy
(
attributeBean
.
getOrderby
());
}
articleIdList
=
contentDao
.
queryIdsByCategoryIdForParser
(
contentBean
);
// 判断列表类型
...
...
@@ -242,7 +229,7 @@ public class ContentBizImpl extends BaseBizImpl<IContentDao, ContentEntity> imp
if
(
BasicUtil
.
getWebsiteApp
()
!=
null
){
map
.
put
(
ParserUtil
.
APP_ID
,
BasicUtil
.
getWebsiteApp
().
getAppId
());
}
String
read
=
ParserUtil
.
re
ad
(
templatePath
,
map
);
String
read
=
ParserUtil
.
re
ndering
(
templatePath
,
map
);
FileUtil
.
writeString
(
read
,
ParserUtil
.
buildHtmlPath
(
targetPath
),
net
.
mingsoft
.
base
.
constant
.
Const
.
UTF8
);
}
...
...
src/main/java/net/mingsoft/cms/entity/CategoryEntity.java
View file @
50b1dd92
...
...
@@ -391,14 +391,6 @@ private static final long serialVersionUID = 1574925152750L;
* 获取栏目图片 (标签使用)
*/
public
String
getTypelitpic
()
{
if
(
StrUtil
.
isNotBlank
(
categoryImg
)){
try
{
JSONArray
objects
=
JSON
.
parseArray
(
categoryImg
);
return
objects
.
getJSONObject
(
0
).
getString
(
"path"
);
}
catch
(
Exception
e
){
}
}
return
""
;
return
categoryImg
;
}
}
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java
View file @
50b1dd92
...
...
@@ -11,7 +11,6 @@ import net.mingsoft.basic.util.BasicUtil;
import
net.mingsoft.basic.util.SpringUtil
;
import
net.mingsoft.cms.bean.CategoryBean
;
import
net.mingsoft.cms.entity.CategoryEntity
;
import
net.mingsoft.mdiy.bean.AttributeBean
;
import
net.mingsoft.mdiy.bean.PageBean
;
import
net.mingsoft.mdiy.biz.IModelBiz
;
import
net.mingsoft.mdiy.biz.impl.ModelBizImpl
;
...
...
@@ -72,25 +71,36 @@ public class CmsParserUtil extends ParserUtil {
throws
TemplateNotFoundException
,
MalformedTemplateNameException
,
ParseException
,
IOException
{
try
{
// 文章的栏目模型编号
Integer
columnContentModelId
=
column
.
getMdiyModelId
();
PageBean
page
=
new
PageBean
();
page
.
setSize
(
10
);
//获取分页数量
//获取列表页显示的文章数量
//获取总数
//获取列表中的size
page
.
setSize
(
ParserUtil
.
getPageSize
(
column
.
getCategoryListUrl
(),
20
));
page
.
setRcount
(
articleIdTotal
);
int
totalPageSize
=
PageUtil
.
totalPage
(
articleIdTotal
,
page
.
getSize
());
page
.
setTotal
(
totalPageSize
);
//获取模板中列表标签中的条件
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
BasicUtil
.
getWebsiteApp
()
!=
null
)
{
map
.
put
(
ParserUtil
.
APP_ID
,
BasicUtil
.
getWebsiteApp
().
getAppId
());
}
map
.
put
(
ParserUtil
.
HTML
,
ParserUtil
.
HTML
);
map
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
map
.
put
(
ParserUtil
.
PAGE
,
page
);
String
columnListPath
;
ModelEntity
contentModel
=
null
;
// 判断当前栏目是否有自定义模型
if
(
column
Content
ModelId
!=
null
)
{
if
(
column
.
getMdiy
ModelId
()
!=
null
)
{
// 通过栏目模型编号获取自定义模型实体
contentModel
=
(
ModelEntity
)
SpringUtil
.
getBean
(
ModelBizImpl
.
class
).
getEntity
(
column
Content
ModelId
);
contentModel
=
(
ModelEntity
)
SpringUtil
.
getBean
(
ModelBizImpl
.
class
).
getEntity
(
column
.
getMdiy
ModelId
()
);
}
int
pageNo
=
1
;
//全局参数设置
Map
<
String
,
Object
>
parserParams
=
new
HashMap
<
String
,
Object
>();
parserParams
.
put
(
ParserUtil
.
PAGE
,
page
);
parserParams
.
put
(
COLUMN
,
column
);
//标签中使用field获取当前栏目
parserParams
.
put
(
FIELD
,
column
);
...
...
@@ -107,18 +117,15 @@ public class CmsParserUtil extends ParserUtil {
if
(
ParserUtil
.
IS_SINGLE
)
{
parserParams
.
put
(
ParserUtil
.
URL
,
BasicUtil
.
getUrl
());
}
parserParams
.
put
(
ParserUtil
.
PAGE
,
page
);
AttributeBean
attributeBean
=
new
AttributeBean
();
ParserUtil
.
read
(
File
.
separator
+
column
.
getCategoryListUrl
(),
parserParams
,
page
,
attributeBean
);
int
totalPageSize
=
PageUtil
.
totalPage
(
articleIdTotal
,
page
.
getSize
());
page
.
setTotal
(
totalPageSize
);
int
pageNo
=
1
;
//文章列表页没有写文章列表标签,总数为0
if
(
totalPageSize
<=
0
)
{
// 数据库中第一页是从开始0*size
columnListPath
=
ParserUtil
.
buildHtmlPath
(
column
.
getCategoryPath
()
+
File
.
separator
+
ParserUtil
.
INDEX
);
// 设置分页的起始位置
page
.
setPageNo
(
pageNo
);
String
read
=
ParserUtil
.
re
ad
(
File
.
separator
+
column
.
getCategoryListUrl
(),
parserParams
);
String
read
=
ParserUtil
.
re
ndering
(
File
.
separator
+
column
.
getCategoryListUrl
(),
parserParams
);
FileUtil
.
writeString
(
read
,
columnListPath
,
Const
.
UTF8
);
}
else
{
...
...
@@ -136,7 +143,7 @@ public class CmsParserUtil extends ParserUtil {
}
// 设置分页的起始位置
page
.
setPageNo
(
pageNo
);
String
read
=
ParserUtil
.
re
ad
(
File
.
separator
+
column
.
getCategoryListUrl
(),
parserParams
);
String
read
=
ParserUtil
.
re
ndering
(
File
.
separator
+
column
.
getCategoryListUrl
(),
parserParams
);
FileUtil
.
writeString
(
read
,
columnListPath
,
Const
.
UTF8
);
pageNo
++;
}
...
...
src/main/webapp/WEB-INF/manager/cms/content/form.ftl
View file @
50b1dd92
...
...
@@ -525,9 +525,9 @@
})
;
},
//根据封面获取当前文章
get
By
FengMian
:
function
(
categoryId
)
{
get
From
FengMian
:
function
(
categoryId
)
{
var
that
=
this
;
ms
.http.get
(
ms
.manager
+
"/cms/content/get
By
FengMian.do"
,
{
ms
.http.get
(
ms
.manager
+
"/cms/content/get
From
FengMian.do"
,
{
"categoryId"
:
categoryId
})
.then
(
function
(
res
)
{
if
(
res
.result
)
{
...
...
@@ -680,7 +680,7 @@
this
.get
(
this
.form.id
)
;
}
if
(
this
.type
)
{
this
.get
By
FengMian
(
this
.form.categoryId
)
;
this
.get
From
FengMian
(
this
.form.categoryId
)
;
this
.returnIsShow
=
false
;
}
}
...
...
src/main/webapp/WEB-INF/manager/cms/content/index.ftl
View file @
50b1dd92
...
...
@@ -122,7 +122,7 @@
#index .left-tree
{
min-height
:
100
vh
;
background
:
#
fff
;
width
:
18
0
px
;
width
:
22
0
px
;
border-right
:
solid
1
px
#
e6e6e6
;
}
...
...
src/main/webapp/WEB-INF/manager/cms/content/main.ftl
View file @
50b1dd92
...
...
@@ -68,7 +68,7 @@
</el-popover>
</template>
</el-table-column>
<el-table-column label="栏目名" align="left" prop="categoryId" :formatter="contentCategoryIdFormat" width="1
0
0">
<el-table-column label="栏目名" align="left" prop="categoryId" :formatter="contentCategoryIdFormat" width="1
8
0">
</el-table-column>
<el-table-column label="文章标题" align="left" prop="contentTitle" show-overflow-tooltip>
</el-table-column>
...
...
src/main/webapp/WEB-INF/manager/index.ftl
View file @
50b1dd92
...
...
@@ -328,7 +328,8 @@
})
if
(
sub
.syncStoreUrl
)
{
sub
.modelUrl
=
sub
.syncStoreUrl
//
sub
.modelUrl
=
"http://store.web.i.mingsoft.net/#/?client=localhost:8080//ms"
;
sub
.modelUrl
=
sub
.syncStoreUrl
;
sub
.modelTitle
=
'
mstore
';
sub
.isStore
=
true
;
!
result
?
this
.editableTabs.push
(
sub
)
:
""
...
...
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