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
70393e19
Commit
70393e19
authored
Oct 24, 2020
by
xierz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
任务调度静态化
parent
e1544f09
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
11 deletions
+17
-11
ContentBizImpl.java
src/main/java/net/mingsoft/cms/biz/impl/ContentBizImpl.java
+17
-11
No files found.
src/main/java/net/mingsoft/cms/biz/impl/ContentBizImpl.java
View file @
70393e19
...
...
@@ -98,14 +98,16 @@ public class ContentBizImpl extends BaseBizImpl implements IContentBiz {
* 任务调度静态化任务
*/
public
void
staticizeTask
(
Integer
appId
,
String
tmpFileName
,
String
generateFileName
)
{
Date
now
=
new
Date
();
LOG
.
info
(
"定时静态化任务"
,
now
);
//生成栏目,更新所有栏目
LOG
.
info
(
"定时静态化任务"
,
new
Date
());
try
{
//将任务采集传过来的appId导入到线程变量中
//当前线程使用appId时优先使用此数据
DataHolder
.
set
(
ParserUtil
.
APP_ID
,
appId
);
//调用三种静态化
genernateColumn
();
generaterIndex
(
tmpFileName
,
generateFileName
);
generateArticle
(
DateUtil
.
format
(
now
,
"yyyy-MM-dd"
));
//生成文章日期默认为执行日期的上一天
generateArticle
(
DateUtil
.
format
(
DateUtil
.
yesterday
(),
"yyyy-MM-dd"
));
LOG
.
info
(
"静态化完成"
,
new
Date
());
}
catch
(
IOException
e
)
{
LOG
.
info
(
"静态化失败"
,
new
Date
());
...
...
@@ -113,7 +115,9 @@ public class ContentBizImpl extends BaseBizImpl implements IContentBiz {
}
}
//文章
/*
* 生成文章逻辑
*/
private
void
generateArticle
(
String
dateTime
)
throws
IOException
{
// 网站风格物理路径
List
<
CategoryBean
>
articleIdList
=
null
;
...
...
@@ -154,13 +158,14 @@ public class ContentBizImpl extends BaseBizImpl implements IContentBiz {
}
}
//栏目
/*
* 生成栏目逻辑
*/
private
void
genernateColumn
()
throws
IOException
{
List
<
CategoryEntity
>
columns
=
new
ArrayList
<>();
// 获取所有的内容管理栏目
CategoryEntity
categoryEntity
=
new
CategoryEntity
();
Integer
appId
=
(
Integer
)
DataHolder
.
get
(
ParserUtil
.
APP_ID
);
categoryEntity
.
setAppId
(
appId
);
categoryEntity
.
setAppId
(
BasicUtil
.
getAppId
());
columns
=
categoryDao
.
query
(
categoryEntity
);
List
<
CategoryBean
>
articleIdList
=
null
;
// 1、设置模板文件夹路径
...
...
@@ -211,13 +216,14 @@ public class ContentBizImpl extends BaseBizImpl implements IContentBiz {
}
}
//主页
/*
* 生成主页逻辑
*/
private
void
generaterIndex
(
String
templatePath
,
String
targetPath
)
throws
IOException
{
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
()))
{
LOG
.
info
(
"模板文件不存在"
);
return
;
}
Integer
appId
=
(
Integer
)
DataHolder
.
get
(
ParserUtil
.
APP_ID
);
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
ParserUtil
.
IS_DO
,
false
);
CategoryEntity
column
=
new
CategoryEntity
();
...
...
@@ -230,7 +236,7 @@ public class ContentBizImpl extends BaseBizImpl implements IContentBiz {
//设置生成的路径
map
.
put
(
ParserUtil
.
HTML
,
ParserUtil
.
HTML
);
//设置站点编号
map
.
put
(
ParserUtil
.
APP_ID
,
appId
);
map
.
put
(
ParserUtil
.
APP_ID
,
BasicUtil
.
getAppId
()
);
String
read
=
ParserUtil
.
read
(
templatePath
,
map
);
FileUtil
.
writeString
(
read
,
ParserUtil
.
buildHtmlPath
(
targetPath
),
Const
.
UTF8
);
}
...
...
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