From 44defa3aa97adf4d78c5371f449b488061ec63b0 Mon Sep 17 00:00:00 2001 From: x ronger Date: Wed, 15 Jan 2020 01:00:18 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E5=B1=95=E7=A4=BA=E6=96=87=E7=AB=A0?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ArticleServiceImpl.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/rymcu/vertical/service/impl/ArticleServiceImpl.java b/src/main/java/com/rymcu/vertical/service/impl/ArticleServiceImpl.java index 9406b1d..d8e6768 100644 --- a/src/main/java/com/rymcu/vertical/service/impl/ArticleServiceImpl.java +++ b/src/main/java/com/rymcu/vertical/service/impl/ArticleServiceImpl.java @@ -176,16 +176,16 @@ public class ArticleServiceImpl extends AbstractService
implements Arti } else if(type == 2){ ArticleContent articleContent = articleMapper.selectArticleContent(article.getIdArticle()); article.setArticleContent(articleContent.getArticleContent()); - } else { - if(StringUtils.isBlank(article.getArticlePreviewContent())){ - ArticleContent articleContent = articleMapper.selectArticleContent(article.getIdArticle()); - Integer length = articleContent.getArticleContentHtml().length(); - if(length > MAX_PREVIEW){ - length = 200; - } - String articlePreviewContent = articleContent.getArticleContentHtml().substring(0,length); - article.setArticlePreviewContent(Html2TextUtil.getContent(articlePreviewContent)); - } + } + + if(StringUtils.isBlank(article.getArticlePreviewContent())){ + ArticleContent articleContent = articleMapper.selectArticleContent(article.getIdArticle()); + Integer length = articleContent.getArticleContentHtml().length(); + if(length > MAX_PREVIEW){ + length = 200; + } + String articlePreviewContent = articleContent.getArticleContentHtml().substring(0,length); + article.setArticlePreviewContent(Html2TextUtil.getContent(articlePreviewContent)); } return article; }