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

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java |   69 +++++++++++++++++++++++++++++++---
 1 files changed, 63 insertions(+), 6 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 c82e518..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
@@ -188,6 +188,11 @@
     public R pageNeighborByAdmin(ComActNeighborCircleAdminDTO neighborCircleAdminDTO) {
         Page page = new Page(neighborCircleAdminDTO.getPageNum(), neighborCircleAdminDTO.getPageSize());
         IPage<ComActNeighborCircleAdminVO> doPager = this.baseMapper.pageNeighborByAdmin(page, neighborCircleAdminDTO);
+        doPager.getRecords().forEach(data->{
+            if(data.getUserType()!=1){
+                data.setReleaseName(data.getCommunityName());
+            }
+        });
         return R.ok(doPager);
     }
 
@@ -258,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){
@@ -269,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){
@@ -277,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){
@@ -454,9 +482,9 @@
         //邻里圈浏览器记录
         neighborCircleBrowseDAO.delete(new LambdaQueryWrapper<ComActNeighborCircleBrowseDO>()
                 .eq(ComActNeighborCircleBrowseDO::getNeighborId, id));
-        //邻里圈点赞删除 需要一层一层删
-/*        neighborCircleFabulousDAO.delete(new LambdaQueryWrapper<ComActNeighborCircleFabulousDO>()
-                .eq(ComActNeighborCircleFabulousDO::get))*/
+        //邻里圈点赞删除
+        neighborCircleFabulousDAO.delete(new LambdaQueryWrapper<ComActNeighborCircleFabulousDO>()
+                .eq(ComActNeighborCircleFabulousDO::getCircleId,id));
         return R.ok();
 
     }
@@ -559,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("未查询到点赞信息");
             }
@@ -567,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("未查询到点赞信息");
             }
@@ -575,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("未查询到点赞信息");
             }
@@ -605,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