Authored by csgyoho

种草-文章评论

... ... @@ -2,6 +2,7 @@ package com.yohobuy.platform.grass.service.impl;
import com.yoho.core.common.utils.DateUtil;
import com.yohobuy.platform.common.helper.UserHelper;
import com.yohobuy.platform.dal.common.BeanConvertUtil;
import com.yohobuy.platform.dal.grass.IGrassArticleCommentDao;
import com.yohobuy.platform.grass.service.IGrassArticleCommentService;
import com.yohobuy.platform.model.common.PageResponseVO;
... ... @@ -39,12 +40,13 @@ public class GrassArticleCommentServiceImpl implements IGrassArticleCommentServi
if(total == 0){
return result;
}
List<ArticleCommentQueryRsp> commentQueryRspList = grassArticleCommentDao.selectByCommentQueryReq(req);
List<ArticleCommentQueryRsp> commentQueryRspList = BeanConvertUtil.convertList(grassArticleCommentDao.selectByCommentQueryReq(req),ArticleCommentQueryRsp.class);
if(CollectionUtils.isEmpty(commentQueryRspList)){
return result;
}
List<Integer> ids = commentQueryRspList.stream().map(com->com.getId()).collect(Collectors.toList());
Map<Integer,ChildCommentTotalBo> childMap = grassArticleCommentDao.selectChildTotalMapByIds(ids);
Map<Integer,ChildCommentTotalBo> childMap = BeanConvertUtil.convertMap(grassArticleCommentDao.selectChildTotalMapByIds(ids),ChildCommentTotalBo.class);
commentQueryRspList.forEach(com->{
ChildCommentTotalBo bo = childMap.get(com.getId());
if(bo != null){
... ...
... ... @@ -2,6 +2,7 @@ package com.yohobuy.platform.grass.service.impl;
import com.yoho.core.common.utils.DateUtil;
import com.yohobuy.platform.common.helper.UserHelper;
import com.yohobuy.platform.dal.common.BeanConvertUtil;
import com.yohobuy.platform.dal.grass.IGrassGoodsCommentDao;
import com.yohobuy.platform.grass.service.IGrassGoodsCommentService;
import com.yohobuy.platform.model.common.PageResponseVO;
... ... @@ -38,12 +39,12 @@ public class GrassGoodsCommentServiceImpl implements IGrassGoodsCommentService {
if(total == 0){
return result;
}
List<GoodsCommentQueryRsp> commentQueryRspList = grassGoodsCommentDao.selectByCommentQueryReq(req);
List<GoodsCommentQueryRsp> commentQueryRspList = BeanConvertUtil.convertList(grassGoodsCommentDao.selectByCommentQueryReq(req),GoodsCommentQueryRsp.class);
if(CollectionUtils.isEmpty(commentQueryRspList)){
return result;
}
List<Integer> ids = commentQueryRspList.stream().map(com->com.getId()).collect(Collectors.toList());
Map<Integer,ChildCommentTotalBo> childMap = grassGoodsCommentDao.selectChildTotalMapByIds(ids);
Map<Integer,ChildCommentTotalBo> childMap = BeanConvertUtil.convertMap(grassGoodsCommentDao.selectChildTotalMapByIds(ids),ChildCommentTotalBo.class);
commentQueryRspList.forEach(com->{
ChildCommentTotalBo bo = childMap.get(com.getId());
if(bo != null){
... ...
... ... @@ -6,6 +6,7 @@ import com.yoho.core.common.helpers.ImagesHelper;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.error.exception.ServiceException;
import com.yohobuy.platform.dal.common.BeanConvertUtil;
import com.yohobuy.platform.dal.grass.IGrassGoodsCommentDao;
import com.yohobuy.platform.dal.grass.IGrassGoodsDao;
import com.yohobuy.platform.dal.grass.model.GrassGoods;
... ... @@ -63,14 +64,14 @@ public class GrassGoodsServiceImpl implements IGrassGoodsService{
logger.info("queryGoods#selectTotalByGoodsQueryReq total is 0.param is {}",req);
return result;
}
List<GoodsQueryRsp> goodsBoList = grassGoodsDao.selectByGoodsQueryReq(req);
List<GoodsQueryRsp> goodsBoList = BeanConvertUtil.convertList(grassGoodsDao.selectByGoodsQueryReq(req),GoodsQueryRsp.class);
if(CollectionUtils.isEmpty(goodsBoList)){
logger.info("queryGoods#selectByGoodsQueryReq goodsBoList is empty.param is {}",req);
return result;
}
// 查询评论总数
List<Integer> goodsIds = goodsBoList.stream().map(goods->goods.getId()).collect(Collectors.toList());
Map<Integer,GoodsCommentTotalBo> commentMap = grassGoodsCommentDao.selectTotalMapByGoodsIds(goodsIds);
Map<Integer,GoodsCommentTotalBo> commentMap = BeanConvertUtil.convertMap(grassGoodsCommentDao.selectTotalMapByGoodsIds(goodsIds),GoodsCommentTotalBo.class);
// 查询商品信息
String skns = goodsBoList.stream().filter(goods-> StringUtils.isNotBlank(goods.getProductSkn())).map(goods->goods.getProductSkn()).collect(Collectors.joining(","));
Map<String,JSONObject> productMap = buildProductMap(skns,1);
... ...