Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
cms_sys
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
西魏
cms_sys
Commits
5a74a045
Commit
5a74a045
authored
Dec 01, 2020
by
guwd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决文章与栏目生成时候,封面页面冲突问题
parent
1f64d605
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
38 deletions
+31
-38
GeneraterAction.java
src/main/java/net/mingsoft/cms/action/GeneraterAction.java
+28
-37
CmsParserUtil.java
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java
+3
-1
No files found.
src/main/java/net/mingsoft/cms/action/GeneraterAction.java
View file @
5a74a045
...
@@ -24,6 +24,8 @@ package net.mingsoft.cms.action;
...
@@ -24,6 +24,8 @@ package net.mingsoft.cms.action;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
cn.hutool.core.io.FileUtil
;
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.base.entity.ResultData
;
import
net.mingsoft.basic.annotation.LogAnn
;
import
net.mingsoft.basic.annotation.LogAnn
;
import
net.mingsoft.basic.biz.IModelBiz
;
import
net.mingsoft.basic.biz.IModelBiz
;
...
@@ -61,12 +63,10 @@ import java.util.List;
...
@@ -61,12 +63,10 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
*
* @ClassName: GeneraterAction
* @ClassName: GeneraterAction
* @Description:TODO 生成器
* @Description:TODO 生成器
* @author: 铭飞开发团队
* @author: 铭飞开发团队
* @date: 2018年1月31日 下午2:52:07
* @date: 2018年1月31日 下午2:52:07
*
* @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
* @Copyright: 2018 www.mingsoft.net Inc. All rights reserved.
*/
*/
@Controller
(
"cmsGenerater"
)
@Controller
(
"cmsGenerater"
)
...
@@ -101,10 +101,7 @@ public class GeneraterAction extends BaseAction {
...
@@ -101,10 +101,7 @@ public class GeneraterAction extends BaseAction {
private
String
managerPath
;
private
String
managerPath
;
/**
/**
* /**
/**
* 更新主页
* 更新主页
*
*
* @return
* @return
...
@@ -182,11 +179,11 @@ public class GeneraterAction extends BaseAction {
...
@@ -182,11 +179,11 @@ public class GeneraterAction extends BaseAction {
//TODO 暂时先用字符串代替
//TODO 暂时先用字符串代替
case
"1"
:
// 列表
case
"1"
:
// 列表
// 判断模板文件是否存在
// 判断模板文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
column
.
getCategoryListUrl
())))
{
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
column
.
getCategoryListUrl
())))
{
LOG
.
error
(
"模板不存在:{}"
,
column
.
getCategoryUrl
());
LOG
.
error
(
"模板不存在:{}"
,
column
.
getCategoryUrl
());
continue
;
continue
;
}
}
CmsParserUtil
.
generateList
(
column
,
articleIdList
.
size
());
CmsParserUtil
.
generateList
(
column
,
articleIdList
.
size
());
break
;
break
;
...
@@ -221,7 +218,7 @@ public class GeneraterAction extends BaseAction {
...
@@ -221,7 +218,7 @@ public class GeneraterAction extends BaseAction {
String
dateTime
=
request
.
getParameter
(
"dateTime"
);
String
dateTime
=
request
.
getParameter
(
"dateTime"
);
// 网站风格物理路径
// 网站风格物理路径
List
<
CategoryBean
>
articleIdList
=
null
;
List
<
CategoryBean
>
articleIdList
=
null
;
List
<
CategoryEntity
>
categoryList
=
n
ull
;
List
<
CategoryEntity
>
categoryList
=
n
ew
ArrayList
<
CategoryEntity
>()
;
ContentBean
contentBean
=
new
ContentBean
();
ContentBean
contentBean
=
new
ContentBean
();
contentBean
.
setBeginTime
(
dateTime
);
contentBean
.
setBeginTime
(
dateTime
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
@@ -234,44 +231,38 @@ public class GeneraterAction extends BaseAction {
...
@@ -234,44 +231,38 @@ public class GeneraterAction extends BaseAction {
map
.
put
(
ParserUtil
.
PAGE
,
page
);
map
.
put
(
ParserUtil
.
PAGE
,
page
);
// 生成所有栏目的文章
// 生成所有栏目的文章
if
(
"0"
.
equals
(
columnId
))
{
if
(
"0"
.
equals
(
columnId
))
{
CategoryEntity
categoryEntity
=
new
CategoryEntity
();
categoryList
=
categoryBiz
.
list
(
Wrappers
.<
CategoryEntity
>
lambdaQuery
()
categoryList
=
categoryBiz
.
query
(
categoryEntity
);
.
isNull
(
CategoryEntity:
:
getCategoryParentId
));
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
{
}
else
{
CategoryEntity
category
=
(
CategoryEntity
)
categoryBiz
.
getById
(
columnId
);
CategoryEntity
category
=
(
CategoryEntity
)
categoryBiz
.
getById
(
columnId
);
contentBean
.
setCategoryId
(
columnId
);
categoryList
.
add
(
category
);
}
for
(
CategoryEntity
category
:
categoryList
)
{
contentBean
.
setCategoryId
(
category
.
getId
());
//将文章列表标签中的中的参数
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
// 分类是列表
// 分类是列表
if
(
category
.
getCategoryType
().
equals
(
"1"
))
{
if
(
category
.
getCategoryType
().
equals
(
"1"
))
{
// 获取文章列表表属性
// 判断模板文件是否存在
// 判断模板文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
category
.
getCategory
Url
()
)))
{
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
category
.
getCategory
ListUrl
()))
||
StringUtils
.
isEmpty
(
category
.
getCategoryListUrl
(
)))
{
LOG
.
error
(
"模板不存在:{}"
,
category
.
getCategoryUrl
());
LOG
.
error
(
"模板不存在:{}"
,
category
.
getCategoryUrl
());
return
ResultData
.
build
().
error
(
getResString
(
"templet.file"
))
;
continue
;
}
}
}
else
if
(
category
.
getCategoryType
().
equals
(
"2"
))
{
CategoryBean
columnArticleIdBean
=
new
CategoryBean
();
CopyOptions
copyOptions
=
CopyOptions
.
create
();
copyOptions
.
setIgnoreError
(
true
);
BeanUtil
.
copyProperties
(
category
,
columnArticleIdBean
,
copyOptions
);
articleIdList
.
add
(
columnArticleIdBean
);
}
}
articleIdList
=
contentBiz
.
queryIdsByCategoryIdForParser
(
contentBean
);
// 有符合条件的就更新
// 有符合条件的就更新
if
(
articleIdList
.
size
()
>
0
)
{
if
(
articleIdList
.
size
()
>
0
)
{
CmsParserUtil
.
generateBasic
(
articleIdList
);
CmsParserUtil
.
generateBasic
(
articleIdList
);
}
}
}
}
return
ResultData
.
build
().
success
();
return
ResultData
.
build
().
success
();
}
}
...
...
src/main/java/net/mingsoft/cms/util/CmsParserUtil.java
View file @
5a74a045
...
@@ -192,6 +192,7 @@ public class CmsParserUtil extends ParserUtil {
...
@@ -192,6 +192,7 @@ public class CmsParserUtil extends ParserUtil {
if
(
articleIdList
.
get
(
artId
).
getMdiyModelId
()
!=
null
&&
articleIdList
.
get
(
artId
).
getMdiyModelId
()
>
0
){
if
(
articleIdList
.
get
(
artId
).
getMdiyModelId
()
!=
null
&&
articleIdList
.
get
(
artId
).
getMdiyModelId
()
>
0
){
columnContentModelId
=
articleIdList
.
get
(
artId
).
getMdiyModelId
();
columnContentModelId
=
articleIdList
.
get
(
artId
).
getMdiyModelId
();
}
}
// 文章是否已经生成了,生成了就跳过
// 文章是否已经生成了,生成了就跳过
if
(
generateIds
.
contains
(
articleId
))
{
if
(
generateIds
.
contains
(
articleId
))
{
artId
++;
artId
++;
...
@@ -208,10 +209,11 @@ public class CmsParserUtil extends ParserUtil {
...
@@ -208,10 +209,11 @@ public class CmsParserUtil extends ParserUtil {
//如果是封面就生成index.html
//如果是封面就生成index.html
if
(
Integer
.
parseInt
(
articleIdList
.
get
(
artId
).
getCategoryType
())
==
COLUMN_TYPE_COVER
)
{
if
(
Integer
.
parseInt
(
articleIdList
.
get
(
artId
).
getCategoryType
())
==
COLUMN_TYPE_COVER
)
{
writePath
=
ParserUtil
.
buildHtmlPath
(
articleColumnPath
+
File
.
separator
+
ParserUtil
.
INDEX
);
writePath
=
ParserUtil
.
buildHtmlPath
(
articleColumnPath
+
File
.
separator
+
ParserUtil
.
INDEX
);
}
else
{
}
else
{
// 组合文章路径如:html/站点id/栏目id/文章id.html
// 组合文章路径如:html/站点id/栏目id/文章id.html
writePath
=
ParserUtil
.
buildHtmlPath
(
articleColumnPath
+
File
.
separator
+
articleId
);
writePath
=
ParserUtil
.
buildHtmlPath
(
articleColumnPath
+
File
.
separator
+
articleId
);
}
}
Map
<
String
,
Object
>
parserParams
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
parserParams
=
new
HashMap
<
String
,
Object
>();
parserParams
.
put
(
ParserUtil
.
COLUMN
,
articleIdList
.
get
(
artId
));
parserParams
.
put
(
ParserUtil
.
COLUMN
,
articleIdList
.
get
(
artId
));
// 判断当前栏目是否有自定义模型
// 判断当前栏目是否有自定义模型
...
...
Write
Preview
Markdown
is supported
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