| | |
| | | |
| | | import com.xcong.farmer.cms.core.node.PartNode; |
| | | import com.xcong.farmer.cms.core.node.Template; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jsoup.nodes.Document; |
| | | |
| | | import java.io.File; |
| | |
| | | * @author wzy |
| | | * @date 2022-07-01 |
| | | **/ |
| | | @Slf4j |
| | | public class TemplateConfiguration extends Configuration{ |
| | | |
| | | private TemplateLoader templateLoader; |
| | |
| | | throw new RuntimeException("TemplateLoader do not able to be null"); |
| | | } |
| | | |
| | | log.info("解析开始执行--#类型:{}#--#模板名称:{}#--#ID:{}#", map.get("templateType"), templateName, map.get("id")); |
| | | this.templateLoader.data(map); |
| | | Template template = template(templateName); |
| | | template.output(outputPath); |
| | |
| | | |
| | | @Override |
| | | public void indexProcess(@NotNull Map<String, Object> data, String templateName) { |
| | | data.put("templateType", "index"); |
| | | if (StrUtil.isEmpty(templateName)) { |
| | | templateName = "index.html"; |
| | | } |
| | |
| | | map.put("templatePath", columnEntity.getPath()); |
| | | map.put("companyId", companyId); |
| | | |
| | | executor.execute(() -> { |
| | | cmsCoreService.columnProcess(map, columnEntity.getListTemplate()); |
| | | releaseIndex(companyId); |
| | | }); |
| | | |
| | | if (type != 1) { |
| | | executor.execute(() -> { |
| | | if (columnEntity.getParentId() == 0L) { |
| | | List<ColumnEntity> columns = columnMapper.selectColumnByParentId(columnEntity.getParentId(), companyId, 2); |
| | | List<ColumnEntity> columns = columnMapper.selectColumnByParentId(columnEntity.getId(), companyId, 2); |
| | | if (CollUtil.isNotEmpty(columns)) { |
| | | for (ColumnEntity column : columns) { |
| | | map.put("id", column.getId()); |
| | |
| | | List<Long> ids = articleMapper.selectArticleIdsByColumnId(columnEntity.getId(), companyId, type); |
| | | cmsCoreService.articlesProcess(map, ids, columnEntity.getArticleTemplate(), columnEntity.getPath()); |
| | | |
| | | releaseIndex(companyId); |
| | | }); |
| | | |
| | | executor.execute(() -> { |
| | | cmsCoreService.columnProcess(map, columnEntity.getListTemplate()); |
| | | releaseIndex(companyId); |
| | | }); |
| | | } |