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
36ff8a02
Commit
36ff8a02
authored
Sep 16, 2020
by
sgjj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生成优化
parent
8e36898a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
GeneraterAction.java
src/main/java/net/mingsoft/cms/action/GeneraterAction.java
+15
-18
No files found.
src/main/java/net/mingsoft/cms/action/GeneraterAction.java
View file @
36ff8a02
...
@@ -24,7 +24,10 @@ package net.mingsoft.cms.action;
...
@@ -24,7 +24,10 @@ 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
net.mingsoft.base.entity.ResultData
;
import
net.mingsoft.basic.annotation.LogAnn
;
import
net.mingsoft.basic.biz.IModelBiz
;
import
net.mingsoft.basic.biz.IModelBiz
;
import
net.mingsoft.basic.constant.e.BusinessTypeEnum
;
import
net.mingsoft.basic.entity.AppEntity
;
import
net.mingsoft.basic.entity.AppEntity
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.cms.bean.CategoryBean
;
import
net.mingsoft.cms.bean.CategoryBean
;
...
@@ -120,8 +123,9 @@ public class GeneraterAction extends BaseAction {
...
@@ -120,8 +123,9 @@ public class GeneraterAction extends BaseAction {
*/
*/
@RequestMapping
(
"/generateIndex"
)
@RequestMapping
(
"/generateIndex"
)
@RequiresPermissions
(
"cms:generate:index"
)
@RequiresPermissions
(
"cms:generate:index"
)
@LogAnn
(
title
=
"生成主页"
,
businessType
=
BusinessTypeEnum
.
UPDATE
)
@ResponseBody
@ResponseBody
public
void
generateIndex
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
ResultData
generateIndex
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
{
// 模版文件名称
// 模版文件名称
String
tmpFileName
=
request
.
getParameter
(
"url"
);
String
tmpFileName
=
request
.
getParameter
(
"url"
);
// 生成后的文件名称
// 生成后的文件名称
...
@@ -129,15 +133,10 @@ public class GeneraterAction extends BaseAction {
...
@@ -129,15 +133,10 @@ public class GeneraterAction extends BaseAction {
// 获取文件所在路径 首先判断用户输入的模版文件是否存在
// 获取文件所在路径 首先判断用户输入的模版文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
()))
{
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
()))
{
this
.
outJson
(
response
,
false
,
getResString
(
"templet.file"
));
return
ResultData
.
build
().
error
(
getResString
(
"templet.file"
));
}
else
{
}
else
{
try
{
CmsParserUtil
.
generate
(
tmpFileName
,
generateFileName
);
CmsParserUtil
.
generate
(
tmpFileName
,
generateFileName
);
this
.
outJson
(
response
,
true
);
return
ResultData
.
build
().
success
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
this
.
outJson
(
response
,
false
);
}
}
}
}
}
...
@@ -151,9 +150,10 @@ public class GeneraterAction extends BaseAction {
...
@@ -151,9 +150,10 @@ public class GeneraterAction extends BaseAction {
* @param CategoryId
* @param CategoryId
*/
*/
@RequestMapping
(
"/{CategoryId}/genernateColumn"
)
@RequestMapping
(
"/{CategoryId}/genernateColumn"
)
@LogAnn
(
title
=
"生成栏目"
,
businessType
=
BusinessTypeEnum
.
UPDATE
)
@RequiresPermissions
(
"cms:generate:column"
)
@RequiresPermissions
(
"cms:generate:column"
)
@ResponseBody
@ResponseBody
public
void
genernateColumn
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
int
CategoryId
)
{
public
ResultData
genernateColumn
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
int
CategoryId
)
throws
IOException
{
// 获取站点id
// 获取站点id
AppEntity
app
=
BasicUtil
.
getApp
();
AppEntity
app
=
BasicUtil
.
getApp
();
List
<
CategoryEntity
>
columns
=
new
ArrayList
<
CategoryEntity
>();
List
<
CategoryEntity
>
columns
=
new
ArrayList
<
CategoryEntity
>();
...
@@ -170,7 +170,6 @@ public class GeneraterAction extends BaseAction {
...
@@ -170,7 +170,6 @@ public class GeneraterAction extends BaseAction {
columns
=
categoryBiz
.
query
(
categoryEntity
);
columns
=
categoryBiz
.
query
(
categoryEntity
);
}
}
List
<
CategoryBean
>
articleIdList
=
null
;
List
<
CategoryBean
>
articleIdList
=
null
;
try
{
// 1、设置模板文件夹路径
// 1、设置模板文件夹路径
// 获取栏目列表模版
// 获取栏目列表模版
for
(
CategoryEntity
column
:
columns
)
{
for
(
CategoryEntity
column
:
columns
)
{
...
@@ -217,11 +216,8 @@ public class GeneraterAction extends BaseAction {
...
@@ -217,11 +216,8 @@ public class GeneraterAction extends BaseAction {
break
;
break
;
}
}
}
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
return
ResultData
.
build
().
success
();
this
.
outJson
(
response
,
false
);
}
this
.
outJson
(
response
,
true
);
}
}
/**
/**
...
@@ -233,8 +229,9 @@ public class GeneraterAction extends BaseAction {
...
@@ -233,8 +229,9 @@ public class GeneraterAction extends BaseAction {
*/
*/
@RequestMapping
(
"/{columnId}/generateArticle"
)
@RequestMapping
(
"/{columnId}/generateArticle"
)
@RequiresPermissions
(
"cms:generate:article"
)
@RequiresPermissions
(
"cms:generate:article"
)
@LogAnn
(
title
=
"生成文章"
,
businessType
=
BusinessTypeEnum
.
UPDATE
)
@ResponseBody
@ResponseBody
public
void
generateArticle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
String
columnId
)
throws
IOException
{
public
ResultData
generateArticle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
@PathVariable
String
columnId
)
throws
IOException
{
String
dateTime
=
request
.
getParameter
(
"dateTime"
);
String
dateTime
=
request
.
getParameter
(
"dateTime"
);
// 网站风格物理路径
// 网站风格物理路径
List
<
CategoryBean
>
articleIdList
=
null
;
List
<
CategoryBean
>
articleIdList
=
null
;
...
@@ -282,7 +279,7 @@ public class GeneraterAction extends BaseAction {
...
@@ -282,7 +279,7 @@ public class GeneraterAction extends BaseAction {
// 判断模板文件是否存在
// 判断模板文件是否存在
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
category
.
getCategoryUrl
())))
{
if
(!
FileUtil
.
exist
(
ParserUtil
.
buildTempletPath
(
category
.
getCategoryUrl
())))
{
LOG
.
error
(
"模板不存在:{}"
,
category
.
getCategoryUrl
());
LOG
.
error
(
"模板不存在:{}"
,
category
.
getCategoryUrl
());
return
;
return
ResultData
.
build
().
error
(
getResString
(
"templet.file"
))
;
}
}
ParserUtil
.
read
(
category
.
getCategoryListUrl
(),
map
,
page
,
attributeBean
);
ParserUtil
.
read
(
category
.
getCategoryListUrl
(),
map
,
page
,
attributeBean
);
contentBean
.
setFlag
(
attributeBean
.
getFlag
());
contentBean
.
setFlag
(
attributeBean
.
getFlag
());
...
@@ -296,7 +293,7 @@ public class GeneraterAction extends BaseAction {
...
@@ -296,7 +293,7 @@ public class GeneraterAction extends BaseAction {
CmsParserUtil
.
generateBasic
(
articleIdList
);
CmsParserUtil
.
generateBasic
(
articleIdList
);
}
}
}
}
this
.
outJson
(
response
,
true
);
return
ResultData
.
build
().
success
(
);
}
}
...
...
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