...
|
...
|
@@ -8,8 +8,6 @@ import com.google.common.collect.Maps; |
|
|
import com.google.common.collect.Sets;
|
|
|
import com.yoho.core.dal.datasource.annotation.Database;
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.error.ServiceError;
|
|
|
import com.yoho.service.model.sns.response.GrassArticleProductRspBO;
|
|
|
import com.yoho.service.model.social.request.BaseReqBO;
|
|
|
import com.yoho.service.model.social.request.UicUserReqBO;
|
|
|
import com.yoho.service.model.social.response.UserInfoRspBO;
|
...
|
...
|
@@ -262,7 +260,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ |
|
|
public PageResponseVO<ArticleDetailRspBo> getArticleList(GrassArticleReq req) {
|
|
|
logger.info("enter getArticleList, req is {}", req);
|
|
|
Integer articleId = req.getArticleId();
|
|
|
Integer source = req.getSource()==null || req.getSource() == 0 ? null:req.getSource();
|
|
|
Integer source = req.getSource()==null || req.getSource() == 0 ? null:req.getSource();//文章来源
|
|
|
Integer uidSourceFlag = null;
|
|
|
if(source != null && source == 1){
|
|
|
uidSourceFlag = 1;//普通用户,查询时排除小编
|
|
|
}
|
|
|
Integer authStatus = req.getAuthStatus()==null ||req.getAuthStatus()==8 ? null:req.getAuthStatus();
|
|
|
Integer isRecommend = req.getIsRecommend()==null ||req.getIsRecommend()==8 ? null:req.getIsRecommend();
|
|
|
Integer isTop = req.getIsTop()==null ||req.getIsTop()==8 ? null:req.getIsTop();
|
...
|
...
|
@@ -272,17 +274,39 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ |
|
|
String endTime = req.getEndTimeStr();
|
|
|
Long startTimeInt = null;
|
|
|
Long endTimeInt = null;
|
|
|
|
|
|
PageResponseVO rsp = new PageResponseVO();
|
|
|
rsp.setList(Lists.newArrayList());
|
|
|
rsp.setTotal(0);
|
|
|
rsp.setPage(1);
|
|
|
rsp.setSize(10);
|
|
|
|
|
|
if(StringUtils.isNotEmpty(authName)){
|
|
|
authorUids = getUidByNickName(authName);
|
|
|
if(CollectionUtils.isEmpty(authorUids)){
|
|
|
PageResponseVO rsp = new PageResponseVO();
|
|
|
rsp.setList(Lists.newArrayList());
|
|
|
rsp.setTotal(0);
|
|
|
rsp.setPage(1);
|
|
|
rsp.setSize(10);
|
|
|
return rsp;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//文章来源是小编,查询条件 source = 1,并且 uid在小编集合中in grassVirtualUser
|
|
|
//文章来源是普通用户,需要排除小编 not in grassVirtualUser
|
|
|
if(source != null && source == ArticleTypeEnum.VIRTUALUSER.getValue()){//小编
|
|
|
source = 1;//文章类型也是1
|
|
|
List<Integer> virtualUids = grassVirtualUserDao.getAllPlatUid();
|
|
|
if(CollectionUtils.isEmpty(virtualUids)){
|
|
|
return rsp;
|
|
|
}
|
|
|
|
|
|
if(StringUtils.isNotEmpty(authName)){//来源于小编,并且查询条件有nickName
|
|
|
authorUids.retainAll(virtualUids);
|
|
|
if(CollectionUtils.isEmpty(authorUids)){
|
|
|
logger.info("getArticleList ,result is empty, req={}", req);
|
|
|
return rsp;
|
|
|
}
|
|
|
}else{
|
|
|
authorUids = virtualUids;
|
|
|
}
|
|
|
}
|
|
|
if(StringUtils.isNotEmpty(startTime)){
|
|
|
startTimeInt = Long.valueOf(startTime);
|
|
|
}
|
...
|
...
|
@@ -291,11 +315,10 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ |
|
|
}
|
|
|
int page = req.getPage();
|
|
|
int size = req.getSize();
|
|
|
int total = grassArticleDao.selectArticleCount(articleId, source, authStatus,authorUids,isRecommend, isTop,startTimeInt, endTimeInt);
|
|
|
int total = grassArticleDao.selectArticleCount(articleId, source, authStatus,authorUids,isRecommend, isTop,startTimeInt, endTimeInt, uidSourceFlag);
|
|
|
logger.info("getArticleList: grassArticleDao.getArticleCount: articleId is {}, source is {}, total is {}", articleId, source, total);
|
|
|
int offset = (page - 1) * size;
|
|
|
List<GrassArticle> articleList = grassArticleDao.selectArticleList(articleId, source, authStatus,authorUids,isRecommend, isTop,startTimeInt, endTimeInt,offset, size);
|
|
|
PageResponseVO rsp = new PageResponseVO();
|
|
|
List<GrassArticle> articleList = grassArticleDao.selectArticleList(articleId, source, authStatus,authorUids,isRecommend, isTop,startTimeInt, endTimeInt,offset, size,uidSourceFlag);
|
|
|
rsp.setList(buildArticleDetail(articleList));
|
|
|
rsp.setTotal(total);
|
|
|
rsp.setSize(size);
|
...
|
...
|
@@ -721,6 +744,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ |
|
|
cacheReq.setClearCode(GrassCacheReq.CLEARCODE_ARTICLE);
|
|
|
cacheReq.setElementId(String.valueOf(articleId));
|
|
|
cacheReq.setUid(grassArticle.getAuthorUid());
|
|
|
cacheReq.setUserType(grassArticle.getAuthorType());
|
|
|
grassRefreshCacheService.refreshGrassCache(cacheReq);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -1057,6 +1081,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ |
|
|
Map<Integer,UserInfoRspBO> userInfoMap = getUsersInfo(uids);
|
|
|
Map<Integer,Author> authorInfoMap = getAuthorInfo(authoruids);
|
|
|
List<ArticleDetailRspBo> rspBoList = Lists.newArrayList();
|
|
|
List<Integer> vitualUids = grassVirtualUserDao.getAllPlatUid();//所有的马甲用户
|
|
|
articleList.forEach(article -> {
|
|
|
ArticleDetailRspBo rspBo = new ArticleDetailRspBo();
|
|
|
rspBo.setArticleId(article.getId());
|
...
|
...
|
@@ -1076,6 +1101,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ |
|
|
rspBo.setPublishTime(DateUtil.long2DateStr(article.getCreateTime(),DateUtil.DATE_TIME_FORMAT));
|
|
|
rspBo.setAuthStatus(article.getAuthStatus());
|
|
|
rspBo.setSource(article.getArticleType());
|
|
|
if(article.getArticleType() == ArticleTypeEnum.NORMAL.getValue()){//文章类型是1 的
|
|
|
if(vitualUids.contains(article.getAuthorUid())){//属于马甲用户发布的
|
|
|
rspBo.setSource(6);
|
|
|
}
|
|
|
}
|
|
|
rspBo.setImgList(imgMap.get(article.getId()));
|
|
|
rspBo.setLabelList(labelMap.get(article.getId()));
|
|
|
rspBo.setIsTop(article.getIsTop());
|
...
|
...
|
|