Merge branch 'master' of http://120.27.238.55:7000/r/farmer-cms
 
	
	
	
	
	
	
		
		5 files modified
	
		
		1 files added
	
	
 
	
	
	
	
	
	
	
	
 |  |  | 
 |  |  |      * @param id | 
 |  |  |      * @param templateName | 
 |  |  |      */ | 
 |  |  |     void articleProcess(Long id, String templateName, String templatPath); | 
 |  |  |     void articleProcess(Map<String, Object> data, String templateName, String templatePath); | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 栏目编译 | 
 |  |  | 
 |  |  |      * @param templateName 模板名称 | 
 |  |  |      * @param columnOnly 是否只编译当前栏目列表页(如果false,则会编译栏目下所有子栏目或者所有文章) | 
 |  |  |      */ | 
 |  |  |     void columnProcess(Map<String, Object> map, String templateName, boolean columnOnly); | 
 |  |  |     void columnProcess(Map<String, Object> map, String templateName); | 
 |  |  |  | 
 |  |  |     void indexProcess(Map<String, Object> map, String templateName); | 
 |  |  |  | 
 
 |  |  | 
 |  |  | import javax.validation.constraints.NotNull; | 
 |  |  | import java.util.HashMap; | 
 |  |  | import java.util.Map; | 
 |  |  | import java.util.concurrent.Executor; | 
 |  |  | import java.util.concurrent.LinkedBlockingQueue; | 
 |  |  | import java.util.concurrent.ThreadPoolExecutor; | 
 |  |  | import java.util.concurrent.TimeUnit; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @author wzy | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private TemplateConfiguration cfg; | 
 |  |  |     private final Executor executor = new ThreadPoolExecutor(5, 10, 600, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void articleProcess(Long id, String templateName, String templatePath) { | 
 |  |  |         Map<String, Object> data = new HashMap<>(); | 
 |  |  |         data.put("id", id); | 
 |  |  |         data.put("companyId", 23L); | 
 |  |  |     public void articleProcess(Map<String, Object> data, String templateName, String templatePath) { | 
 |  |  |         data.put("templateType", "article"); | 
 |  |  |         data.put("templatePath", templatePath); | 
 |  |  |         data.put("templateName", id); | 
 |  |  |         data.put("templateName", data.get("id")); | 
 |  |  |         if (StrUtil.isEmpty(templateName)) { | 
 |  |  |             templateName = "defualt.artile.html"; | 
 |  |  |         } | 
 |  |  |         cfg.process(data, templateName); | 
 |  |  |  | 
 |  |  |         String finalTemplateName = templateName; | 
 |  |  |         executor.execute(() -> cfg.process(data, finalTemplateName)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void columnProcess(Map<String, Object> data, String templateName, boolean article) { | 
 |  |  |         data.put("companyId", 23L); | 
 |  |  |     public void columnProcess(Map<String, Object> data, String templateName) { | 
 |  |  |         data.put("templateType", "column"); | 
 |  |  |         data.put("page", 1); | 
 |  |  |         if (StrUtil.isEmpty(templateName)) { | 
 |  |  |             templateName = "defualt.list.html"; | 
 |  |  |         } | 
 |  |  |         cfg.process(data, templateName); | 
 |  |  |  | 
 |  |  |         String finalTemplateName = templateName; | 
 |  |  |         executor.execute(() -> cfg.process(data, finalTemplateName)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  | 
 |  |  |             templateName = "index.html"; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         data.put("companyId", 23L); | 
 |  |  |         cfg.process(data, templateName); | 
 |  |  |         String finalTemplateName = templateName; | 
 |  |  |         executor.execute(() -> cfg.process(data, finalTemplateName)); | 
 |  |  |     } | 
 |  |  | } | 
 
 |  |  | 
 |  |  | import io.swagger.annotations.ApiResponse; | 
 |  |  | import io.swagger.annotations.ApiResponses; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.apache.ibatis.annotations.Param; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | import javax.annotation.Resource; | 
 |  |  | 
 |  |  |         return iColumnService.delObjs(adminDeleteDto); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "发布栏目", notes = "发布栏目") | 
 |  |  |     @PostMapping(value = "/release") | 
 |  |  |     public Result release(@RequestBody ReleaseColumnDto releaseColumnDto) { | 
 |  |  |         return Result.ok("发布成功"); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "网页栏目列表", notes = "网页栏目列表") | 
 |  |  |     @ApiResponses({@ApiResponse(code = 200, message = "ok", response = WebColumnVo.class)}) | 
 |  |  |     @GetMapping(value = "/webColumnInList") | 
 
| New file | 
 |  |  | 
 |  |  | package com.xcong.farmer.cms.modules.system.dto; | 
 |  |  |  | 
 |  |  | import io.swagger.annotations.ApiModel; | 
 |  |  | import io.swagger.annotations.ApiModelProperty; | 
 |  |  | import lombok.Data; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @author wzy | 
 |  |  |  * @date 2022-07-07 | 
 |  |  |  **/ | 
 |  |  | @Data | 
 |  |  | @ApiModel(value = "ReleaseColumnDto", description = "发布栏目接收参数类") | 
 |  |  | public class ReleaseColumnDto { | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "栏目ID", example = "1") | 
 |  |  |     private Long id; | 
 |  |  |  | 
 |  |  |     @ApiModelProperty(value = "是否编译子栏目和栏目下所有文章 1-是 ,2-否", example = "1") | 
 |  |  |     private Integer type; | 
 |  |  | } | 
 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private ICmsCoreService cmsCoreService; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Result getArticleInPage(AdminArticleDto adminArticleDto) { | 
 |  |  |         UserEntity userlogin = LoginUserUtil.getLoginUser(); | 
 
 |  |  | 
 |  |  | import com.xcong.farmer.cms.modules.system.mapper.ArticleMapper; | 
 |  |  | import com.xcong.farmer.cms.modules.system.mapper.ColumnMapper; | 
 |  |  | import com.xcong.farmer.cms.modules.system.service.IReleaseService; | 
 |  |  | import com.xcong.farmer.cms.modules.system.util.LoginUserUtil; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void releaseArticle(Long id) { | 
 |  |  |         Long companyId = LoginUserUtil.getCompanyId(); | 
 |  |  |         ArticleEntity article = articleMapper.selectById(id); | 
 |  |  |  | 
 |  |  |         ColumnEntity column = columnMapper.selectById(article.getColumnId()); | 
 |  |  |         cmsCoreService.articleProcess(article.getId(), column.getArticleTemplate(), column.getPath()); | 
 |  |  |  | 
 |  |  |         Map<String, Object> data = new HashMap<>(); | 
 |  |  |         data.put("id", article.getId()); | 
 |  |  |         data.put("companyId", companyId); | 
 |  |  |  | 
 |  |  |         cmsCoreService.articleProcess(data, column.getArticleTemplate(), column.getPath()); | 
 |  |  |         this.releaseColumn(column.getId(), false); | 
 |  |  |         if (column.getParentId() != 0L) { | 
 |  |  |             releaseColumn(column.getParentId(), false); | 
 |  |  |         } | 
 |  |  |         this.releaseIndex(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void releaseColumn(Long id, boolean article) { | 
 |  |  |         Long companyId = LoginUserUtil.getCompanyId(); | 
 |  |  |         ColumnEntity columnEntity = columnMapper.selectById(id); | 
 |  |  |         Map<String, Object> map = new HashMap<>(); | 
 |  |  |         map.put("id", columnEntity.getId()); | 
 |  |  | 
 |  |  |             map.put("parentCode", parent.getColumnCode()); | 
 |  |  |         } | 
 |  |  |         map.put("templatePath", columnEntity.getPath()); | 
 |  |  |         cmsCoreService.columnProcess(map, columnEntity.getListTemplate(), article); | 
 |  |  |         map.put("companyId", companyId); | 
 |  |  |  | 
 |  |  |         cmsCoreService.columnProcess(map, columnEntity.getListTemplate()); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public void releaseIndex() { | 
 |  |  |         Map<String, Object> map = new HashMap<>(); | 
 |  |  |         Long companyId = LoginUserUtil.getCompanyId(); | 
 |  |  |         map.put("companyId", companyId); | 
 |  |  |  | 
 |  |  |         cmsCoreService.indexProcess(map, null); | 
 |  |  |     } | 
 |  |  | } |