Authored by mlge

种草--话题管理修改

... ... @@ -8,6 +8,7 @@ import com.yohobuy.platform.common.util.DateUtil;
import com.yohobuy.platform.common.util.StringUtil;
import com.yohobuy.platform.dal.grass.*;
import com.yohobuy.platform.dal.grass.model.GrassArticle;
import com.yohobuy.platform.dal.grass.model.GrassArticleTopic;
import com.yohobuy.platform.dal.grass.model.GrassLabel;
import com.yohobuy.platform.dal.grass.model.GrassTopic;
import com.yohobuy.platform.grass.service.ITopicService;
... ... @@ -43,6 +44,9 @@ public class TopicServiceImpl implements ITopicService {
@Autowired
private IGrassTopicGroupDAO topicGroupDAO;
@Autowired
private IGrassArticleTopicDao articleTopicDao;
@Override
public PageResponseVO<TopicRespBo> getGrassTopicList(GrassTopicReq req) {
... ... @@ -119,15 +123,17 @@ public class TopicServiceImpl implements ITopicService {
return new ArrayList<>();
}
List<TopicRespBo> result = new ArrayList<>();
List<Integer> topicId = sourceList.stream().map(GrassTopic::getId).distinct().collect(Collectors.toList());
List<Integer> topicIds = sourceList.stream().map(GrassTopic::getId).distinct().collect(Collectors.toList());
//查询文章表 统计话题下的文章数(不考虑文章状态)
List<GrassArticleTopic> topicList = articleTopicDao.countBytopicIds(topicIds);
Map<Integer,Integer> topicMap = topicList.stream().collect(Collectors.toMap(GrassArticleTopic::getTopicId, obj -> obj.getNum()));
for(GrassTopic grassTopic : sourceList){
TopicRespBo bo = new TopicRespBo();
BeanUtils.copyProperties(grassTopic,bo);
bo.setUpdateTimeStr(grassTopic.getUpdateTime() == null ? "" : DateUtil.int2DateStr(grassTopic.getUpdateTime(),"yyyy-MM-dd HH:mm:ss"));
//相关的文章
bo.setArticleAmount(topicMap.get(bo.getId()) == null ? 0 : topicMap.get(bo.getId()));
result.add(bo);
}
return result;
... ...
... ... @@ -355,6 +355,7 @@ datasources:
- com.yohobuy.platform.dal.grass.IGrassArticleDeleteLogDao
- com.yohobuy.platform.dal.grass.IGrassUserAttentionDao
- com.yohobuy.platform.dal.grass.IGrassTopicGroupDAO
- com.yohobuy.platform.dal.grass.IGrassArticleTopicDao
yhb_promotion:
servers:
... ...
... ... @@ -353,6 +353,7 @@ datasources:
- com.yohobuy.platform.dal.grass.IGrassArticleDeleteLogDao
- com.yohobuy.platform.dal.grass.IGrassUserAttentionDao
- com.yohobuy.platform.dal.grass.IGrassTopicGroupDAO
- com.yohobuy.platform.dal.grass.IGrassArticleTopicDao
yhb_promotion:
servers:
... ...