Merge branch 'test6.8.7' of http://git.yoho.cn/platform/platform-cms into test6.8.7
Showing
5 changed files
with
112 additions
and
34 deletions
@@ -8,8 +8,6 @@ import com.google.common.collect.Maps; | @@ -8,8 +8,6 @@ import com.google.common.collect.Maps; | ||
8 | import com.google.common.collect.Sets; | 8 | import com.google.common.collect.Sets; |
9 | import com.yoho.core.dal.datasource.annotation.Database; | 9 | import com.yoho.core.dal.datasource.annotation.Database; |
10 | import com.yoho.core.rest.client.ServiceCaller; | 10 | import com.yoho.core.rest.client.ServiceCaller; |
11 | -import com.yoho.error.ServiceError; | ||
12 | -import com.yoho.service.model.sns.response.GrassArticleProductRspBO; | ||
13 | import com.yoho.service.model.social.request.BaseReqBO; | 11 | import com.yoho.service.model.social.request.BaseReqBO; |
14 | import com.yoho.service.model.social.request.UicUserReqBO; | 12 | import com.yoho.service.model.social.request.UicUserReqBO; |
15 | import com.yoho.service.model.social.response.UserInfoRspBO; | 13 | import com.yoho.service.model.social.response.UserInfoRspBO; |
@@ -262,7 +260,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | @@ -262,7 +260,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | ||
262 | public PageResponseVO<ArticleDetailRspBo> getArticleList(GrassArticleReq req) { | 260 | public PageResponseVO<ArticleDetailRspBo> getArticleList(GrassArticleReq req) { |
263 | logger.info("enter getArticleList, req is {}", req); | 261 | logger.info("enter getArticleList, req is {}", req); |
264 | Integer articleId = req.getArticleId(); | 262 | Integer articleId = req.getArticleId(); |
265 | - Integer source = req.getSource()==null || req.getSource() == 0 ? null:req.getSource(); | 263 | + Integer source = req.getSource()==null || req.getSource() == 0 ? null:req.getSource();//文章来源 |
264 | + Integer uidSourceFlag = null; | ||
265 | + if(source != null && source == 1){ | ||
266 | + uidSourceFlag = 1;//普通用户,查询时排除小编 | ||
267 | + } | ||
266 | Integer authStatus = req.getAuthStatus()==null ||req.getAuthStatus()==8 ? null:req.getAuthStatus(); | 268 | Integer authStatus = req.getAuthStatus()==null ||req.getAuthStatus()==8 ? null:req.getAuthStatus(); |
267 | Integer isRecommend = req.getIsRecommend()==null ||req.getIsRecommend()==8 ? null:req.getIsRecommend(); | 269 | Integer isRecommend = req.getIsRecommend()==null ||req.getIsRecommend()==8 ? null:req.getIsRecommend(); |
268 | Integer isTop = req.getIsTop()==null ||req.getIsTop()==8 ? null:req.getIsTop(); | 270 | Integer isTop = req.getIsTop()==null ||req.getIsTop()==8 ? null:req.getIsTop(); |
@@ -272,17 +274,39 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | @@ -272,17 +274,39 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | ||
272 | String endTime = req.getEndTimeStr(); | 274 | String endTime = req.getEndTimeStr(); |
273 | Long startTimeInt = null; | 275 | Long startTimeInt = null; |
274 | Long endTimeInt = null; | 276 | Long endTimeInt = null; |
277 | + | ||
278 | + PageResponseVO rsp = new PageResponseVO(); | ||
279 | + rsp.setList(Lists.newArrayList()); | ||
280 | + rsp.setTotal(0); | ||
281 | + rsp.setPage(1); | ||
282 | + rsp.setSize(10); | ||
283 | + | ||
275 | if(StringUtils.isNotEmpty(authName)){ | 284 | if(StringUtils.isNotEmpty(authName)){ |
276 | authorUids = getUidByNickName(authName); | 285 | authorUids = getUidByNickName(authName); |
277 | if(CollectionUtils.isEmpty(authorUids)){ | 286 | if(CollectionUtils.isEmpty(authorUids)){ |
278 | - PageResponseVO rsp = new PageResponseVO(); | ||
279 | - rsp.setList(Lists.newArrayList()); | ||
280 | - rsp.setTotal(0); | ||
281 | - rsp.setPage(1); | ||
282 | - rsp.setSize(10); | ||
283 | return rsp; | 287 | return rsp; |
284 | } | 288 | } |
285 | } | 289 | } |
290 | + | ||
291 | + //文章来源是小编,查询条件 source = 1,并且 uid在小编集合中in grassVirtualUser | ||
292 | + //文章来源是普通用户,需要排除小编 not in grassVirtualUser | ||
293 | + if(source != null && source == ArticleTypeEnum.VIRTUALUSER.getValue()){//小编 | ||
294 | + source = 1;//文章类型也是1 | ||
295 | + List<Integer> virtualUids = grassVirtualUserDao.getAllPlatUid(); | ||
296 | + if(CollectionUtils.isEmpty(virtualUids)){ | ||
297 | + return rsp; | ||
298 | + } | ||
299 | + | ||
300 | + if(StringUtils.isNotEmpty(authName)){//来源于小编,并且查询条件有nickName | ||
301 | + authorUids.retainAll(virtualUids); | ||
302 | + if(CollectionUtils.isEmpty(authorUids)){ | ||
303 | + logger.info("getArticleList ,result is empty, req={}", req); | ||
304 | + return rsp; | ||
305 | + } | ||
306 | + }else{ | ||
307 | + authorUids = virtualUids; | ||
308 | + } | ||
309 | + } | ||
286 | if(StringUtils.isNotEmpty(startTime)){ | 310 | if(StringUtils.isNotEmpty(startTime)){ |
287 | startTimeInt = Long.valueOf(startTime); | 311 | startTimeInt = Long.valueOf(startTime); |
288 | } | 312 | } |
@@ -291,11 +315,10 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | @@ -291,11 +315,10 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | ||
291 | } | 315 | } |
292 | int page = req.getPage(); | 316 | int page = req.getPage(); |
293 | int size = req.getSize(); | 317 | int size = req.getSize(); |
294 | - int total = grassArticleDao.selectArticleCount(articleId, source, authStatus,authorUids,isRecommend, isTop,startTimeInt, endTimeInt); | 318 | + int total = grassArticleDao.selectArticleCount(articleId, source, authStatus,authorUids,isRecommend, isTop,startTimeInt, endTimeInt, uidSourceFlag); |
295 | logger.info("getArticleList: grassArticleDao.getArticleCount: articleId is {}, source is {}, total is {}", articleId, source, total); | 319 | logger.info("getArticleList: grassArticleDao.getArticleCount: articleId is {}, source is {}, total is {}", articleId, source, total); |
296 | int offset = (page - 1) * size; | 320 | int offset = (page - 1) * size; |
297 | - List<GrassArticle> articleList = grassArticleDao.selectArticleList(articleId, source, authStatus,authorUids,isRecommend, isTop,startTimeInt, endTimeInt,offset, size); | ||
298 | - PageResponseVO rsp = new PageResponseVO(); | 321 | + List<GrassArticle> articleList = grassArticleDao.selectArticleList(articleId, source, authStatus,authorUids,isRecommend, isTop,startTimeInt, endTimeInt,offset, size,uidSourceFlag); |
299 | rsp.setList(buildArticleDetail(articleList)); | 322 | rsp.setList(buildArticleDetail(articleList)); |
300 | rsp.setTotal(total); | 323 | rsp.setTotal(total); |
301 | rsp.setSize(size); | 324 | rsp.setSize(size); |
@@ -721,6 +744,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | @@ -721,6 +744,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | ||
721 | cacheReq.setClearCode(GrassCacheReq.CLEARCODE_ARTICLE); | 744 | cacheReq.setClearCode(GrassCacheReq.CLEARCODE_ARTICLE); |
722 | cacheReq.setElementId(String.valueOf(articleId)); | 745 | cacheReq.setElementId(String.valueOf(articleId)); |
723 | cacheReq.setUid(grassArticle.getAuthorUid()); | 746 | cacheReq.setUid(grassArticle.getAuthorUid()); |
747 | + cacheReq.setUserType(grassArticle.getAuthorType()); | ||
724 | grassRefreshCacheService.refreshGrassCache(cacheReq); | 748 | grassRefreshCacheService.refreshGrassCache(cacheReq); |
725 | } | 749 | } |
726 | 750 | ||
@@ -1057,6 +1081,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | @@ -1057,6 +1081,7 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | ||
1057 | Map<Integer,UserInfoRspBO> userInfoMap = getUsersInfo(uids); | 1081 | Map<Integer,UserInfoRspBO> userInfoMap = getUsersInfo(uids); |
1058 | Map<Integer,Author> authorInfoMap = getAuthorInfo(authoruids); | 1082 | Map<Integer,Author> authorInfoMap = getAuthorInfo(authoruids); |
1059 | List<ArticleDetailRspBo> rspBoList = Lists.newArrayList(); | 1083 | List<ArticleDetailRspBo> rspBoList = Lists.newArrayList(); |
1084 | + List<Integer> vitualUids = grassVirtualUserDao.getAllPlatUid();//所有的马甲用户 | ||
1060 | articleList.forEach(article -> { | 1085 | articleList.forEach(article -> { |
1061 | ArticleDetailRspBo rspBo = new ArticleDetailRspBo(); | 1086 | ArticleDetailRspBo rspBo = new ArticleDetailRspBo(); |
1062 | rspBo.setArticleId(article.getId()); | 1087 | rspBo.setArticleId(article.getId()); |
@@ -1076,6 +1101,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | @@ -1076,6 +1101,11 @@ public class GrassArticleServiceImpl implements IGrassArticleService{ | ||
1076 | rspBo.setPublishTime(DateUtil.long2DateStr(article.getCreateTime(),DateUtil.DATE_TIME_FORMAT)); | 1101 | rspBo.setPublishTime(DateUtil.long2DateStr(article.getCreateTime(),DateUtil.DATE_TIME_FORMAT)); |
1077 | rspBo.setAuthStatus(article.getAuthStatus()); | 1102 | rspBo.setAuthStatus(article.getAuthStatus()); |
1078 | rspBo.setSource(article.getArticleType()); | 1103 | rspBo.setSource(article.getArticleType()); |
1104 | + if(article.getArticleType() == ArticleTypeEnum.NORMAL.getValue()){//文章类型是1 的 | ||
1105 | + if(vitualUids.contains(article.getAuthorUid())){//属于马甲用户发布的 | ||
1106 | + rspBo.setSource(6); | ||
1107 | + } | ||
1108 | + } | ||
1079 | rspBo.setImgList(imgMap.get(article.getId())); | 1109 | rspBo.setImgList(imgMap.get(article.getId())); |
1080 | rspBo.setLabelList(labelMap.get(article.getId())); | 1110 | rspBo.setLabelList(labelMap.get(article.getId())); |
1081 | rspBo.setIsTop(article.getIsTop()); | 1111 | rspBo.setIsTop(article.getIsTop()); |
@@ -41,12 +41,11 @@ public class GrassRefreshCacheServiceImpl implements IGrassRefreshCacheService{ | @@ -41,12 +41,11 @@ public class GrassRefreshCacheServiceImpl implements IGrassRefreshCacheService{ | ||
41 | int clearCode = reqVO.getClearCode(); | 41 | int clearCode = reqVO.getClearCode(); |
42 | int uid = reqVO.getUid(); | 42 | int uid = reqVO.getUid(); |
43 | try{ | 43 | try{ |
44 | - String url = apiUrl + "?method=clear.grass.cache&elementId=" + elementId + "&clearCode=" + clearCode + "&uid=" + uid; | ||
45 | - logger.info("start refreshGrassCache, url is: {}, elementId is {}, clearCode is {},uid is {}", url, elementId, clearCode, uid); | 44 | + String url = apiUrl + "?method=clear.grass.cache&elementId=" + elementId + "&clearCode=" + clearCode + "&uid=" + uid+"&userType=" +reqVO.getUserType(); |
45 | + logger.info("before refreshGrassCache, url is: {}, reqVo is {}", url, reqVO); | ||
46 | serviceCaller.get("app.clearGrassCache", url, null, String.class, null); | 46 | serviceCaller.get("app.clearGrassCache", url, null, String.class, null); |
47 | - logger.info("success refreshGrassCache elementId is {}, clearCode is {},uid is {}", elementId, clearCode, uid); | ||
48 | }catch (Exception e){ | 47 | }catch (Exception e){ |
49 | - logger.info("fail refreshGrassCache, elementId is {}, clearCode is {},uid is {}, error is {}", elementId, clearCode, uid, e); | 48 | + logger.info("failed refreshGrassCache, reqVo is {}, error is {}", reqVO, e); |
50 | } | 49 | } |
51 | } | 50 | } |
52 | }); | 51 | }); |
@@ -105,7 +105,7 @@ | @@ -105,7 +105,7 @@ | ||
105 | textField : "text", | 105 | textField : "text", |
106 | required:false, | 106 | required:false, |
107 | prompt: "请选择来源", | 107 | prompt: "请选择来源", |
108 | - data:[{text:"全部",value:"0"},{text:"用户发布",value:"1"},{text:"guang资讯",value:"2"},{text:"mars",value:"3"},{text:"晒单",value:"4"}] | 108 | + 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"}] |
109 | }); | 109 | }); |
110 | 110 | ||
111 | $("#searchBtn").linkbutton({ | 111 | $("#searchBtn").linkbutton({ |
@@ -225,7 +225,7 @@ | @@ -225,7 +225,7 @@ | ||
225 | debugger | 225 | debugger |
226 | var str = ''; | 226 | var str = ''; |
227 | if(rowData.source == '1'){ | 227 | if(rowData.source == '1'){ |
228 | - str = "用户发布"; | 228 | + str = "普通用户"; |
229 | } | 229 | } |
230 | if(rowData.source == '2'){ | 230 | if(rowData.source == '2'){ |
231 | str = "guang"; | 231 | str = "guang"; |
@@ -236,6 +236,14 @@ | @@ -236,6 +236,14 @@ | ||
236 | if(rowData.source == '4'){ | 236 | if(rowData.source == '4'){ |
237 | str = "晒单"; | 237 | str = "晒单"; |
238 | } | 238 | } |
239 | + | ||
240 | + if(rowData.source == '5'){ | ||
241 | + str = "now"; | ||
242 | + } | ||
243 | + | ||
244 | + if(rowData.source == '6'){ | ||
245 | + str = "编辑"; | ||
246 | + } | ||
239 | return str; | 247 | return str; |
240 | } | 248 | } |
241 | 249 | ||
@@ -267,8 +275,13 @@ | @@ -267,8 +275,13 @@ | ||
267 | width: 50, | 275 | width: 50, |
268 | align: "center", | 276 | align: "center", |
269 | formatter: function (value, rowData, rowIndex) { | 277 | formatter: function (value, rowData, rowIndex) { |
278 | + | ||
279 | +// var str = "<a role='switchR' class='btn-success' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>审核</a>"; | ||
280 | +// 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>"; | ||
281 | + | ||
270 | var str = "<a role='validateR' dataId='"+rowData.articleId+ "' style='margin-left:10px' class='btn-success' >审核</a>"; | 282 | var str = "<a role='validateR' dataId='"+rowData.articleId+ "' style='margin-left:10px' class='btn-success' >审核</a>"; |
271 | 283 | ||
284 | + | ||
272 | // if(rowData.authStatus==0){//待审核状态--允许审核通过 和 不通过 | 285 | // if(rowData.authStatus==0){//待审核状态--允许审核通过 和 不通过 |
273 | // str += "<a role='switchR' class='btn-success' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>审核通过</a>"; | 286 | // str += "<a role='switchR' class='btn-success' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='1' style='margin-left:10px'>审核通过</a>"; |
274 | // str += "<a role='switchR' class='btn-success' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='2' style='margin-left:10px'>不通过</a>"; | 287 | // str += "<a role='switchR' class='btn-success' dataId='"+rowData.articleId+ "' index='"+ rowIndex + "' status='2' style='margin-left:10px'>不通过</a>"; |
@@ -305,21 +318,25 @@ | @@ -305,21 +318,25 @@ | ||
305 | $(this).datagrid("getPanel").find("a[role='switchR']").linkbutton({ | 318 | $(this).datagrid("getPanel").find("a[role='switchR']").linkbutton({ |
306 | iconCls : "icon-edit", | 319 | iconCls : "icon-edit", |
307 | onClick: function () { | 320 | onClick: function () { |
308 | - var status = $(this).attr("status"); | ||
309 | - var dataId = $(this).attr("dataId"); | ||
310 | - index = $(this).attr("index"); | ||
311 | - var message = ""; | ||
312 | - if(status == 1){ | ||
313 | - message = "审核通过"; | ||
314 | - } | ||
315 | - if(status == 2){ | ||
316 | - message = "审核不通过"; | ||
317 | - } | ||
318 | - $.messager.confirm("确认", "确认这篇文章"+message+"吗?", function (flag) { | ||
319 | - if(flag){ | ||
320 | - switchRecommend(dataId, status); | ||
321 | - } | ||
322 | - }); | 321 | + var dataId = $(this).attr("dataId"); |
322 | + //打开新页面 | ||
323 | + //contextPath+"/html/grass/articleAuthorizeManage/articleDetail.html?articleId="+rowData.articleId | ||
324 | + window.open(contextPath+"/html/grass/articleAuthorizeManage/articleDetail.html?articleId="+dataId); | ||
325 | +// var status = $(this).attr("status"); | ||
326 | +// var dataId = $(this).attr("dataId"); | ||
327 | +// index = $(this).attr("index"); | ||
328 | +// var message = ""; | ||
329 | +// if(status == 1){ | ||
330 | +// message = "审核通过"; | ||
331 | +// } | ||
332 | +// if(status == 2){ | ||
333 | +// message = "审核不通过"; | ||
334 | +// } | ||
335 | +// $.messager.confirm("确认", "确认这篇文章"+message+"吗?", function (flag) { | ||
336 | +// if(flag){ | ||
337 | +// switchRecommend(dataId, status); | ||
338 | +// } | ||
339 | +// }); | ||
323 | 340 | ||
324 | } | 341 | } |
325 | }); | 342 | }); |
@@ -74,9 +74,12 @@ | @@ -74,9 +74,12 @@ | ||
74 | 74 | ||
75 | <tr style="height: 60px"> | 75 | <tr style="height: 60px"> |
76 | <td> | 76 | <td> |
77 | - <div id="articleContent"> | 77 | + <div> |
78 | + <p id="articleContent" style=" white-space: pre-wrap;"> | ||
78 | 79 | ||
80 | + </p> | ||
79 | </div> | 81 | </div> |
82 | + | ||
80 | </td> | 83 | </td> |
81 | </tr> | 84 | </tr> |
82 | <tr style="height: 20px"> | 85 | <tr style="height: 20px"> |
@@ -149,6 +152,8 @@ | @@ -149,6 +152,8 @@ | ||
149 | nextEl: '.swiper-button-next', | 152 | nextEl: '.swiper-button-next', |
150 | prevEl: '.swiper-button-prev', | 153 | prevEl: '.swiper-button-prev', |
151 | }, | 154 | }, |
155 | + observer: true,//修改swiper自己或子元素时,自动初始化swiper | ||
156 | + observeParents: true//修改swiper的父元素时,自动初始化swiper | ||
152 | 157 | ||
153 | // // 如果需要滚动条 | 158 | // // 如果需要滚动条 |
154 | // scrollbar: { | 159 | // scrollbar: { |
@@ -236,6 +241,30 @@ | @@ -236,6 +241,30 @@ | ||
236 | }); | 241 | }); |
237 | 242 | ||
238 | 243 | ||
244 | + | ||
245 | +// var mySwiper = new Swiper('.swiper-container', { | ||
246 | +//// direction: 'vertical', // 垂直切换选项 | ||
247 | +//// loop: true, // 循环模式选项 | ||
248 | +// | ||
249 | +//// // 如果需要分页器 | ||
250 | +//// pagination: { | ||
251 | +//// el: '.swiper-pagination', | ||
252 | +//// }, | ||
253 | +// | ||
254 | +// // 如果需要前进后退按钮 | ||
255 | +// navigation: { | ||
256 | +// nextEl: '.swiper-button-next', | ||
257 | +// prevEl: '.swiper-button-prev', | ||
258 | +// }, | ||
259 | +// observer: true,//修改swiper自己或子元素时,自动初始化swiper | ||
260 | +// observeParents: true//修改swiper的父元素时,自动初始化swiper | ||
261 | +//// // 如果需要滚动条 | ||
262 | +//// scrollbar: { | ||
263 | +//// el: '.swiper-scrollbar', | ||
264 | +//// }, | ||
265 | +// }) | ||
266 | + | ||
267 | + | ||
239 | }); | 268 | }); |
240 | 269 | ||
241 | //获取url中的参数方法 | 270 | //获取url中的参数方法 |
@@ -111,7 +111,7 @@ | @@ -111,7 +111,7 @@ | ||
111 | textField : "text", | 111 | textField : "text", |
112 | required:false, | 112 | required:false, |
113 | prompt: "请选择来源", | 113 | prompt: "请选择来源", |
114 | - data:[{text:"全部",value:"0"},{text:"用户发布",value:"1"},{text:"guang资讯",value:"2"},{text:"mars",value:"3"},{text:"晒单",value:"4"},{text:"now社区",value:"5"}] | 114 | + 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"}] |
115 | }); | 115 | }); |
116 | 116 | ||
117 | // 检索按钮 | 117 | // 检索按钮 |
@@ -265,6 +265,9 @@ | @@ -265,6 +265,9 @@ | ||
265 | if(rowData.source == '5'){ | 265 | if(rowData.source == '5'){ |
266 | str = "now社区"; | 266 | str = "now社区"; |
267 | } | 267 | } |
268 | + if(rowData.source == '6'){ | ||
269 | + str = "编辑"; | ||
270 | + } | ||
268 | return str; | 271 | return str; |
269 | } | 272 | } |
270 | 273 |
-
Please register or login to post a comment