单列出 评论数量,点赞数量接口
This commit is contained in:
parent
e3c00ce7e7
commit
14c5a50b4d
@ -16,12 +16,14 @@ import com.cm.common.token.app.AppTokenManager;
|
|||||||
import com.cm.common.token.app.entity.AppToken;
|
import com.cm.common.token.app.entity.AppToken;
|
||||||
import com.cm.common.utils.UUIDUtil;
|
import com.cm.common.utils.UUIDUtil;
|
||||||
import com.cm.common.utils.WStringUtil;
|
import com.cm.common.utils.WStringUtil;
|
||||||
|
import com.cm.news.pojo.dtos.newscomment.NewsCommentCountDTO;
|
||||||
import com.cm.news.pojo.dtos.newscomment.NewsCommentDTO;
|
import com.cm.news.pojo.dtos.newscomment.NewsCommentDTO;
|
||||||
import com.cm.news.pojo.util.AntistopUtil;
|
import com.cm.news.pojo.util.AntistopUtil;
|
||||||
import com.cm.news.pojo.vos.newscomment.NewsCommentVO;
|
import com.cm.news.pojo.vos.newscomment.NewsCommentVO;
|
||||||
import com.cm.news.service.newscomment.INewsCommentService;
|
import com.cm.news.service.newscomment.INewsCommentService;
|
||||||
import com.github.pagehelper.util.StringUtil;
|
import com.github.pagehelper.util.StringUtil;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -29,6 +31,7 @@ import org.springframework.web.context.request.RequestContextHolder;
|
|||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -47,6 +50,18 @@ public class NewsCommentAppController extends AbstractController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private INewsCommentService newsCommentService;
|
private INewsCommentService newsCommentService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "新闻的评论数", notes = "新闻的评论数接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "newsContentIds", value = "新闻ID集,多个用_隔开", paramType = "query")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("getcountbynewscontentids" + ISystemConstant.APP_RELEASE_SUFFIX + "/{newsContentIds}")
|
||||||
|
public List<NewsCommentCountDTO> getCountbyNewsContentIds(@PathVariable("newsContentIds") String newsContentIds) throws SearchException {
|
||||||
|
String[] newsContentIdArr = newsContentIds.split("_");
|
||||||
|
List<String> newsContentIdList = Arrays.asList(newsContentIdArr);
|
||||||
|
return newsCommentService.countCountByNewsContentIds(newsContentIdList);
|
||||||
|
}
|
||||||
|
|
||||||
private String getRemortIP() throws Exception {
|
private String getRemortIP() throws Exception {
|
||||||
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||||
String ip = "";
|
String ip = "";
|
||||||
|
@ -13,7 +13,9 @@ import com.cm.common.result.SuccessResultData;
|
|||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
import com.cm.common.token.app.AppTokenManager;
|
import com.cm.common.token.app.AppTokenManager;
|
||||||
import com.cm.news.pojo.dtos.newscontent.NewsContentAppDTO;
|
import com.cm.news.pojo.dtos.newscontent.NewsContentAppDTO;
|
||||||
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectCountDTO;
|
||||||
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectDTO;
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectDTO;
|
||||||
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectionCountDTO;
|
||||||
import com.cm.news.pojo.vos.newscontentcollect.NewsContentCollectVO;
|
import com.cm.news.pojo.vos.newscontentcollect.NewsContentCollectVO;
|
||||||
import com.cm.news.service.newscontent.INewsContentService;
|
import com.cm.news.service.newscontent.INewsContentService;
|
||||||
import com.cm.news.service.newscontentcollect.INewsContentCollectService;
|
import com.cm.news.service.newscontentcollect.INewsContentCollectService;
|
||||||
@ -44,6 +46,18 @@ public class NewsContentCollectAppController extends AbstractController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
protected SecurityComponent securityComponent;
|
protected SecurityComponent securityComponent;
|
||||||
|
|
||||||
|
@ApiOperation(value = "新闻的收藏数", notes = "新闻的收藏数接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "newsContentIds", value = "新闻ID集,多个用_隔开", paramType = "query")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("getcountbynewscontentids" + ISystemConstant.APP_RELEASE_SUFFIX + "/{newsContentIds}")
|
||||||
|
public List<NewsContentCollectionCountDTO> getCountbyNewsContentIds(@PathVariable("newsContentIds") String newsContentIds) throws SearchException {
|
||||||
|
String[] newsContentIdArr = newsContentIds.split("_");
|
||||||
|
List<String> newsContentIdList = Arrays.asList(newsContentIdArr);
|
||||||
|
return newsContentCollectService.countCountByNewsContentIds(newsContentIdList);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "新增新闻收藏表", notes = "新增新闻收藏表接口")
|
@ApiOperation(value = "新增新闻收藏表", notes = "新增新闻收藏表接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||||
|
@ -10,6 +10,8 @@ import com.cm.common.result.ErrorResult;
|
|||||||
import com.cm.common.result.SuccessResult;
|
import com.cm.common.result.SuccessResult;
|
||||||
import com.cm.common.result.SuccessResultData;
|
import com.cm.common.result.SuccessResultData;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
|
import com.cm.news.pojo.dtos.newscomment.NewsCommentCountDTO;
|
||||||
|
import com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeCountDTO;
|
||||||
import com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeDTO;
|
import com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeDTO;
|
||||||
import com.cm.news.pojo.vos.newscontentlike.NewsContentLikeVO;
|
import com.cm.news.pojo.vos.newscontentlike.NewsContentLikeVO;
|
||||||
import com.cm.news.service.newscontentlike.INewsContentLikeService;
|
import com.cm.news.service.newscontentlike.INewsContentLikeService;
|
||||||
@ -36,6 +38,18 @@ public class NewsContentLikeAppController extends AbstractController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private INewsContentLikeService newsContentLikeService;
|
private INewsContentLikeService newsContentLikeService;
|
||||||
|
|
||||||
|
@ApiOperation(value = "新闻的点赞数", notes = "新闻的点赞数接口")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "newsContentIds", value = "新闻ID集,多个用_隔开", paramType = "query")
|
||||||
|
})
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("getcountbynewscontentids" + ISystemConstant.APP_RELEASE_SUFFIX + "/{newsContentIds}")
|
||||||
|
public List<NewsContentLikeCountDTO> getCountbyNewsContentIds(@PathVariable("newsContentIds") String newsContentIds) throws SearchException {
|
||||||
|
String[] newsContentIdArr = newsContentIds.split("_");
|
||||||
|
List<String> newsContentIdList = Arrays.asList(newsContentIdArr);
|
||||||
|
return newsContentLikeService.countCountByNewsContentIds(newsContentIdList);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "新增新闻点赞", notes = "新增新闻点赞接口")
|
@ApiOperation(value = "新增新闻点赞", notes = "新增新闻点赞接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
@ApiImplicitParam(name = "token", value = "token", paramType = "header")
|
||||||
|
@ -5,6 +5,7 @@ import com.cm.common.exception.SaveException;
|
|||||||
import com.cm.common.exception.SearchException;
|
import com.cm.common.exception.SearchException;
|
||||||
import com.cm.common.exception.UpdateException;
|
import com.cm.common.exception.UpdateException;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectCountDTO;
|
||||||
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectDTO;
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectDTO;
|
||||||
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectionCountDTO;
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectionCountDTO;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@ -102,4 +103,6 @@ public interface INewsContentCollectDao {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
List<NewsContentCollectDTO> listNewsContentCollectByNewsContentIdsAndUserId(Map<String, Object> map) throws SearchException;
|
List<NewsContentCollectDTO> listNewsContentCollectByNewsContentIdsAndUserId(Map<String, Object> map) throws SearchException;
|
||||||
|
|
||||||
|
List<NewsContentCollectCountDTO> getCountbyNewsContentIds(Map<String, Object> params) throws SearchException;
|
||||||
}
|
}
|
@ -6,6 +6,7 @@ import com.cm.common.exception.SearchException;
|
|||||||
import com.cm.common.exception.UpdateException;
|
import com.cm.common.exception.UpdateException;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
import com.cm.news.pojo.dtos.newscommentlike.NewsCommentLikeCountDTO;
|
import com.cm.news.pojo.dtos.newscommentlike.NewsCommentLikeCountDTO;
|
||||||
|
import com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeCountDTO;
|
||||||
import com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeDTO;
|
import com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeDTO;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@ -92,5 +93,5 @@ public interface INewsContentLikeDao {
|
|||||||
* @return
|
* @return
|
||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
List<NewsCommentLikeCountDTO> listCountByNewsContentIds(Map<String, Object> params) throws SearchException;
|
List<NewsContentLikeCountDTO> listCountByNewsContentIds(Map<String, Object> params) throws SearchException;
|
||||||
}
|
}
|
@ -6,8 +6,9 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
* @ClassName: NewsCommentDTO
|
* @ClassName: NewsCommentDTO
|
||||||
* @Description: 新闻评论记录表
|
* @Description: 新闻评论数
|
||||||
* @Author: WenG
|
* @Author: WenG
|
||||||
* @Date: 2020-05-07 14:01
|
* @Date: 2020-05-07 14:01
|
||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
@ -15,14 +16,13 @@ import java.io.Serializable;
|
|||||||
@ApiModel
|
@ApiModel
|
||||||
public class NewsCommentCountDTO implements Serializable {
|
public class NewsCommentCountDTO implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4018217677091807455L;
|
@ApiModelProperty(name = "newsContentId", value = "新闻内容ID")
|
||||||
@ApiModelProperty(name = "newsContentId", value = "新闻ID")
|
|
||||||
private String newsContentId;
|
private String newsContentId;
|
||||||
@ApiModelProperty(name = "count", value = "总数")
|
@ApiModelProperty(name = "count", value = "评论数量")
|
||||||
private Integer count;
|
private Integer count;
|
||||||
|
|
||||||
public String getNewsContentId() {
|
public String getNewsContentId() {
|
||||||
return newsContentId == null ? "" : newsContentId.trim();
|
return newsContentId == null ? "" : newsContentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNewsContentId(String newsContentId) {
|
public void setNewsContentId(String newsContentId) {
|
||||||
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.cm.news.pojo.dtos.newscontentcollect;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @ClassName: NewsContentCollectDTO
|
||||||
|
* @Description: 新闻收藏数
|
||||||
|
* @Author: WenG
|
||||||
|
* @Date: 2020-05-12 10:35
|
||||||
|
* @Version: 1.0
|
||||||
|
**/
|
||||||
|
@ApiModel
|
||||||
|
public class NewsContentCollectCountDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "newsContentId", value = "新闻ID")
|
||||||
|
private String newsContentId;
|
||||||
|
@ApiModelProperty(name = "collectCount", value = "收藏数")
|
||||||
|
private Integer collectCount;
|
||||||
|
|
||||||
|
public String getNewsContentId() {
|
||||||
|
return newsContentId == null ? "" : newsContentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewsContentId(String newsContentId) {
|
||||||
|
this.newsContentId = newsContentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCollectCount() {
|
||||||
|
return collectCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCollectCount(Integer collectCount) {
|
||||||
|
this.collectCount = collectCount;
|
||||||
|
}
|
||||||
|
}
|
@ -3,8 +3,6 @@ package com.cm.news.pojo.dtos.newscontentcollect;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @ClassName: NewsContentCollectDTO
|
* @ClassName: NewsContentCollectDTO
|
||||||
@ -14,9 +12,8 @@ import java.io.Serializable;
|
|||||||
* @Version: 1.0
|
* @Version: 1.0
|
||||||
**/
|
**/
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class NewsContentCollectDTO implements Serializable {
|
public class NewsContentCollectDTO {
|
||||||
|
|
||||||
private static final long serialVersionUID = 3774070218632818773L;
|
|
||||||
@ApiModelProperty(name = "newsContentCollectId", value = "主键")
|
@ApiModelProperty(name = "newsContentCollectId", value = "主键")
|
||||||
private String newsContentCollectId;
|
private String newsContentCollectId;
|
||||||
@ApiModelProperty(name = "newsContentId", value = "新闻")
|
@ApiModelProperty(name = "newsContentId", value = "新闻")
|
||||||
|
@ -1,28 +1,18 @@
|
|||||||
package com.cm.news.pojo.dtos.newscontentcollect;
|
package com.cm.news.pojo.dtos.newscontentcollect;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
|
||||||
* @ClassName: NewsCommentLikeCountDTO
|
|
||||||
* @Description: 新闻收藏统计
|
|
||||||
* @Author: WenG
|
|
||||||
* @Date: 2020-05-07 14:01
|
|
||||||
* @Version: 1.0
|
|
||||||
**/
|
|
||||||
@ApiModel
|
|
||||||
public class NewsContentCollectionCountDTO implements Serializable {
|
public class NewsContentCollectionCountDTO implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4024432852658941620L;
|
|
||||||
@ApiModelProperty(name = "newsContentId", value = "新闻ID")
|
@ApiModelProperty(name = "newsContentId", value = "新闻ID")
|
||||||
private String newsContentId;
|
private String newsContentId;
|
||||||
@ApiModelProperty(name = "count", value = "总数")
|
@ApiModelProperty(name = "count", value = "收藏数")
|
||||||
private Integer count;
|
private Integer count;
|
||||||
|
|
||||||
public String getNewsContentId() {
|
public String getNewsContentId() {
|
||||||
return newsContentId == null ? "" : newsContentId.trim();
|
return newsContentId == null ? "" : newsContentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setNewsContentId(String newsContentId) {
|
public void setNewsContentId(String newsContentId) {
|
||||||
@ -30,7 +20,7 @@ public class NewsContentCollectionCountDTO implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Integer getCount() {
|
public Integer getCount() {
|
||||||
return count == null ? 0 : count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCount(Integer count) {
|
public void setCount(Integer count) {
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.cm.news.pojo.dtos.newscontentlike;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @ClassName: NewsContentLikeDTO
|
||||||
|
* @Description: 新闻点赞数
|
||||||
|
* @Author: WenG
|
||||||
|
* @Date: 2020-05-12 10:33
|
||||||
|
* @Version: 1.0
|
||||||
|
**/
|
||||||
|
@ApiModel
|
||||||
|
public class NewsContentLikeCountDTO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "newsContentId", value = "新闻ID")
|
||||||
|
private String newsContentId;
|
||||||
|
@ApiModelProperty(name = "count", value = "点赞数量")
|
||||||
|
private Integer count;
|
||||||
|
|
||||||
|
public String getNewsContentId() {
|
||||||
|
return newsContentId == null ? "" : newsContentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewsContentId(String newsContentId) {
|
||||||
|
this.newsContentId = newsContentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getCount() {
|
||||||
|
return count == null ? 0 : count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCount(Integer count) {
|
||||||
|
this.count = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,7 +9,6 @@ import com.cm.news.pojo.dtos.newscomment.NewsCommentCountDTO;
|
|||||||
import com.cm.news.pojo.dtos.newscomment.NewsCommentDTO;
|
import com.cm.news.pojo.dtos.newscomment.NewsCommentDTO;
|
||||||
import com.cm.news.pojo.vos.newscomment.NewsCommentVO;
|
import com.cm.news.pojo.vos.newscomment.NewsCommentVO;
|
||||||
import com.cm.news.pojo.vos.newscomment.NewsCommentViolationVO;
|
import com.cm.news.pojo.vos.newscomment.NewsCommentViolationVO;
|
||||||
import com.cm.news.pojo.vos.newscommentlike.NewsCommentLikeVO;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -104,7 +103,7 @@ public interface INewsCommentService {
|
|||||||
* 新闻评论记录表分页列表
|
* 新闻评论记录表分页列表
|
||||||
*
|
*
|
||||||
* @param page
|
* @param page
|
||||||
* @return
|
* @returncountCountByNewsContentIds
|
||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
SuccessResultList<List<NewsCommentDTO>> listPageNewsComment(ListPage page) throws SearchException;
|
SuccessResultList<List<NewsCommentDTO>> listPageNewsComment(ListPage page) throws SearchException;
|
||||||
@ -117,8 +116,6 @@ public interface INewsCommentService {
|
|||||||
|
|
||||||
Integer getCountByNewsContentId(String newsContentId) throws SearchException;
|
Integer getCountByNewsContentId(String newsContentId) throws SearchException;
|
||||||
|
|
||||||
Integer getCountByNewsContentIds(List<String> newsContentIds) throws SearchException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计评论总数列表
|
* 统计评论总数列表
|
||||||
*
|
*
|
||||||
|
@ -256,17 +256,11 @@ public class NewsCommentServiceImpl extends BaseService implements INewsCommentS
|
|||||||
return newsCommentDao.getCountByNewsContentId(params);
|
return newsCommentDao.getCountByNewsContentId(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer getCountByNewsContentIds(List<String> newsContentIds) throws SearchException {
|
|
||||||
Map<String, Object> params = new HashMap<String, Object>();
|
|
||||||
params.put("newsContentIds", newsContentIds);
|
|
||||||
return newsCommentDao.getCountByNewsContentId(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NewsCommentCountDTO> countCountByNewsContentIds(List<String> newsContentIds) throws SearchException {
|
public List<NewsCommentCountDTO> countCountByNewsContentIds(List<String> newsContentIds) throws SearchException {
|
||||||
Map<String, Object> params = getHashMap(2);
|
Map<String, Object> params = getHashMap(2);
|
||||||
params.put("newsContentIds", newsContentIds);
|
params.put("newsContentIds", newsContentIds);
|
||||||
return newsCommentDao.listCountByNewsContentIds(params);
|
return newsCommentDao.listCountByNewsContentIds(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -380,14 +380,31 @@ public class NewsContentServiceImpl extends BaseService implements INewsContentS
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SuccessResultList<List<NewsContentAppDTO>> listPageNewsContentToApp(ListPage page) throws SearchException {
|
public SuccessResultList<List<NewsContentAppDTO>> listPageNewsContentToApp(ListPage page) throws SearchException {
|
||||||
List<String> userIds = iUserService.listUserIdAllByAreaId(page.getParams());
|
Map<String, Object> param = page.getParams();
|
||||||
|
// 1. 是否查询区域新闻
|
||||||
|
// 1. Start
|
||||||
|
boolean queryArea = false;
|
||||||
|
for(int i = 1 ; i <= 5 ; i++) {
|
||||||
|
if( param.get("area" + i) != null) {
|
||||||
|
queryArea = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(queryArea) {
|
||||||
|
List<String> userIds = iUserService.listUserIdAllByAreaId(param);
|
||||||
|
// 防止区域没有配置人的时候 , 不按区域userId查询 , 查出全部
|
||||||
|
if (userIds.size() < 1) {
|
||||||
|
userIds.add("-1");
|
||||||
|
}
|
||||||
page.getParams().put("createUserIdList", userIds );
|
page.getParams().put("createUserIdList", userIds );
|
||||||
|
}
|
||||||
|
page.getParams().put("queryArea", queryArea);
|
||||||
|
// 1. End
|
||||||
PageHelper.startPage(page.getPage(), page.getRows());
|
PageHelper.startPage(page.getPage(), page.getRows());
|
||||||
List<NewsContentAppDTO> newsContentDTOs = newsContentDao.listNewsContentToApp(page.getParams());
|
List<NewsContentAppDTO> newsContentDTOs = newsContentDao.listNewsContentToApp(page.getParams());
|
||||||
if (newsContentDTOs.isEmpty()) {
|
if (newsContentDTOs.isEmpty()) {
|
||||||
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
|
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
|
||||||
}
|
}
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
|
||||||
String userId = "";
|
String userId = "";
|
||||||
if (page.getParams().get("token") != null) {
|
if (page.getParams().get("token") != null) {
|
||||||
userId = AppTokenManager.getInstance().getToken(page.getParams().get("token").toString()).getAppTokenUser().getId();
|
userId = AppTokenManager.getInstance().getToken(page.getParams().get("token").toString()).getAppTokenUser().getId();
|
||||||
@ -399,14 +416,14 @@ public class NewsContentServiceImpl extends BaseService implements INewsContentS
|
|||||||
}
|
}
|
||||||
// 第一步 查找封面图片
|
// 第一步 查找封面图片
|
||||||
List<NewsContentCoverDTO> converList = iNewsContentCoverService.listNewsContentCoverByNewsContentIds(newsContentIds);
|
List<NewsContentCoverDTO> converList = iNewsContentCoverService.listNewsContentCoverByNewsContentIds(newsContentIds);
|
||||||
// 第二步 查找配置的标签项
|
// // 第二步 查找配置的标签项 || 2021年1月5日11:04:42 目前没有启用标签功能, 所以无需查询
|
||||||
List<NewsLabelConfigDTO> configList = iNewsLabelConfigService.listNewsLabelConfigByNewsContentIds(newsContentIds);
|
// List<NewsLabelConfigDTO> configList = iNewsLabelConfigService.listNewsLabelConfigByNewsContentIds(newsContentIds);
|
||||||
// 第三步 查找评论数
|
// // 第三步 查找评论数 || 2021年1月5日11:05:09 通过单独的app接口提供
|
||||||
List<NewsCommentCountDTO> newsCommentCountList = iNewsCommentService.countCountByNewsContentIds(newsContentIds);
|
// List<NewsCommentCountDTO> newsCommentCountList = iNewsCommentService.countCountByNewsContentIds(newsContentIds);
|
||||||
// 第四步 查找点赞数
|
// // 第四步 查找点赞数 || 2021年1月5日11:05:09 通过单独的app接口提供
|
||||||
List<NewsCommentLikeCountDTO> newsCommentLikeCountList = iNewsContentLikeService.countCountByNewsContentIds(newsContentIds);
|
// List<NewsCommentLikeCountDTO> newsCommentLikeCountList = iNewsContentLikeService.countCountByNewsContentIds(newsContentIds);
|
||||||
// 第五步 查找收藏数
|
// // 第五步 查找收藏数 || 2021年1月5日11:05:09 通过单独的app接口提供
|
||||||
List<NewsContentCollectionCountDTO> newsContentCollectionCountList = iNewsContentCollectService.countCountByNewsContentIds(newsContentIds);
|
// List<NewsContentCollectionCountDTO> newsContentCollectionCountList = iNewsContentCollectService.countCountByNewsContentIds(newsContentIds);
|
||||||
// 第六步 是否收藏
|
// 第六步 是否收藏
|
||||||
List<NewsContentCollectDTO> likeDTOs = new ArrayList<>();
|
List<NewsContentCollectDTO> likeDTOs = new ArrayList<>();
|
||||||
if (!StringUtil.isEmpty(userId)) {
|
if (!StringUtil.isEmpty(userId)) {
|
||||||
@ -421,32 +438,32 @@ public class NewsContentServiceImpl extends BaseService implements INewsContentS
|
|||||||
newsContentCoverDTOs.add(newsContentCoverDTO);
|
newsContentCoverDTOs.add(newsContentCoverDTO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 第二步 查找配置的标签项
|
// // 第二步 查找配置的标签项
|
||||||
List<NewsLabelConfigDTO> newsLabelConfigDTOs = new ArrayList<>();
|
// List<NewsLabelConfigDTO> newsLabelConfigDTOs = new ArrayList<>();
|
||||||
appDTO.setNewsContentLabelList(newsLabelConfigDTOs);
|
// appDTO.setNewsContentLabelList(newsLabelConfigDTOs);
|
||||||
for (NewsLabelConfigDTO newsLabelConfigDTO : configList) {
|
// for (NewsLabelConfigDTO newsLabelConfigDTO : configList) {
|
||||||
if (StringUtils.equals(appDTO.getNewsContentId(), newsLabelConfigDTO.getNewsContentId())) {
|
// if (StringUtils.equals(appDTO.getNewsContentId(), newsLabelConfigDTO.getNewsContentId())) {
|
||||||
newsLabelConfigDTOs.add(newsLabelConfigDTO);
|
// newsLabelConfigDTOs.add(newsLabelConfigDTO);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// 第三步 查找评论数
|
// // 第三步 查找评论数
|
||||||
for (NewsCommentCountDTO newsCommentCountDTO : newsCommentCountList) {
|
// for (NewsCommentCountDTO newsCommentCountDTO : newsCommentCountList) {
|
||||||
if (StringUtils.equals(appDTO.getNewsContentId(), newsCommentCountDTO.getNewsContentId())) {
|
// if (StringUtils.equals(appDTO.getNewsContentId(), newsCommentCountDTO.getNewsContentId())) {
|
||||||
appDTO.setNewsContentCommentNumber(newsCommentCountDTO.getCount());
|
// appDTO.setNewsContentCommentNumber(newsCommentCountDTO.getCount());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// 第四步 查找点赞数
|
// // 第四步 查找点赞数
|
||||||
for (NewsCommentLikeCountDTO newsCommentLikeCountDTO : newsCommentLikeCountList) {
|
// for (NewsCommentLikeCountDTO newsCommentLikeCountDTO : newsCommentLikeCountList) {
|
||||||
if (StringUtils.equals(appDTO.getNewsContentId(), newsCommentLikeCountDTO.getNewsContentId())) {
|
// if (StringUtils.equals(appDTO.getNewsContentId(), newsCommentLikeCountDTO.getNewsContentId())) {
|
||||||
appDTO.setNewsContentCollectionNumber(newsCommentLikeCountDTO.getCount());
|
// appDTO.setNewsContentCollectionNumber(newsCommentLikeCountDTO.getCount());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// 第五步 查找收藏数
|
// // 第五步 查找收藏数
|
||||||
for (NewsContentCollectionCountDTO newsContentCollectionDTO : newsContentCollectionCountList) {
|
// for (NewsContentCollectionCountDTO newsContentCollectionDTO : newsContentCollectionCountList) {
|
||||||
if (StringUtils.equals(appDTO.getNewsContentId(), newsContentCollectionDTO.getNewsContentId())) {
|
// if (StringUtils.equals(appDTO.getNewsContentId(), newsContentCollectionDTO.getNewsContentId())) {
|
||||||
appDTO.setNewsContentLikeNumber(newsContentCollectionDTO.getCount());
|
// appDTO.setNewsContentLikeNumber(newsContentCollectionDTO.getCount());
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// 第六步 是否收藏
|
// 第六步 是否收藏
|
||||||
if (!StringUtil.isEmpty(userId)) {
|
if (!StringUtil.isEmpty(userId)) {
|
||||||
for (NewsContentCollectDTO likeDTO : likeDTOs) {
|
for (NewsContentCollectDTO likeDTO : likeDTOs) {
|
||||||
|
@ -6,10 +6,10 @@ import com.cm.common.pojo.ListPage;
|
|||||||
import com.cm.common.result.SuccessResult;
|
import com.cm.common.result.SuccessResult;
|
||||||
import com.cm.common.result.SuccessResultData;
|
import com.cm.common.result.SuccessResultData;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectCountDTO;
|
||||||
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectDTO;
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectDTO;
|
||||||
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectionCountDTO;
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectionCountDTO;
|
||||||
import com.cm.news.pojo.vos.newscontentcollect.NewsContentCollectVO;
|
import com.cm.news.pojo.vos.newscontentcollect.NewsContentCollectVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -175,4 +175,5 @@ public interface INewsContentCollectService {
|
|||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
List<NewsContentCollectDTO> listNewsContentCollectByNewsContentIdsAndUserId(String userId, List<String> newsContentIds) throws SearchException;
|
List<NewsContentCollectDTO> listNewsContentCollectByNewsContentIdsAndUserId(String userId, List<String> newsContentIds) throws SearchException;
|
||||||
|
|
||||||
}
|
}
|
@ -11,6 +11,7 @@ import com.cm.common.token.app.AppTokenManager;
|
|||||||
import com.cm.common.utils.HashMapUtil;
|
import com.cm.common.utils.HashMapUtil;
|
||||||
import com.cm.common.utils.UUIDUtil;
|
import com.cm.common.utils.UUIDUtil;
|
||||||
import com.cm.news.dao.newscontentcollect.INewsContentCollectDao;
|
import com.cm.news.dao.newscontentcollect.INewsContentCollectDao;
|
||||||
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectCountDTO;
|
||||||
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectDTO;
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectDTO;
|
||||||
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectionCountDTO;
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectionCountDTO;
|
||||||
import com.cm.news.pojo.vos.newscontentcollect.NewsContentCollectVO;
|
import com.cm.news.pojo.vos.newscontentcollect.NewsContentCollectVO;
|
||||||
@ -223,4 +224,5 @@ public class NewsContentCollectServiceImpl extends BaseService implements INewsC
|
|||||||
map.put("newsContentIds", newsContentIds);
|
map.put("newsContentIds", newsContentIds);
|
||||||
return newsContentCollectDao.listNewsContentCollectByNewsContentIdsAndUserId(map);
|
return newsContentCollectDao.listNewsContentCollectByNewsContentIdsAndUserId(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -8,6 +8,7 @@ import com.cm.common.result.SuccessResult;
|
|||||||
import com.cm.common.result.SuccessResultData;
|
import com.cm.common.result.SuccessResultData;
|
||||||
import com.cm.common.result.SuccessResultList;
|
import com.cm.common.result.SuccessResultList;
|
||||||
import com.cm.news.pojo.dtos.newscommentlike.NewsCommentLikeCountDTO;
|
import com.cm.news.pojo.dtos.newscommentlike.NewsCommentLikeCountDTO;
|
||||||
|
import com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeCountDTO;
|
||||||
import com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeDTO;
|
import com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeDTO;
|
||||||
import com.cm.news.pojo.vos.newscontentlike.NewsContentLikeVO;
|
import com.cm.news.pojo.vos.newscontentlike.NewsContentLikeVO;
|
||||||
|
|
||||||
@ -165,5 +166,5 @@ public interface INewsContentLikeService {
|
|||||||
* @return
|
* @return
|
||||||
* @throws SearchException
|
* @throws SearchException
|
||||||
*/
|
*/
|
||||||
List<NewsCommentLikeCountDTO> countCountByNewsContentIds(List<String> newsContentIds) throws SearchException;
|
List<NewsContentLikeCountDTO> countCountByNewsContentIds(List<String> newsContentIds) throws SearchException;
|
||||||
}
|
}
|
@ -12,6 +12,7 @@ import com.cm.common.utils.UUIDUtil;
|
|||||||
import com.cm.news.dao.newscontentlike.INewsContentLikeDao;
|
import com.cm.news.dao.newscontentlike.INewsContentLikeDao;
|
||||||
import com.cm.news.pojo.dtos.newscommentlike.NewsCommentLikeCountDTO;
|
import com.cm.news.pojo.dtos.newscommentlike.NewsCommentLikeCountDTO;
|
||||||
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectDTO;
|
import com.cm.news.pojo.dtos.newscontentcollect.NewsContentCollectDTO;
|
||||||
|
import com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeCountDTO;
|
||||||
import com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeDTO;
|
import com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeDTO;
|
||||||
import com.cm.news.pojo.vos.newscontentlike.NewsContentLikeVO;
|
import com.cm.news.pojo.vos.newscontentlike.NewsContentLikeVO;
|
||||||
import com.cm.news.service.BaseService;
|
import com.cm.news.service.BaseService;
|
||||||
@ -210,7 +211,7 @@ public class NewsContentLikeServiceImpl extends BaseService implements INewsCont
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<NewsCommentLikeCountDTO> countCountByNewsContentIds(List<String> newsContentIds) throws SearchException {
|
public List<NewsContentLikeCountDTO> countCountByNewsContentIds(List<String> newsContentIds) throws SearchException {
|
||||||
Map<String, Object> params = new HashMap<String, Object>();
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
params.put("newsContentIds", newsContentIds);
|
params.put("newsContentIds", newsContentIds);
|
||||||
return newsContentLikeDao.listCountByNewsContentIds(params);
|
return newsContentLikeDao.listCountByNewsContentIds(params);
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
<select id="listCountByNewsContentIds" parameterType="map" resultMap="newsCommentCountDTO" useCache="true">
|
<select id="listCountByNewsContentIds" parameterType="map" resultMap="newsCommentCountDTO" useCache="true">
|
||||||
SELECT
|
SELECT
|
||||||
news_content_id,
|
news_content_id,
|
||||||
COUNT(*) count
|
COUNT(1) count
|
||||||
FROM
|
FROM
|
||||||
gen_news_comment
|
gen_news_comment
|
||||||
WHERE
|
WHERE
|
||||||
|
@ -324,8 +324,7 @@
|
|||||||
FROM gen_news_content_collect temp WHERE temp.
|
FROM gen_news_content_collect temp WHERE temp.
|
||||||
is_delete = 0 AND temp.creator = #{creator})
|
is_delete = 0 AND temp.creator = #{creator})
|
||||||
</if>
|
</if>
|
||||||
<if test="
|
<if test="newsDirectoriesId != null and newsDirectoriesId != ''">
|
||||||
newsDirectoriesId != null and newsDirectoriesId != ''">
|
|
||||||
AND t1.news_directories_id = #{newsDirectoriesId}
|
AND t1.news_directories_id = #{newsDirectoriesId}
|
||||||
</if>
|
</if>
|
||||||
<if test="newsDirectoriesParentId != null and newsDirectoriesParentId != ''">
|
<if test="newsDirectoriesParentId != null and newsDirectoriesParentId != ''">
|
||||||
@ -337,9 +336,9 @@
|
|||||||
<if test="currentUserId != null and currentUserId != ''">
|
<if test="currentUserId != null and currentUserId != ''">
|
||||||
AND (t1.creator = #{currentUserId} OR t1.modifier = #{currentUserId})
|
AND (t1.creator = #{currentUserId} OR t1.modifier = #{currentUserId})
|
||||||
</if>
|
</if>
|
||||||
<if test="createUserIdList != null and createUserIdList.size > 0">
|
<if test="queryArea and createUserIdList != null ">
|
||||||
AND ( t1.creator = '1' OR
|
<!-- 刚开始运行的时候 , 新闻都是admin填充的 , 因此需要将admin录入的都显示出来-->
|
||||||
t1.creator IN
|
AND ( t1.creator = '1' OR t1.creator IN
|
||||||
<foreach collection="createUserIdList" index="index" open="(" separator="," close=")">
|
<foreach collection="createUserIdList" index="index" open="(" separator="," close=")">
|
||||||
#{createUserIdList[${index}]}
|
#{createUserIdList[${index}]}
|
||||||
</foreach
|
</foreach
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<select id="listCountByNewsContentIds" parameterType="map" resultMap="newsContentCollectionCountDTO" useCache="true">
|
<select id="listCountByNewsContentIds" parameterType="map" resultMap="newsContentCollectionCountDTO" useCache="true">
|
||||||
SELECT
|
SELECT
|
||||||
news_content_id,
|
news_content_id,
|
||||||
COUNT(*) count
|
COUNT(1) count
|
||||||
FROM
|
FROM
|
||||||
gen_news_content_collect
|
gen_news_content_collect
|
||||||
WHERE
|
WHERE
|
||||||
|
@ -9,16 +9,16 @@
|
|||||||
<result column="news_content_id" property="newsContentId"/>
|
<result column="news_content_id" property="newsContentId"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="newsCommentLikeCountDTO" type="com.cm.news.pojo.dtos.newscommentlike.NewsCommentLikeCountDTO">
|
<resultMap id="newsContentLikeCountDTO" type="com.cm.news.pojo.dtos.newscontentlike.NewsContentLikeCountDTO">
|
||||||
<result column="news_content_id" property="newsContentId"/>
|
<result column="news_content_id" property="newsContentId"/>
|
||||||
<result column="count" property="count"/>
|
<result column="count" property="count"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 新闻点赞统计列表 -->
|
<!-- 新闻点赞统计列表 -->
|
||||||
<select id="listCountByNewsContentIds" parameterType="map" resultMap="newsCommentLikeCountDTO" useCache="true">
|
<select id="listCountByNewsContentIds" parameterType="map" resultMap="newsContentLikeCountDTO" useCache="true">
|
||||||
SELECT
|
SELECT
|
||||||
news_content_id,
|
news_content_id,
|
||||||
COUNT(*) count
|
COUNT(1) count
|
||||||
FROM
|
FROM
|
||||||
gen_news_content_like
|
gen_news_content_like
|
||||||
WHERE
|
WHERE
|
||||||
|
Loading…
Reference in New Issue
Block a user