fix
Helius
2022-08-07 885e0a453347479d8fd9c3ea41747ffc28d51a5b
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ReleaseServiceImpl.java
@@ -1,5 +1,6 @@
package com.xcong.farmer.cms.modules.system.service.Impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.io.FileUtil;
import com.xcong.farmer.cms.common.utils.FileUtils;
@@ -54,41 +55,6 @@
    @Autowired
    private WebSetMapper webSetMapper;
    private final Executor executor = new ThreadPoolExecutor(5, 20, 600, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
//    @Override
//    public void releaseArticle(Long id, Long companyId) {
//        ArticleEntity article = articleMapper.selectById(id);
//        ColumnEntity column = columnMapper.selectById(article.getColumnId());
//
//        Long beforeColumnId = article.getBeforeColumnId();
//        article.setBeforeColumnId(-1L);
//        articleMapper.updateById(article);
//
//        Map<String, Object> data = new Hashtable<>();
//        data.put("id", article.getId());
//        data.put("companyId", companyId);
//
//        executor.execute(() -> {
//            log.info("执行文章发布");
//            cmsCoreService.articleProcess(data, column.getArticleTemplate(), column.getPath());
//            this.releaseColumn(column.getId(), 1, companyId);
//            if (column.getParentId() != 0L) {
//                releaseColumn(column.getParentId(), 1, companyId);
//            }
//
//            if (beforeColumnId != null && !article.getColumnId().equals(beforeColumnId)) {
//                ColumnEntity beforeColumn = columnMapper.selectById(beforeColumnId);
//                this.releaseColumn(beforeColumnId, 1, companyId);
//                if (beforeColumn.getParentId() != 0L) {
//                    this.releaseColumn(beforeColumn.getParentId(), 1, companyId);
//                }
//            }
//
//            this.releaseIndex(companyId, false);
//        });
//    }
    @Override
    public void releaseArticle(Long id, Long companyId) {
@@ -159,8 +125,10 @@
                }
                if (article.getType() == 1) {
                    map.put("id", article.getId());
                    cmsCoreService.articleProcess(map, columnEntity.getArticleTemplate(), columnEntity.getPath());
                    Map<String, Object> articleMap = new HashMap<>();
                    BeanUtil.copyProperties(map, articleMap);
                    articleMap.put("id", article.getId());
                    cmsCoreService.articleProcess(articleMap, columnEntity.getArticleTemplate(), columnEntity.getPath());
                }
            }
        }
@@ -245,8 +213,14 @@
        cmsCoreService.indexProcess(map, webSetting.getIndexTemplate());
        if (hasSearch) {
            cmsCoreService.process(map, "search", webSetting.getSearchTemplate());
            cmsCoreService.process(map, "message", webSetting.getMsgTemplate());
            Map<String, Object> search = new HashMap<>();
            search.put("companyId", companyId);
            Map<String, Object> message = new HashMap<>();
            message.put("companyId", companyId);
            cmsCoreService.process(search, "search", webSetting.getSearchTemplate());
            cmsCoreService.process(message, "message", webSetting.getMsgTemplate());
        }
    }