From a51d370e1d709fcc4b75e2af2fc18fbaed08f31d Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期五, 30 四月 2021 15:55:28 +0800
Subject: [PATCH] 名字为null问题修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java |   81 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 74 insertions(+), 7 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 1f655da..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);
     }
 
@@ -224,7 +229,9 @@
             return R.fail("id有误!");
         }
         neighborCircleDO.setStatus(editVO.getStatus());
-        neighborCircleDO.setRefuseReason(editVO.getRefuseReason());
+        if(editVO.getRefuseReason()!=null){
+            neighborCircleDO.setRefuseReason(editVO.getRefuseReason());
+        }
         this.baseMapper.updateById(neighborCircleDO);
         return R.ok();
     }
@@ -256,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){
@@ -267,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){
@@ -275,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){
@@ -452,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();
 
     }
@@ -501,8 +531,10 @@
         if(commentDO==null){
             return R.fail("id有误!");
         }
+        AdministratorsUserVO user = this.baseMapper.selectUserByUserId(commentDO.getUserId());
         ComActNeighborCommentByAdminVO vo = new ComActNeighborCommentByAdminVO();
         BeanUtils.copyProperties(commentDO,vo);
+        vo.setUserName(user.getName());
         return R.ok(vo);
     }
 
@@ -510,6 +542,9 @@
     public R detailNeighborCommentAllReply(DetailNeighborCommentReplyByAdminDTO dto) {
         Page<ComActNeighborCircleCommentReplyDO> page = new Page<>(dto.getPageNum(),dto.getPageSize());
         Page<ComActNeighborCommentReplyByAdminVO> replyPage = neighborCircleCommentReplyDAO.selectListByComment(page, dto);
+        replyPage.getRecords().forEach(reply->{
+
+        });
         return R.ok(replyPage);
     }
 
@@ -519,8 +554,11 @@
         if(replyDO==null){
             return R.fail("id有误!");
         }
+        AdministratorsUserVO user = this.baseMapper.selectUserByUserId(replyDO.getUserId());
         ComActNeighborCommentReplyByAdminVO vo = new ComActNeighborCommentReplyByAdminVO();
         BeanUtils.copyProperties(replyDO,vo);
+        vo.setUserName(user.getName());
+        vo.setUserPhone(user.getPhone());
         return R.ok(vo);
     }
 
@@ -549,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("未查询到点赞信息");
             }
@@ -557,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("未查询到点赞信息");
             }
@@ -565,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("未查询到点赞信息");
             }
@@ -595,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