作者 钟来

水产舆情采集海报生成过滤广告

@@ -242,9 +242,14 @@ public class ServerController extends BaseController @@ -242,9 +242,14 @@ public class ServerController extends BaseController
242 { 242 {
243 return AjaxResult.error("参数不能为空"); 243 return AjaxResult.error("参数不能为空");
244 } 244 }
  245 + // 流处理:过滤标题并转换为Entry
245 List<AbstractMap.SimpleEntry<String, String>> dataList = list.stream() 246 List<AbstractMap.SimpleEntry<String, String>> dataList = list.stream()
  247 + .filter(dto -> !"非新闻内容".equals(dto.getTitle()))
246 .map(dto -> new AbstractMap.SimpleEntry<>(dto.getTitle(), dto.getContent())) 248 .map(dto -> new AbstractMap.SimpleEntry<>(dto.getTitle(), dto.getContent()))
247 .collect(Collectors.toList()); 249 .collect(Collectors.toList());
  250 +// List<AbstractMap.SimpleEntry<String, String>> dataList = list.stream()
  251 +// .map(dto -> new AbstractMap.SimpleEntry<>(dto.getTitle(), dto.getContent()))
  252 +// .collect(Collectors.toList());
248 try { 253 try {
249 logger.info("转换数据:{}",dataList); 254 logger.info("转换数据:{}",dataList);
250 String savePath = MultiTextImageGenerator.generateImage(dataList, new StyleConfig()); 255 String savePath = MultiTextImageGenerator.generateImage(dataList, new StyleConfig());