From ecd245b79341ce7ddded1c46e1462bc153a4c78e Mon Sep 17 00:00:00 2001 From: msgroup Date: Thu, 10 Feb 2022 16:44:33 +0800 Subject: [PATCH] =?UTF-8?q?5.2.6=20=E4=BF=AE=E5=A4=8D=E5=8D=95=E7=AF=87?= =?UTF-8?q?=E7=94=9F=E6=88=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mingsoft/cms/action/GeneraterAction.java | 39 +++++++------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/src/main/java/net/mingsoft/cms/action/GeneraterAction.java b/src/main/java/net/mingsoft/cms/action/GeneraterAction.java index 65cd0726..90cb0e0a 100755 --- a/src/main/java/net/mingsoft/cms/action/GeneraterAction.java +++ b/src/main/java/net/mingsoft/cms/action/GeneraterAction.java @@ -119,7 +119,7 @@ public class GeneraterAction extends BaseAction { * @param request * @param response */ - @RequestMapping(value="/generateIndex",method = {RequestMethod.GET, RequestMethod.POST}) + @RequestMapping(value = "/generateIndex", method = {RequestMethod.GET, RequestMethod.POST}) @RequiresPermissions("cms:generate:index") @LogAnn(title = "生成主页", businessType = BusinessTypeEnum.UPDATE) @ResponseBody @@ -134,7 +134,7 @@ public class GeneraterAction extends BaseAction { return ResultData.build().error(getResString("templet.file")); } else { - CmsParserUtil.generate(tmpFileName, generateFileName,htmlDir); + CmsParserUtil.generate(tmpFileName, generateFileName, htmlDir); return ResultData.build().success(); } } @@ -147,7 +147,7 @@ public class GeneraterAction extends BaseAction { * @param response * @param categoryId */ - @RequestMapping(value="/{categoryId}/genernateColumn",method = {RequestMethod.GET, RequestMethod.POST}) + @RequestMapping(value = "/{categoryId}/genernateColumn", method = {RequestMethod.GET, RequestMethod.POST}) @LogAnn(title = "生成栏目", businessType = BusinessTypeEnum.UPDATE) @RequiresPermissions("cms:generate:column") @ResponseBody @@ -173,7 +173,7 @@ public class GeneraterAction extends BaseAction { // 获取栏目列表模版 for (CategoryEntity column : columns) { //如果是链接就跳过生成 - if(column.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) { + if (column.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) { continue; } ContentBean contentBean = new ContentBean(); @@ -187,17 +187,17 @@ public class GeneraterAction extends BaseAction { // 判断模板文件是否存在 if (StringUtils.isEmpty(column.getCategoryListUrl()) || !FileUtil.exist(ParserUtil.buildTemplatePath(column.getCategoryListUrl()))) { - LOG.error("{} 模板不存在:{}", column.getCategoryTitle(),column.getCategoryUrl()); + LOG.error("{} 模板不存在:{}", column.getCategoryTitle(), column.getCategoryUrl()); continue; } - CmsParserUtil.generateList(column, articleIdList.size(),htmlDir); + CmsParserUtil.generateList(column, articleIdList.size(), htmlDir); break; case COVER:// 单页 // 判断模板文件是否存在 if (StringUtils.isEmpty(column.getCategoryUrl()) || !FileUtil.exist(ParserUtil.buildTemplatePath(column.getCategoryUrl()))) { - LOG.error("{} 模板不存在:{}", column.getCategoryTitle(),column.getCategoryUrl()); + LOG.error("{} 模板不存在:{}", column.getCategoryTitle(), column.getCategoryUrl()); continue; } @@ -208,7 +208,7 @@ public class GeneraterAction extends BaseAction { BeanUtil.copyProperties(column, columnArticleIdBean, copyOptions); articleIdList.add(columnArticleIdBean); } - CmsParserUtil.generateBasic(articleIdList,htmlDir); + CmsParserUtil.generateBasic(articleIdList, htmlDir); break; } } @@ -223,7 +223,7 @@ public class GeneraterAction extends BaseAction { * @param response * @param columnId */ - @RequestMapping(value="/{columnId}/generateArticle",method = {RequestMethod.GET, RequestMethod.POST}) + @RequestMapping(value = "/{columnId}/generateArticle", method = {RequestMethod.GET, RequestMethod.POST}) @RequiresPermissions("cms:generate:article") @LogAnn(title = "生成文章", businessType = BusinessTypeEnum.UPDATE) @ResponseBody @@ -245,7 +245,7 @@ public class GeneraterAction extends BaseAction { for (CategoryEntity category : categoryList) { //如果是链接就跳过生成 - if(category.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) { + if (category.getCategoryType().equals(CategoryTypeEnum.LINK.toString())) { continue; } contentBean.setCategoryId(category.getId()); @@ -256,24 +256,15 @@ public class GeneraterAction extends BaseAction { if (category.getCategoryType().equals(CategoryTypeEnum.LIST.toString())) { // 判断模板文件是否存在 if (!FileUtil.exist(ParserUtil.buildTemplatePath(category.getCategoryListUrl())) || StringUtils.isEmpty(category.getCategoryListUrl())) { - LOG.error("{} 模板不存在:{}", category.getCategoryTitle(),category.getCategoryListUrl()); + LOG.error("{} 模板不存在:{}", category.getCategoryTitle(), category.getCategoryListUrl()); continue; } } else if (category.getCategoryType().equals(CategoryTypeEnum.COVER.toString())) { - // 判断模板文件是否存在 - if (!FileUtil.exist(ParserUtil.buildTemplatePath(category.getCategoryListUrl())) || StringUtils.isEmpty(category.getCategoryListUrl())) { - LOG.error("{} 模板不存在:{}", category.getCategoryTitle(),category.getCategoryListUrl()); - continue; - } - CategoryBean columnArticleIdBean = new CategoryBean(); - CopyOptions copyOptions = CopyOptions.create(); - copyOptions.setIgnoreError(true); - BeanUtil.copyProperties(category, columnArticleIdBean, copyOptions); - articleIdList.add(columnArticleIdBean); + continue; } // 有符合条件的就更新 if (articleIdList.size() > 0) { - CmsParserUtil.generateBasic(articleIdList,htmlDir); + CmsParserUtil.generateBasic(articleIdList, htmlDir); } } @@ -288,11 +279,11 @@ public class GeneraterAction extends BaseAction { * @param request * @return */ - @RequestMapping(value="/{position}/viewIndex",method = {RequestMethod.GET, RequestMethod.POST}) + @RequestMapping(value = "/{position}/viewIndex", method = {RequestMethod.GET, RequestMethod.POST}) public String viewIndex(HttpServletRequest request, @PathVariable String position, HttpServletResponse response) { AppEntity app = BasicUtil.getApp(); // 组织主页预览地址 - String indexPosition = app.getAppHostUrl() + htmlDir+ File.separator + app.getAppDir() + String indexPosition = app.getAppHostUrl() + htmlDir + File.separator + app.getAppDir() + File.separator + position + ParserUtil.HTML_SUFFIX; return "redirect:" + indexPosition; }