...
|
...
|
@@ -4,10 +4,12 @@ import com.yoho.core.common.utils.DateUtil; |
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.error.ServiceError;
|
|
|
import com.yoho.error.exception.ServiceException;
|
|
|
import com.yoho.service.model.sns.request.AutoAttentionReqBO;
|
|
|
import com.yoho.service.model.sns.request.GrassArticleCommentAddReqBO;
|
|
|
import com.yoho.service.model.social.request.BaseReqBO;
|
|
|
import com.yoho.service.model.social.request.UicUserReqBO;
|
|
|
import com.yoho.service.model.social.response.UserInfoRspBO;
|
|
|
import com.yohobuy.platform.common.service.redis.PlatformRedis;
|
|
|
import com.yohobuy.platform.dal.common.BeanConvertUtil;
|
|
|
import com.yohobuy.platform.dal.grass.IGrassArticleCommentDao;
|
|
|
import com.yohobuy.platform.dal.grass.IGrassArticleDao;
|
...
|
...
|
@@ -15,6 +17,7 @@ import com.yohobuy.platform.dal.grass.IGrassUserAchieveDAO; |
|
|
import com.yohobuy.platform.dal.grass.model.GrassArticle;
|
|
|
import com.yohobuy.platform.dal.grass.model.GrassArticleComment;
|
|
|
import com.yohobuy.platform.dal.grass.model.GrassArticleCommentQueryDo;
|
|
|
import com.yohobuy.platform.grass.mq.AutoAttentionComsumer;
|
|
|
import com.yohobuy.platform.grass.service.IGrassArticleCommentService;
|
|
|
import com.yohobuy.platform.grass.service.IGrassArticleService;
|
|
|
import com.yohobuy.platform.grass.service.IGrassRefreshCacheService;
|
...
|
...
|
@@ -33,6 +36,7 @@ import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -58,6 +62,9 @@ public class GrassArticleCommentServiceImpl implements IGrassArticleCommentServi |
|
|
@Value("${api.yoho.url:http://api.yoho.cn}")
|
|
|
private String apiUrl;
|
|
|
|
|
|
@Autowired
|
|
|
private PlatformRedis platformRedis;
|
|
|
|
|
|
@Override
|
|
|
public PageResponseVO<ArticleCommentQueryRsp> queryComment(ArticleCommentQueryReq req) {
|
|
|
logger.info("queryComment:before selectTotalByCommentQueryReq,param is {}",req);
|
...
|
...
|
@@ -289,6 +296,7 @@ public class GrassArticleCommentServiceImpl implements IGrassArticleCommentServi |
|
|
List<Integer> articleIds = oldCommentList.stream().map(GrassArticleComment::getDestId).collect(Collectors.toList());
|
|
|
Map<Integer,GrassArticle> articleMap = CollectionUtils.isEmpty(articleIds)?new HashMap<>():grassArticleDao.selectMapByIds(articleIds);
|
|
|
List<GrassInBoxAddReq> addReqList = new ArrayList<>();
|
|
|
List<AutoAttentionReqBO> attReqBOList = new ArrayList<>();
|
|
|
for(GrassArticleComment comment : oldCommentList){
|
|
|
GrassArticle article = articleMap.get(comment.getDestId());
|
|
|
GrassInBoxAddReq addReq = new GrassInBoxAddReq();
|
...
|
...
|
@@ -300,6 +308,7 @@ public class GrassArticleCommentServiceImpl implements IGrassArticleCommentServi |
|
|
}
|
|
|
addReq.setBusinessType(1002);
|
|
|
addReq.setUid(article.getAuthorUid());
|
|
|
attReqBOList.add(new AutoAttentionReqBO(article.getAuthorUid(), AutoAttentionReqBO.COMMENT_TRIGGER_TYPE));
|
|
|
}else{
|
|
|
GrassArticleComment parent = parentCommentMap.get(comment.getParentId());
|
|
|
addReq.setBusinessType(1003);
|
...
|
...
|
@@ -310,6 +319,12 @@ public class GrassArticleCommentServiceImpl implements IGrassArticleCommentServi |
|
|
if(CollectionUtils.isEmpty(addReqList)){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if(CollectionUtils.isNotEmpty(attReqBOList)){
|
|
|
//被评论文章作者放到自动增粉队列里
|
|
|
platformRedis.rightPushAll(AutoAttentionComsumer.GRASS_ATTEN_USER_PRE, "all", attReqBOList, 150, TimeUnit.MINUTES);
|
|
|
}
|
|
|
|
|
|
try{
|
|
|
logger.info("before gateway.addBatchGrassInBox.addReqList size is {}",addReqList.size());
|
|
|
String url = apiUrl + "/guang/api/addBatchInBox/?client_type=h5";
|
...
|
...
|
|