Authored by 张帅

Merge branch 'test6.8.7' of http://git.yoho.cn/platform/platform-cms into test6.8.7

... ... @@ -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());
... ...
... ... @@ -41,12 +41,11 @@ public class GrassRefreshCacheServiceImpl implements IGrassRefreshCacheService{
int clearCode = reqVO.getClearCode();
int uid = reqVO.getUid();
try{
String url = apiUrl + "?method=clear.grass.cache&elementId=" + elementId + "&clearCode=" + clearCode + "&uid=" + uid;
logger.info("start refreshGrassCache, url is: {}, elementId is {}, clearCode is {},uid is {}", url, elementId, clearCode, uid);
String url = apiUrl + "?method=clear.grass.cache&elementId=" + elementId + "&clearCode=" + clearCode + "&uid=" + uid+"&userType=" +reqVO.getUserType();
logger.info("before refreshGrassCache, url is: {}, reqVo is {}", url, reqVO);
serviceCaller.get("app.clearGrassCache", url, null, String.class, null);
logger.info("success refreshGrassCache elementId is {}, clearCode is {},uid is {}", elementId, clearCode, uid);
}catch (Exception e){
logger.info("fail refreshGrassCache, elementId is {}, clearCode is {},uid is {}, error is {}", elementId, clearCode, uid, e);
logger.info("failed refreshGrassCache, reqVo is {}, error is {}", reqVO, e);
}
}
});
... ...
... ... @@ -105,7 +105,7 @@
textField : "text",
required:false,
prompt: "请选择来源",
data:[{text:"全部",value:"0"},{text:"用户发布",value:"1"},{text:"guang资讯",value:"2"},{text:"mars",value:"3"},{text:"晒单",value:"4"}]
data:[{text:"全部",value:"0"},{text:"普通用户",value:"1"},{text:"guang资讯",value:"2"},{text:"mars",value:"3"},{text:"晒单",value:"4"},{text:"now社区",value:"5"},{text:"编辑",value:"6"}]
});
$("#searchBtn").linkbutton({
... ... @@ -225,7 +225,7 @@
debugger
var str = '';
if(rowData.source == '1'){
str = "用户发布";
str = "普通用户";
}
if(rowData.source == '2'){
str = "guang";
... ... @@ -236,6 +236,14 @@
if(rowData.source == '4'){
str = "晒单";
}
if(rowData.source == '5'){
str = "now";
}
if(rowData.source == '6'){
str = "编辑";
}
return str;
}
... ... @@ -267,8 +275,13 @@
width: 50,
align: "center",
formatter: function (value, rowData, rowIndex) {
// var str = "<a role='switchR' class='btn-success' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>审核</a>";
// var str = "<a target='_blank' role='validateR' style='margin-left:10px' class='btn-success' href='"+contextPath+"/html/grass/articleAuthorizeManage/articleDetail.html?articleId="+rowData.articleId+"'>审核</a>";
var str = "<a role='validateR' dataId='"+rowData.articleId+ "' style='margin-left:10px' class='btn-success' >审核</a>";
// if(rowData.authStatus==0){//待审核状态--允许审核通过 和 不通过
// str += "<a role='switchR' class='btn-success' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>审核通过</a>";
// str += "<a role='switchR' class='btn-success' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='2' style='margin-left:10px'>不通过</a>";
... ... @@ -305,21 +318,25 @@
$(this).datagrid("getPanel").find("a[role='switchR']").linkbutton({
iconCls : "icon-edit",
onClick: function () {
var status = $(this).attr("status");
var dataId = $(this).attr("dataId");
index = $(this).attr("index");
var message = "";
if(status == 1){
message = "审核通过";
}
if(status == 2){
message = "审核不通过";
}
$.messager.confirm("确认", "确认这篇文章"+message+"吗?", function (flag) {
if(flag){
switchRecommend(dataId, status);
}
});
var dataId = $(this).attr("dataId");
//打开新页面
//contextPath+"/html/grass/articleAuthorizeManage/articleDetail.html?articleId="+rowData.articleId
window.open(contextPath+"/html/grass/articleAuthorizeManage/articleDetail.html?articleId="+dataId);
// var status = $(this).attr("status");
// var dataId = $(this).attr("dataId");
// index = $(this).attr("index");
// var message = "";
// if(status == 1){
// message = "审核通过";
// }
// if(status == 2){
// message = "审核不通过";
// }
// $.messager.confirm("确认", "确认这篇文章"+message+"吗?", function (flag) {
// if(flag){
// switchRecommend(dataId, status);
// }
// });
}
});
... ...
... ... @@ -74,9 +74,12 @@
<tr style="height: 60px">
<td>
<div id="articleContent">
<div>
<p id="articleContent" style=" white-space: pre-wrap;">
</p>
</div>
</td>
</tr>
<tr style="height: 20px">
... ... @@ -149,6 +152,8 @@
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
observer: true,//修改swiper自己或子元素时,自动初始化swiper
observeParents: true//修改swiper的父元素时,自动初始化swiper
// // 如果需要滚动条
// scrollbar: {
... ... @@ -236,6 +241,30 @@
});
// var mySwiper = new Swiper('.swiper-container', {
//// direction: 'vertical', // 垂直切换选项
//// loop: true, // 循环模式选项
//
//// // 如果需要分页器
//// pagination: {
//// el: '.swiper-pagination',
//// },
//
// // 如果需要前进后退按钮
// navigation: {
// nextEl: '.swiper-button-next',
// prevEl: '.swiper-button-prev',
// },
// observer: true,//修改swiper自己或子元素时,自动初始化swiper
// observeParents: true//修改swiper的父元素时,自动初始化swiper
//// // 如果需要滚动条
//// scrollbar: {
//// el: '.swiper-scrollbar',
//// },
// })
});
//获取url中的参数方法
... ...
... ... @@ -111,7 +111,7 @@
textField : "text",
required:false,
prompt: "请选择来源",
data:[{text:"全部",value:"0"},{text:"用户发布",value:"1"},{text:"guang资讯",value:"2"},{text:"mars",value:"3"},{text:"晒单",value:"4"},{text:"now社区",value:"5"}]
data:[{text:"全部",value:"0"},{text:"用户发布",value:"1"},{text:"guang资讯",value:"2"},{text:"mars",value:"3"},{text:"晒单",value:"4"},{text:"now社区",value:"5"},{text:"编辑",value:"6"}]
});
// 检索按钮
... ... @@ -265,6 +265,9 @@
if(rowData.source == '5'){
str = "now社区";
}
if(rowData.source == '6'){
str = "编辑";
}
return str;
}
... ...