Authored by mlge

种草--文章管理 修改查询条件

... ... @@ -337,10 +337,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
logger.info("enter getArticleList, req is {}", req);
Integer articleId = req.getArticleId();
Integer source = req.getSource()==null || req.getSource() == 0 ? null:req.getSource();//文章来源
Integer uidSourceFlag = null;
if(source != null && source == 1){
uidSourceFlag = 1;//普通用户,查询时排除小编
}
Integer userType = req.getUserType() == null || req.getUserType() == 0 ? null : req.getUserType();//用户身份
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();
... ... @@ -371,25 +368,31 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
authorUids.clear();
authorUids.add(authorUid);
}
//文章来源是小编,查询条件 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) || authorUid != null){//来源于小编,并且查询条件有nickName
authorUids.retainAll(virtualUids);
if(CollectionUtils.isEmpty(authorUids)){
logger.info("getArticleList ,result is empty, req={}", req);
return rsp;
}
}else{
authorUids = virtualUids;
}
}
List<Integer> excludedUids = null;
//排除掉 马甲用户
if(userType != null && userType == 10){//来自于用户的--排除掉马甲用户
excludedUids = grassVirtualUserDao.getAllPlatUid();
userType = null;
}
//其他的查询马甲用户表
// 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) || authorUid != null){//来源于小编,并且查询条件有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);
}
... ... @@ -398,10 +401,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, uidSourceFlag,recommendSort);
int total = grassArticleDao.selectArticleCount(articleId, source, authStatus,authorUids,isRecommend, isTop,startTimeInt, endTimeInt, recommendSort,excludedUids,userType);
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,uidSourceFlag,recommendSort);
List<GrassArticle> articleList = grassArticleDao.selectArticleList(articleId, source, authStatus,authorUids,isRecommend, isTop,startTimeInt, endTimeInt,offset, size,recommendSort,excludedUids,userType);
rsp.setList(buildArticleDetail(articleList));
rsp.setTotal(total);
rsp.setSize(size);
... ... @@ -1216,7 +1219,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();//所有的马甲用户
// List<Integer> vitualUids = grassVirtualUserDao.getAllPlatUid();//所有的马甲用户
articleList.forEach(article -> {
ArticleDetailRspBo rspBo = new ArticleDetailRspBo();
rspBo.setArticleId(article.getId());
... ... @@ -1236,11 +1239,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 (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());
... ... @@ -1255,6 +1258,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{
rspBo.setTopicId(topic == null ? null : topic.getId());
rspBo.setTopicName(topic == null ? null : topic.getTopicName());
rspBo.setTopicGroupId(topic == null ? null : topic.getRelatedGroup());
if(article.getArticleType() == 2){//资讯来的,前台展示 空
rspBo.setUserType(0);
}else{//10--前台展示用户
rspBo.setUserType(article.getUserType() == null ? 10 : article.getUserType());
}
rspBoList.add(rspBo);
});
return rspBoList;
... ...
... ... @@ -53,6 +53,9 @@
</input>
<input class="easyui-combobox" id="source">
</input>
<input class="easyui-combobox" id="userType">
</input>
<input id="startTimeStr" name="startTimeStr" class="easyui-datetimebox" data-options="prompt:'发布时间(开始)'"/>
<input id="endTimeStr" name="endTimeStr" class="easyui-datetimebox" data-options="prompt:'发布时间(结束)'"/>
... ... @@ -87,6 +90,7 @@
$("#publisher").textbox("setValue","");
$("#articleId").textbox("setValue","");
$("#source").combobox("setValue","");
$("#userType").combobox("setValue","");
$("#isRecommend").combobox("setValue","");
$("#isTop").combobox("setValue","");
$("#startTimeStr").datetimebox('setValue',"");
... ... @@ -132,9 +136,21 @@
textField : "text",
required:false,
prompt: "请选择来源",
data:[{text:"全部",value:"0"},{text:"用户",value:"1"},{text:"编辑",value:"6"},{text:"资讯",value:"2"},{text:"now",value:"5"},{text:"mars",value:"3"},{text:"晒单",value:"4"}]
data:[{text:"全部",value:"0"},{text:"社区",value:"1"},{text:"资讯",value:"2"},{text:"晒单",value:"4"},{text:"now",value:"5"},{text:"mars",value:"3"}]
});
$("#userType").combobox({
valueField : "value",
textField : "text",
required:false,
prompt: "请选择用户身份",
data:[{text:"全部",value:"0"},{text:"用户",value:"10"},{text: "普通马甲", value: "1"},
{text: "编辑", value: "2"}, {text: "官方号", value: "3"},
{text: "社区大号", value: "4"}, {text: "品牌号", value: "5"},
{text: "外部刷评论马甲", value: "6"}]
});
//推荐顺序
$("#recommendSort").combobox({
valueField : "value",
... ... @@ -173,6 +189,7 @@
authorUid: $("#publisherUid").textbox("getValue"),
articleId: $("#articleId").textbox("getValue"),
source: $("#source").combobox("getValue"),
userType: $("#userType").combobox("getValue"),
recommendSort:$("#recommendSort").combobox("getValue"),
isRecommend: $("#isRecommend").combobox("getValue"),
isTop: $("#isTop").combobox("getValue"),
... ... @@ -192,6 +209,7 @@
publisher: $("#publisher").textbox("getValue"),
articleId: $("#articleId").textbox("getValue"),
source: $("#source").textbox("getValue"),
userType: $("#userType").textbox("getValue"),
recommendSort:$("#recommendSort").combobox("getValue"),
authStatus: $("#authStatus").combobox("getValue")
},
... ... @@ -293,9 +311,40 @@
if(rowData.source == '5'){
str = "now";
}
if(rowData.source == '6'){
return str;
}
},{
title: "用户身份",
field: "userType",
width: 20,
align: "left",
formatter: function (value, rowData, rowIndex) {
debugger
var str = '';//不明身份者
if(rowData.userType == '10'){
str = "用户";
}
if(rowData.userType == '1'){
str = "普通马甲";
}
if(rowData.userType == '2'){
str = "编辑";
}
if(rowData.userType == '3'){
str = "官方号";
}
if(rowData.userType == '4'){
str = "社区大号";
}
if(rowData.userType == '5'){
str = "品牌号";
}
if(rowData.userType == '6'){
str = "外部刷评论马甲";
}
return str;
}
... ...