|
|
@ -1,15 +1,28 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dto.feign.GovVoiceFeignClient; |
|
|
|
import com.epmet.dto.form.ArticlePageFormDTO; |
|
|
|
import com.epmet.dto.form.ResiTagListFormDTO; |
|
|
|
import com.epmet.dto.form.TagCascadeListFormDTO; |
|
|
|
import com.epmet.dto.result.ArticleListResultDTO; |
|
|
|
import com.epmet.dto.result.ArticleWithTagsResultDTO; |
|
|
|
import com.epmet.dto.result.TagInfoResultDTO; |
|
|
|
import com.epmet.service.ArticleService; |
|
|
|
import com.epmet.utils.ModuleConstant; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -44,4 +57,33 @@ public class ArticleServiceImpl implements ArticleService { |
|
|
|
// formDto.setCustomerId(tokenDto.getCustomerId());
|
|
|
|
return govVoiceFeignClient.tagCascadeList(formDto).getData(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 根据网格Id和标签列表查找文章的相关信息列表 用处:居民端党建声音列表 返回的标签以数组形式 |
|
|
|
* @param articlePageFormDTO |
|
|
|
* @return List<ArticleWithTagsResultDTO> |
|
|
|
* @author wangc |
|
|
|
* @date 2020.06.03 14:19 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public List<ArticleWithTagsResultDTO> articleList(ArticlePageFormDTO articlePageFormDTO) { |
|
|
|
Result<List<ArticleListResultDTO>> articles = govVoiceFeignClient.resiArticleList(articlePageFormDTO); |
|
|
|
if(articles.success() && null != articles.getData() && articles.getData().size() > NumConstant.ZERO){ |
|
|
|
return articles.getData().stream().map(article -> { |
|
|
|
ArticleWithTagsResultDTO artObj = ConvertUtils.sourceToTarget(article,ArticleWithTagsResultDTO.class); |
|
|
|
artObj.setTagName(new HashSet<>()); |
|
|
|
if(StringUtils.isNotBlank(article.getTagName())){ |
|
|
|
String[] tagArray = article.getTagName().split(ModuleConstant.VERTICAL_BAR_WITH_ESCAPE_CHARACTER); |
|
|
|
if(tagArray.length > NumConstant.ZERO){ |
|
|
|
artObj.setTagName(new HashSet<>(Arrays.asList(tagArray))); |
|
|
|
} |
|
|
|
} |
|
|
|
return artObj; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
throw new RenException(articles.getInternalMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|