From de91c84954157bb9f8b6d938cbe0b1b51fb6e65d Mon Sep 17 00:00:00 2001
From: CeDo <cedoogle@gmail.com>
Date: 星期五, 07 五月 2021 15:23:57 +0800
Subject: [PATCH] bugfixed:新增便民服务商家 报错

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java |   58 ++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 46 insertions(+), 12 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 f537bdf..6ab3ae2 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
@@ -1,5 +1,6 @@
 package com.panzhihua.service_community.service.impl;
 
+import java.util.ArrayList;
 import java.util.Date;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -84,8 +85,9 @@
                 ComActNeighborCircleFabulousDO circleFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
                         new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getParentId,circleAppVO.getId())
                 .eq(ComActNeighborCircleFabulousDO::getUserId,neighborCircleAppDTO.getUserId())
-                                .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.llq));
-                if(circleFabulousDO != null && circleFabulousDO.getIsEffective().equals(ComActNeighborCircleFabulousDO.isEffective.yes)){
+                                .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.llq)
+                                .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes));
+                if(circleFabulousDO != null){
                     circleAppVO.setHaveSign(1);
                 }else{
                     circleAppVO.setHaveSign(2);
@@ -139,8 +141,9 @@
         ComActNeighborCircleFabulousDO circleFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
                 new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getParentId,circleDetailAppVO.getId())
                         .eq(ComActNeighborCircleFabulousDO::getUserId,neighborCircleAppDTO.getUserId())
-                        .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.llq));
-        if(circleFabulousDO != null && circleFabulousDO.getIsEffective().equals(ComActNeighborCircleFabulousDO.isEffective.yes)){
+                        .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.llq)
+                        .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes));
+        if(circleFabulousDO != null){
             circleDetailAppVO.setHaveSign(1);
         }else{
             circleDetailAppVO.setHaveSign(2);
@@ -155,8 +158,9 @@
                 ComActNeighborCircleFabulousDO circleCommentFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
                         new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getParentId,circleCommentVo.getId())
                                 .eq(ComActNeighborCircleFabulousDO::getUserId,neighborCircleAppDTO.getUserId())
-                                .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.pl));
-                if(circleCommentFabulousDO != null && circleCommentFabulousDO.getIsEffective().equals(ComActNeighborCircleFabulousDO.isEffective.yes)){
+                                .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.pl)
+                                .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes));
+                if(circleCommentFabulousDO != null){
                     circleCommentVo.setHaveSign(1);
                 }else{
                     circleCommentVo.setHaveSign(2);
@@ -164,19 +168,28 @@
                 //查询评论下评论回复
                 List<ComActNeighborCircleCommentReplyAppVO> commentReplyAppVOS = comActNeighborCircleCommentReplyDAO.getCircleCommentReplyList(circleCommentVo.getId());
                 if(!commentReplyAppVOS.isEmpty()){
+                    List<ComActNeighborCircleCommentReplyAppVO> newCommentReplyAppVOS = new ArrayList<>();
+                    int i = 0;
                     for (ComActNeighborCircleCommentReplyAppVO commentReplyVO:commentReplyAppVOS) {
+                        if(i >= 2){
+                            break;
+                        }
                         //查询点赞信息
                         ComActNeighborCircleFabulousDO circleReplyFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
                                 new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getParentId,commentReplyVO.getId())
                                         .eq(ComActNeighborCircleFabulousDO::getUserId,neighborCircleAppDTO.getUserId())
-                                        .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.hf));
-                        if(circleReplyFabulousDO != null && circleReplyFabulousDO.getIsEffective().equals(ComActNeighborCircleFabulousDO.isEffective.yes)){
+                                        .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.hf)
+                                        .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes));
+                        if(circleReplyFabulousDO != null){
                             commentReplyVO.setHaveSign(1);
                         }else{
                             commentReplyVO.setHaveSign(2);
                         }
+                        newCommentReplyAppVOS.add(commentReplyVO);
+                        i++;
                     }
-                    circleCommentVo.setCircleCommentReplyAppList(commentReplyAppVOS);
+                    circleCommentVo.setCircleCommentReplyAppList(newCommentReplyAppVOS);
+                    circleCommentVo.setCommentReplyNum(commentReplyAppVOS.size());
                 }
             }
         }
@@ -233,7 +246,7 @@
             neighborCircleDO.setRefuseReason(editVO.getRefuseReason());
         }
         this.baseMapper.updateById(neighborCircleDO);
-        return R.ok();
+        return R.ok(neighborCircleDO.getReleaseId());
     }
 
     /**
@@ -592,6 +605,13 @@
             if(circleFabulousDO == null){
                 return R.fail("未查询到点赞信息");
             }
+
+            //减少邻里圈点赞数量
+            ComActNeighborCircleDO neighborCircleDO = this.baseMapper.selectById(fabulousAppDTO.getServiceId());
+            if(neighborCircleDO != null){
+                neighborCircleDO.setFabulousNum(neighborCircleDO.getFabulousNum() - 1);
+                this.baseMapper.updateById(neighborCircleDO);
+            }
         }else if(fabulousAppDTO.getType().equals(ComActNeighborFabulousAppDTO.type.pl)){
             circleFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
                     new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getParentId,fabulousAppDTO.getServiceId())
@@ -601,6 +621,13 @@
             if(circleFabulousDO == null){
                 return R.fail("未查询到点赞信息");
             }
+
+            //减少邻里圈评论点赞数量
+            ComActNeighborCircleCommentDO circleCommentDO = comActNeighborCircleCommentDAO.selectById(fabulousAppDTO.getServiceId());
+            if(circleCommentDO != null){
+                circleCommentDO.setFabulousNum(circleCommentDO.getFabulousNum() - 1);
+                comActNeighborCircleCommentDAO.updateById(circleCommentDO);
+            }
         }else if(fabulousAppDTO.getType().equals(ComActNeighborFabulousAppDTO.type.hf)){
             circleFabulousDO = comActNeighborCircleFabulousDAO.selectOne(
                     new QueryWrapper<ComActNeighborCircleFabulousDO>().lambda().eq(ComActNeighborCircleFabulousDO::getParentId,fabulousAppDTO.getServiceId())
@@ -609,6 +636,12 @@
                             .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes));
             if(circleFabulousDO == null){
                 return R.fail("未查询到点赞信息");
+            }
+            //减少邻里圈评论回复点赞数量
+            ComActNeighborCircleCommentReplyDO circleCommentReplyDO = comActNeighborCircleCommentReplyDAO.selectById(fabulousAppDTO.getServiceId());
+            if(circleCommentReplyDO != null){
+                circleCommentReplyDO.setFabulousNum(circleCommentReplyDO.getFabulousNum() - 1);
+                comActNeighborCircleCommentReplyDAO.updateById(circleCommentReplyDO);
             }
         }
         if(circleFabulousDO != null){
@@ -652,8 +685,9 @@
                 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)){
+                                .eq(ComActNeighborCircleFabulousDO::getType,ComActNeighborCircleFabulousDO.type.hf)
+                                .eq(ComActNeighborCircleFabulousDO::getIsEffective,ComActNeighborCircleFabulousDO.isEffective.yes));
+                if(circleFabulousDO != null){
                     commentReplyAppVO.setHaveSign(1);
                 }else{
                     commentReplyAppVO.setHaveSign(2);

--
Gitblit v1.7.1