Преглед на файлове

5.2.6 修复单篇生成问题

msgroup преди 3 години
родител
ревизия
ecd245b793
променени са 1 файла, в които са добавени 15 реда и са изтрити 24 реда
  1. 15 24
      src/main/java/net/mingsoft/cms/action/GeneraterAction.java

+ 15 - 24
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;
     }