Helius
2022-07-08 cd906c6c82dd28dbf1c53b03d382a5b14d67bb4a
src/main/java/com/xcong/farmer/cms/modules/system/service/Impl/ReleaseServiceImpl.java
@@ -40,8 +40,7 @@
    private final Executor executor = new ThreadPoolExecutor(5, 10, 600, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
    @Override
    public void releaseArticle(Long id) {
        Long companyId = LoginUserUtil.getCompanyId();
    public void releaseArticle(Long id, Long companyId) {
        ArticleEntity article = articleMapper.selectById(id);
        ColumnEntity column = columnMapper.selectById(article.getColumnId());
@@ -50,18 +49,18 @@
        data.put("companyId", companyId);
        executor.execute(()->{
            log.info("执行文章发布");
            cmsCoreService.articleProcess(data, column.getArticleTemplate(), column.getPath());
            this.releaseColumn(column.getId(), 1);
            this.releaseColumn(column.getId(), 1, companyId);
            if (column.getParentId() != 0L) {
                releaseColumn(column.getParentId(), 1);
                releaseColumn(column.getParentId(), 1, companyId);
            }
            this.releaseIndex();
            this.releaseIndex(companyId);
        });
    }
    @Override
    public void releaseColumn(Long id, int type) {
        Long companyId = LoginUserUtil.getCompanyId();
    public void releaseColumn(Long id, int type, Long companyId) {
        ColumnEntity columnEntity = columnMapper.selectById(id);
        Map<String, Object> map = new HashMap<>();
        map.put("id", columnEntity.getId());
@@ -78,7 +77,7 @@
        if (type != 1) {
            executor.execute(() -> {
                if (columnEntity.getParentId() == 0L) {
                    List<ColumnEntity> columns = columnMapper.selectColumnByParentId(columnEntity.getParentId(), companyId);
                    List<ColumnEntity> columns = columnMapper.selectColumnByParentId(columnEntity.getParentId(), companyId, 2);
                    if (CollUtil.isNotEmpty(columns)) {
                        for (ColumnEntity column : columns) {
                            map.put("id", column.getId());
@@ -93,20 +92,19 @@
                List<Long> ids = articleMapper.selectArticleIdsByColumnId(columnEntity.getId(), companyId, type);
                cmsCoreService.articlesProcess(map, ids, columnEntity.getArticleTemplate(), columnEntity.getPath());
                releaseIndex();
                releaseIndex(companyId);
            });
            executor.execute(() -> {
                cmsCoreService.columnProcess(map, columnEntity.getListTemplate());
                releaseIndex();
                releaseIndex(companyId);
            });
        }
    }
    @Override
    public void releaseIndex() {
    public void releaseIndex(Long companyId) {
        Map<String, Object> map = new HashMap<>();
        Long companyId = LoginUserUtil.getCompanyId();
        map.put("companyId", companyId);
        cmsCoreService.indexProcess(map, null);