From 8f64f78511bd79bcb75b66a3f918ce1e32c7704b Mon Sep 17 00:00:00 2001
From: 罗yu 元桥 <2376770955@qq.com>
Date: 星期五, 30 四月 2021 16:00:14 +0800
Subject: [PATCH] Merge branch 'test' into 'master'

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
index 6dafef1..f537bdf 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
@@ -263,6 +263,15 @@
         circleFabulousDO.setParentId(fabulousAppDTO.getServiceId());
         //判断点赞类型
         if(fabulousAppDTO.getType().equals(ComActNeighborFabulousAppDTO.type.llq)){
+
+            ComActNeighborCircleFabulousDO oldCircleFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
+                    new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborFabulousAppDTO.type.llq)
+                            .eq(ComActNeighborCircleFabulousDO::getParentId,fabulousAppDTO.getServiceId())
+                            .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes));
+            if(oldCircleFabulousDO != null){
+                return R.fail("您已点赞");
+            }
+
             //增加邻里圈点赞数量
             ComActNeighborCircleDO neighborCircleDO = this.baseMapper.selectById(fabulousAppDTO.getServiceId());
             if(neighborCircleDO != null){
@@ -274,6 +283,13 @@
             //添加邻里圈浏览记录
             comActNeighborCircleBrowseService.addBrowseRecord(fabulousAppDTO.getServiceId(),fabulousAppDTO.getUserId());
         }else if(fabulousAppDTO.getType().equals(ComActNeighborFabulousAppDTO.type.pl)){
+            ComActNeighborCircleFabulousDO oldCircleFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
+                    new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborFabulousAppDTO.type.pl)
+                            .eq(ComActNeighborCircleFabulousDO::getParentId,fabulousAppDTO.getServiceId())
+                            .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes));
+            if(oldCircleFabulousDO != null){
+                return R.fail("您已点赞");
+            }
             //增加邻里圈评论点赞数量
             ComActNeighborCircleCommentDO circleCommentDO = comActNeighborCircleCommentDAO.selectById(fabulousAppDTO.getServiceId());
             if(circleCommentDO != null){
@@ -282,6 +298,13 @@
                 circleFabulousDO.setCircleId(circleCommentDO.getCircleId());
             }
         }else if(fabulousAppDTO.getType().equals(ComActNeighborFabulousAppDTO.type.hf)){
+            ComActNeighborCircleFabulousDO oldCircleFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
+                    new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborFabulousAppDTO.type.hf)
+                            .eq(ComActNeighborCircleFabulousDO::getParentId,fabulousAppDTO.getServiceId())
+                            .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes));
+            if(oldCircleFabulousDO != null){
+                return R.fail("您已点赞");
+            }
             //增加邻里圈评论回复点赞数量
             ComActNeighborCircleCommentReplyDO circleCommentReplyDO = comActNeighborCircleCommentReplyDAO.selectById(fabulousAppDTO.getServiceId());
             if(circleCommentReplyDO != null){
@@ -564,7 +587,8 @@
             circleFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
                     new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getParentId,fabulousAppDTO.getServiceId())
                             .eq(ComActNeighborCircleFabulousDO::getUserId,fabulousAppDTO.getUserId())
-                            .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.llq));
+                            .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.llq)
+                            .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes));
             if(circleFabulousDO == null){
                 return R.fail("未查询到点赞信息");
             }
@@ -572,7 +596,8 @@
             circleFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
                     new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getParentId,fabulousAppDTO.getServiceId())
                             .eq(ComActNeighborCircleFabulousDO::getUserId,fabulousAppDTO.getUserId())
-                            .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.pl));
+                            .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.pl)
+                            .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes));
             if(circleFabulousDO == null){
                 return R.fail("未查询到点赞信息");
             }
@@ -580,7 +605,8 @@
             circleFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
                     new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getParentId,fabulousAppDTO.getServiceId())
                             .eq(ComActNeighborCircleFabulousDO::getUserId,fabulousAppDTO.getUserId())
-                            .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.hf));
+                            .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.hf)
+                            .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes));
             if(circleFabulousDO == null){
                 return R.fail("未查询到点赞信息");
             }
@@ -610,4 +636,30 @@
         }
         return R.ok();
     }
+
+    /**
+     * 分页查询评论下所有回复
+     * @param commentReplyAppDTO    请求参数
+     * @return  回复列表
+     */
+    @Override
+    public R neighborCommentReplyByApp(ComActNeighborCommentReplyAppDTO commentReplyAppDTO){
+        IPage<ComActNeighborCommentReplyAppVO> neighborCircleIPage = this.baseMapper.neighborCommentReplyByApp(
+                new Page<>(commentReplyAppDTO.getPageNum(),commentReplyAppDTO.getPageSize()),commentReplyAppDTO.getCommentId());
+        if(!neighborCircleIPage.getRecords().isEmpty()){
+            for (ComActNeighborCommentReplyAppVO commentReplyAppVO:neighborCircleIPage.getRecords()) {
+                //查询点赞信息
+                ComActNeighborCircleFabulousDO circleFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
+                        new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getParentId,commentReplyAppVO.getId())
+                                .eq(ComActNeighborCircleFabulousDO::getUserId,commentReplyAppDTO.getUserId())
+                                .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.hf));
+                if(circleFabulousDO != null && circleFabulousDO.getIsEffective().equals(ComActNeighborCircleFabulousDO.isEffective.yes)){
+                    commentReplyAppVO.setHaveSign(1);
+                }else{
+                    commentReplyAppVO.setHaveSign(2);
+                }
+            }
+        }
+        return R.ok(neighborCircleIPage);
+    }
 }

--
Gitblit v1.7.1