富文本字符串过滤标签
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.14.3</version>
</dependency>
Page<CmsArticle> cmsArticleList = cmsArticleService.findPage(pageDTO);
cmsArticleList.forEach(item -> {
String content = Jsoup.parse(item.getContent()).text();
// 截取前120位
Integer contentLength = content.length();
content = content.substring(0, contentLength >= 120 ? 120 : contentLength);
item.setContent(content+"...");
});