Selaa lähdekoodia

物业管理端评论

tjf 3 kuukautta sitten
vanhempi
commit
2f9e9b9e07
49 muutettua tiedostoa jossa 2016 lisäystä ja 424 poistoa
  1. 3 2
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/assets/CommunityAssetsController.java
  2. 34 6
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/communityNews/CommentIndexController.java
  3. 15 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/communityNews/CommentLikesController.java
  4. 22 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/communityNews/CommentStarsController.java
  5. 3 2
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/houseInfo/HouseInfoController.java
  6. 1 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/partyNews/PartyNewsController.java
  7. 41 0
      ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java
  8. 85 1
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/ResidentInfo.java
  9. 15 6
      ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java
  10. 10 1
      ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java
  11. 73 3
      ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java
  12. 1 1
      ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/CommentContent.java
  13. 13 1
      ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/CommentIndex.java
  14. 4 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/CommentLikes.java
  15. 32 18
      ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/CommentStars.java
  16. 59 27
      ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/CommunityNews.java
  17. 37 24
      ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/CommentChildrenVo.java
  18. 227 0
      ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/CommentIndexShVo.java
  19. 31 18
      ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/CommentIndexVo.java
  20. 2 17
      ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/CommentUser.java
  21. 2 18
      ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/TargetUser.java
  22. 33 25
      ruoyi-system/src/main/java/com/ruoyi/system/domain/houseInfo/HouseInfo.java
  23. 38 21
      ruoyi-system/src/main/java/com/ruoyi/system/domain/partyNews/PartyNews.java
  24. 28 24
      ruoyi-system/src/main/java/com/ruoyi/system/domain/proprietorCar/ProprietorCar.java
  25. 89 0
      ruoyi-system/src/main/java/com/ruoyi/system/listener/RedisKeyExpirationListener.java
  26. 9 2
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/CommentContentMapper.java
  27. 25 2
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/CommentIndexMapper.java
  28. 7 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/CommentLikesMapper.java
  29. 7 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/CommentStarsMapper.java
  30. 9 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/CommunityNewsMapper.java
  31. 8 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/HouseInfoMapper.java
  32. 16 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/ICommentIndexService.java
  33. 6 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/ICommentLikesService.java
  34. 15 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/ICommentStarsService.java
  35. 7 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/IHouseInfoService.java
  36. 129 22
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommentIndexServiceImpl.java
  37. 284 21
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommentLikesServiceImpl.java
  38. 133 22
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommentStarsServiceImpl.java
  39. 43 1
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommunityNewsServiceImpl.java
  40. 10 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/HouseInfoServiceImpl.java
  41. 34 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PartyNewsServiceImpl.java
  42. 57 27
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProprietorCarServiceImpl.java
  43. 9 2
      ruoyi-system/src/main/resources/mapper/system/CommentContentMapper.xml
  44. 132 40
      ruoyi-system/src/main/resources/mapper/system/CommentIndexMapper.xml
  45. 15 2
      ruoyi-system/src/main/resources/mapper/system/CommentLikesMapper.xml
  46. 26 17
      ruoyi-system/src/main/resources/mapper/system/CommentStarsMapper.xml
  47. 3 0
      ruoyi-system/src/main/resources/mapper/system/CommunityNewsMapper.xml
  48. 56 1
      ruoyi-system/src/main/resources/mapper/system/HouseInfoMapper.xml
  49. 78 46
      ruoyi-system/src/main/resources/mapper/system/ResidentInfoMapper.xml

+ 3 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/assets/CommunityAssetsController.java

@@ -11,6 +11,7 @@ import com.ruoyi.system.service.ICommunityAssetsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
+
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
@@ -65,7 +66,7 @@ public class CommunityAssetsController extends BaseController {
     @Log(title = "社区资产", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody CommunityAssets communityAssets) {
-        if (!communityAssetsService.checkEquipmentNumberUnique(communityAssets)){
+        if (!communityAssetsService.checkEquipmentNumberUnique(communityAssets)) {
             {
                 return error("新增资产'" + communityAssets.getAssetName() + "'失败,资产编号已存在");
             }
@@ -80,7 +81,7 @@ public class CommunityAssetsController extends BaseController {
     @Log(title = "社区资产", businessType = BusinessType.UPDATE)
     @PostMapping("/put")
     public AjaxResult edit(@RequestBody CommunityAssets communityAssets) {
-        if (!communityAssetsService.checkEquipmentNumberUnique(communityAssets)){
+        if (!communityAssetsService.checkEquipmentNumberUnique(communityAssets)) {
             {
                 return error("新增资产'" + communityAssets.getAssetName() + "'失败,资产编号已存在");
             }

+ 34 - 6
ruoyi-admin/src/main/java/com/ruoyi/web/controller/communityNews/CommentIndexController.java

@@ -8,6 +8,8 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.domain.communityNews.CommentIndex;
+import com.ruoyi.system.domain.communityNews.vo.CommentIndexShVo;
+import com.ruoyi.system.domain.communityNews.vo.CommentIndexVo;
 import com.ruoyi.system.service.ICommentIndexService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -39,6 +41,18 @@ public class CommentIndexController extends BaseController {
         return getDataTable(list);
     }
 
+
+    /**
+     * 查询社区资讯评论-----审核列表
+     */
+    @PreAuthorize("@ss.hasPermi('wuYe:commentIndex:commentSh')")
+    @GetMapping("/commentSh")
+    public TableDataInfo commentSh(CommentIndexShVo commentIndexShVo) {
+        startPage();
+        List<CommentIndexShVo> list = commentIndexService.commentSh(commentIndexShVo);
+        return getDataTable(list);
+    }
+
     /**
      * 导出社区资讯评论列表
      */
@@ -51,15 +65,29 @@ public class CommentIndexController extends BaseController {
         util.exportExcel(response, list, "社区资讯评论数据");
     }
 
+
     /**
-     * 查询所有评论组装成前端所需要的数据结构
+     * 根据查询所有一级评论组带子集总数组装成前端所需要的数据结构 带分页
      */
     @Anonymous
     @PostMapping(value = "/getRootComment", name = "查询一级评论")
-    public AjaxResult getRootComment(CommentIndex commentIndex) {
-        return commentIndexService.getAllComment(commentIndex);
+    public TableDataInfo getRootComment(@RequestBody CommentIndex commentIndex) {
+        startPage();
+        List<CommentIndexVo> rootComment = commentIndexService.getRootComment(commentIndex);
+        return getDataTable(rootComment);
+    }
+
+    /**
+     * 根据parent_id查询所有评论组装成前端所需要的子集数据结构 带分页
+     */
+    @Anonymous
+    @PostMapping(value = "/getParentComment", name = "查询子级评论")
+    public AjaxResult getParentComment(@RequestBody CommentIndex commentIndex) {
+        startPage();
+        return commentIndexService.getParentComment(commentIndex);
     }
 
+
     /**
      * 获取社区资讯评论详细信息
      */
@@ -94,8 +122,8 @@ public class CommentIndexController extends BaseController {
      */
     @PreAuthorize("@ss.hasPermi('wuYe:commentIndex:remove')")
     @Log(title = "社区资讯评论", businessType = BusinessType.DELETE)
-    @GetMapping("/delete/{commentIds}")
-    public AjaxResult remove(@PathVariable Long[] commentIds) {
-        return toAjax(commentIndexService.deleteCommentIndexByCommentIds(commentIds));
+    @GetMapping("/delete/{commentId}")
+    public AjaxResult remove(@PathVariable Long commentId) {
+        return toAjax(commentIndexService.deleteCommentIndexByCommentId(commentId));
     }
 }

+ 15 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/communityNews/CommentLikesController.java

@@ -1,11 +1,14 @@
 package com.ruoyi.web.controller.communityNews;
 
+import com.ruoyi.common.annotation.Anonymous;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.manager.AsyncManager;
+import com.ruoyi.framework.manager.factory.AsyncFactory;
 import com.ruoyi.system.domain.communityNews.CommentLikes;
 import com.ruoyi.system.service.ICommentLikesService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -88,4 +91,16 @@ public class CommentLikesController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] likesIds) {
         return toAjax(commentLikesService.deleteCommentLikesByLikesIds(likesIds));
     }
+
+
+    /**
+     * 进行点赞操作
+     */
+    @PostMapping("/giveTheThumbs")
+    @Anonymous
+    public AjaxResult giveTheThumbs(@RequestBody CommentLikes commentLikes) {
+        AsyncManager.me().execute(AsyncFactory.giveTheThumbs(commentLikes));
+        System.out.println("点赞返回");
+        return  AjaxResult.success();
+    }
 }

+ 22 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/communityNews/CommentStarsController.java

@@ -6,6 +6,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.manager.AsyncManager;
+import com.ruoyi.framework.manager.factory.AsyncFactory;
 import com.ruoyi.system.domain.communityNews.CommentStars;
 import com.ruoyi.system.service.ICommentStarsService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -88,4 +90,24 @@ public class CommentStarsController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] starsIds) {
         return toAjax(commentStarsService.deleteCommentStarsByStarsIds(starsIds));
     }
+
+
+    /**
+     * 社区资讯收藏或取消收藏
+     */
+    @Log(title = "社区资讯收藏", businessType = BusinessType.INSERT)
+    @PostMapping("/getStars")
+    public AjaxResult getStars(@RequestBody CommentStars commentStars) {
+        AsyncManager.me().execute(AsyncFactory.getStars(commentStars));
+        return AjaxResult.success();
+    }
+
+    /**
+     * 党建收藏或取消收藏
+     */
+    @PostMapping("/getPartyNewsStars")
+    public AjaxResult getPartyNewsStars(@RequestBody CommentStars commentStars) {
+        AsyncManager.me().execute(AsyncFactory.getPartyNewsStars(commentStars));
+        return AjaxResult.success();
+    }
 }

+ 3 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/houseInfo/HouseInfoController.java

@@ -3,6 +3,7 @@ package com.ruoyi.web.controller.houseInfo;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.ResidentInfo;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
@@ -33,9 +34,9 @@ public class HouseInfoController extends BaseController {
      */
     @PreAuthorize("@ss.hasPermi('wuYe:houseInfo:list')")
     @GetMapping("/list")
-    public TableDataInfo list(HouseInfo houseInfo) {
+    public TableDataInfo list(ResidentInfo residentInfo) {
         startPage();
-        List<HouseInfo> list = houseInfoService.selectHouseInfoList(houseInfo);
+        List<ResidentInfo> list = houseInfoService.selectHouseInfoListAndResidentInfo(residentInfo);
         return getDataTable(list);
     }
 

+ 1 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/partyNews/PartyNewsController.java

@@ -88,4 +88,5 @@ public class PartyNewsController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] partyIds) {
         return toAjax(partyNewsService.deletePartyNewsByPartyIds(partyIds));
     }
+
 }

+ 41 - 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java

@@ -175,4 +175,45 @@ public class Constants
     public static final String TWO ="2";
     public static final String THR ="3";
     public static final String FOR ="4";
+
+
+    //------------------文章的key----------------------------
+    //社区资讯文章点赞的人员集合的key value = 该文章的[userId]
+    public static final String ONE_LIKE ="one_like:";
+    //对应用户点赞的文章key=my_like_one:{用户id} value =[资讯文章id]
+    public static final String ONE_MY_LIKE ="one_my_like:";
+    //社区资讯文章点赞的数量 给数据库同步数据在 redis中增加一个有过期时间的key key=one_like_count_time:{文章id}#{数量}  过期时候value获取不到
+    public static final String ONE_LIKE_COUNT_TIME ="one_like_count_time:";
+    //社区资讯文章点赞的数量永久key key=like_one_count:{文章id} value = 该文章的点赞数量
+    public static final String ONE_LIKE_COUNT="one_like_count:";
+
+    //------------------社区资讯key----------------------------
+    //社区资讯评论的总数量 key=community_comment_count:{communityId} value = 评论的数量
+    public static final String COMMUNITY_COMMENT_COUNT="community_comment_count:";
+    //------------------回复的key----------------------------
+    //社区资讯回复点赞的人员集合的key value = 该回复的[userId]
+    public static final String TWO_LIKE ="two_like:";
+    //对应用户点赞的回复key=my_like_two:{用户id} value = [评论id]
+    public static final String TWO_MY_LIKE ="two_my_like:";
+    //社区资讯评论点赞的数量 给数据库同步数据在 redis中增加一个有过期时间的key key=two_like_count_time:{评论id}#{数量} 过期时候value获取不到
+    public static final String TWO_LIKE_COUNT_TIME ="two_like_count_time:";
+    //社区资讯评论点赞的数量永久key key=like_one_count:{评论id} value = 该评论的点赞数量
+    public static final String TWO_LIKE_COUNT="two_like_count:";
+
+    //-------------------社区资讯收藏的key-----------------
+    //社区资讯收藏的人员集合的key = stars_community:{communityId} value = 该资讯收藏的[userId]
+    public static final String STARS_COMMUNITY ="stars_community:";
+    //社区资讯收藏的总数的key = stars_user_count:{communityId} value = 收藏的人数值
+    public static final String STARS_USER_COUNT ="stars_user_count:";
+
+    //-------------------党建资讯收藏的key-----------------
+    //党建资讯收藏的人员集合的key = stars_party_news:{userId} value = 该用户收藏的党建[partyId]
+    public static final String STARS_PARTY_NEWS ="stars_party_news:";
+    //党建资讯对应资讯收藏的数量key =stars_party_news_count:{partyId} value = 收藏的数量
+    public static final String STARS_PARTY_NEWS_COUNT ="stars_party_news_count:";
+
+    //-------------------未读互动的key-----------------
+    //记录社区资讯有互动未读的key=userId  value =[community_id]
+    //记录社区资讯某个用户对应资讯下有多少个未读的互动key=userId:community_id value = 资讯下有多少个未读的互动(点赞,收藏,回复)
+    //记录社区资讯某个用户一共有多少个未读的互动(点赞,收藏,回复),记录成map形式{} key = userId value= list<map<string,string>>
 }

+ 85 - 1
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/ResidentInfo.java

@@ -9,7 +9,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * 居住人员信息,存储居住人员的详细信息对象 resident_info
  * 
  * @author boman
- * @date 2025-02-21
+ * @date 2025-02-27
  */
 public class ResidentInfo extends BaseEntity
 {
@@ -66,10 +66,34 @@ public class ResidentInfo extends BaseEntity
     @Excel(name = "居住人员工作单位")
     private String residentEmployer;
 
+    /** 特殊类型 */
+    @Excel(name = "特殊类型")
+    private String specialType;
+
+    /** 爱好字典值多选 */
+    @Excel(name = "爱好字典值多选")
+    private String residentHobby;
+
     /** 居住人员面貌,如党员、群众等 */
     @Excel(name = "居住人员面貌,如党员、群众等")
     private String residentAppearance;
 
+    /** 身份证正面 */
+    @Excel(name = "身份证正面")
+    private String idCardFront;
+
+    /** 身份证反面 */
+    @Excel(name = "身份证反面")
+    private String idCardBack;
+
+    /** 身份证住址 */
+    @Excel(name = "身份证住址")
+    private String idCardAddress;
+
+    /** 人脸地址 */
+    @Excel(name = "人脸地址")
+    private String facePhoto;
+
     public void setResidentId(Long residentId) 
     {
         this.residentId = residentId;
@@ -187,6 +211,24 @@ public class ResidentInfo extends BaseEntity
     {
         return residentEmployer;
     }
+    public void setSpecialType(String specialType) 
+    {
+        this.specialType = specialType;
+    }
+
+    public String getSpecialType() 
+    {
+        return specialType;
+    }
+    public void setResidentHobby(String residentHobby) 
+    {
+        this.residentHobby = residentHobby;
+    }
+
+    public String getResidentHobby() 
+    {
+        return residentHobby;
+    }
     public void setResidentAppearance(String residentAppearance) 
     {
         this.residentAppearance = residentAppearance;
@@ -196,6 +238,42 @@ public class ResidentInfo extends BaseEntity
     {
         return residentAppearance;
     }
+    public void setIdCardFront(String idCardFront) 
+    {
+        this.idCardFront = idCardFront;
+    }
+
+    public String getIdCardFront() 
+    {
+        return idCardFront;
+    }
+    public void setIdCardBack(String idCardBack) 
+    {
+        this.idCardBack = idCardBack;
+    }
+
+    public String getIdCardBack() 
+    {
+        return idCardBack;
+    }
+    public void setIdCardAddress(String idCardAddress) 
+    {
+        this.idCardAddress = idCardAddress;
+    }
+
+    public String getIdCardAddress() 
+    {
+        return idCardAddress;
+    }
+    public void setFacePhoto(String facePhoto) 
+    {
+        this.facePhoto = facePhoto;
+    }
+
+    public String getFacePhoto() 
+    {
+        return facePhoto;
+    }
 
     @Override
     public String toString() {
@@ -213,7 +291,13 @@ public class ResidentInfo extends BaseEntity
             .append("isHouseholder", getIsHouseholder())
             .append("isTenant", getIsTenant())
             .append("residentEmployer", getResidentEmployer())
+            .append("specialType", getSpecialType())
+            .append("residentHobby", getResidentHobby())
             .append("residentAppearance", getResidentAppearance())
+            .append("idCardFront", getIdCardFront())
+            .append("idCardBack", getIdCardBack())
+            .append("idCardAddress", getIdCardAddress())
+            .append("facePhoto", getFacePhoto())
             .append("createBy", getCreateBy())
             .append("createTime", getCreateTime())
             .append("updateBy", getUpdateBy())

+ 15 - 6
ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java

@@ -1,11 +1,5 @@
 package com.ruoyi.common.core.redis;
 
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.BoundSetOperations;
 import org.springframework.data.redis.core.HashOperations;
@@ -13,6 +7,9 @@ import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.ValueOperations;
 import org.springframework.stereotype.Component;
 
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
 /**
  * spring redis 工具类
  *
@@ -218,6 +215,18 @@ public class RedisCache
         redisTemplate.opsForHash().put(key, hKey, value);
     }
 
+
+    /**
+     * 判断Hash中是否存在对应的
+     *
+     * @param key Redis键
+     * @param hKey Hash键
+     */
+    public boolean hasCacheMapKey(final String key, final String hKey)
+    {
+        return redisTemplate.opsForHash().hasKey(key,hKey);
+    }
+
     /**
      * 获取Hash中的数据
      *

+ 10 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/RedisConfig.java

@@ -7,6 +7,7 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.data.redis.connection.RedisConnectionFactory;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.script.DefaultRedisScript;
+import org.springframework.data.redis.listener.RedisMessageListenerContainer;
 import org.springframework.data.redis.serializer.StringRedisSerializer;
 
 /**
@@ -47,7 +48,15 @@ public class RedisConfig extends CachingConfigurerSupport
         redisScript.setResultType(Long.class);
         return redisScript;
     }
-
+   /* redis监听设置*/
+    @Bean
+    RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory) {
+        RedisMessageListenerContainer container = new RedisMessageListenerContainer();
+        container.setConnectionFactory(connectionFactory);
+        /*添加redis过期时间的监听器*/
+       // container.addMessageListener(redisKeyExpirationListener,redisKeyExpirationListener.getTop());
+        return container;
+    }
     /**
      * 限流脚本
      */

+ 73 - 3
ruoyi-framework/src/main/java/com/ruoyi/framework/manager/factory/AsyncFactory.java

@@ -1,8 +1,5 @@
 package com.ruoyi.framework.manager.factory;
 
-import java.util.TimerTask;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import com.ruoyi.common.constant.Constants;
 import com.ruoyi.common.utils.LogUtils;
 import com.ruoyi.common.utils.ServletUtils;
@@ -12,9 +9,17 @@ import com.ruoyi.common.utils.ip.IpUtils;
 import com.ruoyi.common.utils.spring.SpringUtils;
 import com.ruoyi.system.domain.SysLogininfor;
 import com.ruoyi.system.domain.SysOperLog;
+import com.ruoyi.system.domain.communityNews.CommentLikes;
+import com.ruoyi.system.domain.communityNews.CommentStars;
+import com.ruoyi.system.service.ICommentLikesService;
+import com.ruoyi.system.service.ICommentStarsService;
 import com.ruoyi.system.service.ISysLogininforService;
 import com.ruoyi.system.service.ISysOperLogService;
 import eu.bitwalker.useragentutils.UserAgent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.TimerTask;
 
 /**
  * 异步工厂(产生任务用)
@@ -99,4 +104,69 @@ public class AsyncFactory
             }
         };
     }
+
+    /**
+     * 点赞操作
+     *
+     * @param commentLikes 点赞信息
+     * @return 任务task
+     */
+    public static TimerTask giveTheThumbs(final CommentLikes commentLikes)
+    {
+        return new TimerTask()
+        {
+            @Override
+            public void run()
+            {
+                System.out.println("进入异步点赞方法");
+                // 进行点赞操作
+                SpringUtils.getBean(ICommentLikesService.class).giveTheThumbs(commentLikes);
+                System.out.println("完成异步点赞方法");
+            }
+        };
+    }
+
+    /**
+     * 社区资讯收藏操作
+     *
+     * @param commentStars 收藏信息
+     * @return 任务task
+     */
+    public static TimerTask getStars(final CommentStars commentStars)
+    {
+        return new TimerTask()
+        {
+            @Override
+            public void run()
+            {
+                System.out.println("进入异步社区资讯收藏方法");
+                // 进行收藏操作
+                SpringUtils.getBean(ICommentStarsService.class).getStars(commentStars);
+                System.out.println("完成异步社区资讯收藏方法");
+            }
+        };
+    }
+
+    /**
+     * 党建收藏操作
+     *
+     * @param commentStars 收藏信息
+     * @return 任务task
+     */
+    public static TimerTask getPartyNewsStars(final CommentStars commentStars)
+    {
+        return new TimerTask()
+        {
+            @Override
+            public void run()
+            {
+                System.out.println("进入异步党建收藏方法");
+                // 进行收藏操作
+                SpringUtils.getBean(ICommentStarsService.class).getPartyNewsStars(commentStars);
+                System.out.println("完成异步党建收藏方法");
+            }
+        };
+    }
+
+
 }

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/CommentContent.java

@@ -18,7 +18,7 @@ public class CommentContent extends BaseEntity
     /** 内容主键 */
     private Long contentId;
 
-    /** 评论id 无用*/
+    /** 评论id */
     @Excel(name = "评论id")
     private Long commentId;
 

+ 13 - 1
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/CommentIndex.java

@@ -22,6 +22,10 @@ public class CommentIndex extends BaseEntity
     @Excel(name = "社区资讯ID")
     private Long communityId;
 
+    /** 社区资讯标题 */
+    @Excel(name = "社区资讯标题")
+    private String communityTitle;
+
     /** 社区资讯类型(1:公告 2:通知 3:资讯) */
     @Excel(name = "社区资讯类型", readConverterExp = "1=:公告,2=:通知,3=:资讯")
     private String communityType;
@@ -69,7 +73,15 @@ public class CommentIndex extends BaseEntity
     /** 逻辑删除(Y:已删除,N:未删除) */
     private String delFlag;
 
-    public void setCommentId(Long commentId) 
+    public String getCommunityTitle() {
+        return communityTitle;
+    }
+
+    public void setCommunityTitle(String communityTitle) {
+        this.communityTitle = communityTitle;
+    }
+
+    public void setCommentId(Long commentId)
     {
         this.commentId = commentId;
     }

+ 4 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/CommentLikes.java

@@ -25,6 +25,10 @@ public class CommentLikes extends BaseEntity
     /** 点赞目标类型(1:资讯 2:回复) */
     @Excel(name = "点赞目标类型", readConverterExp = "1=:资讯,2=:回复")
     private String targetType;
+    /**
+     * 目标标题
+     */
+    private String targetTitle;
 
     /** 用户id */
     @Excel(name = "用户id")

+ 32 - 18
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/CommentStars.java

@@ -9,22 +9,26 @@ import com.ruoyi.common.core.domain.BaseEntity;
  * 社区资讯收藏对象 comment_stars
  * 
  * @author boman
- * @date 2025-02-25
+ * @date 2025-02-28
  */
 public class CommentStars extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
-    /** 社区资讯收藏ID */
+    /** 收藏ID */
     private Long starsId;
 
-    /** 社区资讯ID */
-    @Excel(name = "社区资讯ID")
-    private Long communityId;
+    /** 目标ID */
+    @Excel(name = "目标ID")
+    private Long targetId;
 
-    /** 社区资讯类型(1:公告 2:通知 3:资讯) */
-    @Excel(name = "社区资讯类型", readConverterExp = "1=:公告,2=:通知,3=:资讯")
-    private String communityType;
+    /** 目标类型(1:社区 2:党建 ) */
+    @Excel(name = "目标类型", readConverterExp = "1=:社区,2=:党建")
+    private String targetType;
+
+    /** 目标标题 */
+    @Excel(name = "目标标题")
+    private String targetTitle;
 
     /** 用户id */
     @Excel(name = "用户id")
@@ -50,23 +54,32 @@ public class CommentStars extends BaseEntity
     {
         return starsId;
     }
-    public void setCommunityId(Long communityId) 
+    public void setTargetId(Long targetId) 
+    {
+        this.targetId = targetId;
+    }
+
+    public Long getTargetId() 
+    {
+        return targetId;
+    }
+    public void setTargetType(String targetType) 
     {
-        this.communityId = communityId;
+        this.targetType = targetType;
     }
 
-    public Long getCommunityId() 
+    public String getTargetType() 
     {
-        return communityId;
+        return targetType;
     }
-    public void setCommunityType(String communityType) 
+    public void setTargetTitle(String targetTitle) 
     {
-        this.communityType = communityType;
+        this.targetTitle = targetTitle;
     }
 
-    public String getCommunityType() 
+    public String getTargetTitle() 
     {
-        return communityType;
+        return targetTitle;
     }
     public void setUserId(Long userId) 
     {
@@ -109,8 +122,9 @@ public class CommentStars extends BaseEntity
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
             .append("starsId", getStarsId())
-            .append("communityId", getCommunityId())
-            .append("communityType", getCommunityType())
+            .append("targetId", getTargetId())
+            .append("targetType", getTargetType())
+            .append("targetTitle", getTargetTitle())
             .append("userId", getUserId())
             .append("nickName", getNickName())
             .append("avatar", getAvatar())

+ 59 - 27
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/CommunityNews.java

@@ -3,8 +3,6 @@ package com.ruoyi.system.domain.communityNews;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 import java.util.Date;
 
@@ -77,16 +75,52 @@ public class CommunityNews extends BaseEntity
     /** 评论数量 */
     @Excel(name = "评论数量")
     private String userComment;
+    /**
+     * 是否评论
+     */
+    private String isComment;
 
     /** 点赞数量 */
     @Excel(name = "点赞数量")
     private String userLikes;
+    /**
+     * 是否点赞 N:未点赞 Y:点赞
+     */
+    private String isLike;
 
     /** 收藏数量 */
     @Excel(name = "收藏数量")
     private String userStars;
+    /**
+     * 是否收藏 N:未收藏 Y:收藏
+     */
+    private String isStar;
 
-    public void setCommunityId(Long communityId) 
+    public String getIsComment() {
+        return isComment;
+    }
+
+    public void setIsComment(String isComment) {
+        this.isComment = isComment;
+    }
+
+    public String getIsLike() {
+        return isLike;
+    }
+
+    public void setIsLike(String isLike) {
+        this.isLike = isLike;
+    }
+
+    public String getIsStar() {
+        return isStar;
+    }
+
+    public void setIsStar(String isStar) {
+        this.isStar = isStar;
+    }
+
+    public void setCommunityId(Long communityId)
     {
         this.communityId = communityId;
     }
@@ -242,29 +276,27 @@ public class CommunityNews extends BaseEntity
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("communityId", getCommunityId())
-            .append("communityTitle", getCommunityTitle())
-            .append("communityType", getCommunityType())
-            .append("communityContent", getCommunityContent())
-            .append("status", getStatus())
-            .append("publishTime", getPublishTime())
-            .append("userId", getUserId())
-            .append("staffId", getStaffId())
-            .append("staffName", getStaffName())
-            .append("author", getAuthor())
-            .append("source", getSource())
-            .append("coverImage", getCoverImage())
-            .append("viewCount", getViewCount())
-            .append("isTop", getIsTop())
-            .append("userComment", getUserComment())
-            .append("userLikes", getUserLikes())
-            .append("userStars", getUserStars())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return "CommunityNews{" +
+                "communityId=" + communityId +
+                ", communityTitle='" + communityTitle + '\'' +
+                ", communityType='" + communityType + '\'' +
+                ", communityContent='" + communityContent + '\'' +
+                ", status='" + status + '\'' +
+                ", publishTime=" + publishTime +
+                ", userId=" + userId +
+                ", staffId=" + staffId +
+                ", staffName='" + staffName + '\'' +
+                ", author='" + author + '\'' +
+                ", source='" + source + '\'' +
+                ", coverImage='" + coverImage + '\'' +
+                ", viewCount=" + viewCount +
+                ", isTop='" + isTop + '\'' +
+                ", userComment='" + userComment + '\'' +
+                ", isComment='" + isComment + '\'' +
+                ", userLikes='" + userLikes + '\'' +
+                ", isLike='" + isLike + '\'' +
+                ", userStars='" + userStars + '\'' +
+                ", isStar='" + isStar + '\'' +
+                '}';
     }
 }

+ 37 - 24
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/CommentChildrenVo.java

@@ -45,17 +45,21 @@ public class CommentChildrenVo implements Serializable {
      *           ],
      */
     private static final long serialVersionUID = 1L;
+    /**
+     * 评论主体id
+     */
+    private Long id;
 
     /**
      * 回复的人
      */
-    private CommentUserVo commentUserVo;
+    private CommentUser commentUser;
 
 
     /**
      * 被回复的人
      */
-    private TargetUserVo targetUserVo;
+    private TargetUser targetUser;
 
     /**
      * 内容
@@ -74,36 +78,28 @@ public class CommentChildrenVo implements Serializable {
      */
     private String isLike;
 
-    public Integer getLikeCount() {
-        return likeCount;
+    public Long getId() {
+        return id;
     }
 
-    public void setLikeCount(Integer likeCount) {
-        this.likeCount = likeCount;
+    public void setId(Long id) {
+        this.id = id;
     }
 
-    public String getIsLike() {
-        return isLike;
+    public CommentUser getCommentUser() {
+        return commentUser;
     }
 
-    public void setIsLike(String isLike) {
-        this.isLike = isLike;
-    }
-
-    public CommentUserVo getCommentUserVo() {
-        return commentUserVo;
+    public void setCommentUser(CommentUser commentUser) {
+        this.commentUser = commentUser;
     }
 
-    public void setCommentUserVo(CommentUserVo commentUserVo) {
-        this.commentUserVo = commentUserVo;
+    public TargetUser getTargetUser() {
+        return targetUser;
     }
 
-    public TargetUserVo getTargetUserVo() {
-        return targetUserVo;
-    }
-
-    public void setTargetUserVo(TargetUserVo targetUserVo) {
-        this.targetUserVo = targetUserVo;
+    public void setTargetUser(TargetUser targetUser) {
+        this.targetUser = targetUser;
     }
 
     public String getContent() {
@@ -122,11 +118,28 @@ public class CommentChildrenVo implements Serializable {
         this.createTime = createTime;
     }
 
+    public Integer getLikeCount() {
+        return likeCount;
+    }
+
+    public void setLikeCount(Integer likeCount) {
+        this.likeCount = likeCount;
+    }
+
+    public String getIsLike() {
+        return isLike;
+    }
+
+    public void setIsLike(String isLike) {
+        this.isLike = isLike;
+    }
+
     @Override
     public String toString() {
         return "CommentChildrenVo{" +
-                "commentUserVo=" + commentUserVo +
-                ", targetUserVo=" + targetUserVo +
+                "id=" + id +
+                ", commentUser=" + commentUser +
+                ", targetUser=" + targetUser +
                 ", content='" + content + '\'' +
                 ", createTime=" + createTime +
                 ", likeCount=" + likeCount +

+ 227 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/CommentIndexShVo.java

@@ -0,0 +1,227 @@
+package com.ruoyi.system.domain.communityNews.vo;
+
+import com.ruoyi.common.annotation.Excel;
+
+import java.io.Serializable;
+
+/**
+ * @Author: tjf
+ * @Date: 2025/2/26 17:19
+ * @Describe:
+ */
+public class CommentIndexShVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /** 社区资讯评论ID */
+    private Long commentId;
+
+    /** 社区资讯ID */
+    @Excel(name = "社区资讯ID")
+    private Long communityId;
+
+    /** 社区资讯标题 */
+    @Excel(name = "社区资讯标题")
+    private String communityTitle;
+
+    /** 社区资讯类型(1:公告 2:通知 3:资讯) */
+    @Excel(name = "社区资讯类型", readConverterExp = "1=:公告,2=:通知,3=:资讯")
+    private String communityType;
+
+    /** 根评论id 1:根评论 2:子评论 */
+    @Excel(name = "根评论id 1:根评论 2:子评论")
+    private Integer isRoot;
+
+    /** 父评论id */
+    @Excel(name = "父评论id")
+    private Long parentId;
+
+    /** 用户id */
+    @Excel(name = "用户id")
+    private Long userId;
+
+    /** 用户昵称 */
+    @Excel(name = "用户昵称")
+    private String nickName;
+
+    /** 头像地址 */
+    @Excel(name = "头像地址")
+    private String avatar;
+
+    /** 所回复目标评论的用户id */
+    @Excel(name = "所回复目标评论的用户id")
+    private Long toUserId;
+
+    /** 所回复目标评论的用户昵称 */
+    @Excel(name = "所回复目标评论的用户昵称")
+    private String toNickName;
+
+    /** 所回复目标评论的头像地址 */
+    @Excel(name = "所回复目标评论的头像地址")
+    private String toAvatar;
+
+    /** 内容id */
+    @Excel(name = "内容id")
+    private Long contentId;
+
+    /** 评论内容 */
+    @Excel(name = "评论内容(冗余字段)")
+    private String commentContent;
+
+    /** 状态:1:待审核 2:审核通过 3:审核不通过 4:审核通过后下架 */
+    @Excel(name = "状态:1:待审核 2:审核通过 3:审核不通过 4:审核通过后下架")
+    private String status;
+
+    /** 类型:1:文字 2:图片 */
+    @Excel(name = "类型:1:文字 2:图片")
+    private Integer type;
+
+    public Long getCommentId() {
+        return commentId;
+    }
+
+    public void setCommentId(Long commentId) {
+        this.commentId = commentId;
+    }
+
+    public Long getCommunityId() {
+        return communityId;
+    }
+
+    public void setCommunityId(Long communityId) {
+        this.communityId = communityId;
+    }
+
+    public String getCommunityTitle() {
+        return communityTitle;
+    }
+
+    public void setCommunityTitle(String communityTitle) {
+        this.communityTitle = communityTitle;
+    }
+
+    public String getCommunityType() {
+        return communityType;
+    }
+
+    public void setCommunityType(String communityType) {
+        this.communityType = communityType;
+    }
+
+    public Integer getIsRoot() {
+        return isRoot;
+    }
+
+    public void setIsRoot(Integer isRoot) {
+        this.isRoot = isRoot;
+    }
+
+    public Long getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(Long parentId) {
+        this.parentId = parentId;
+    }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public String getNickName() {
+        return nickName;
+    }
+
+    public void setNickName(String nickName) {
+        this.nickName = nickName;
+    }
+
+    public String getAvatar() {
+        return avatar;
+    }
+
+    public void setAvatar(String avatar) {
+        this.avatar = avatar;
+    }
+
+    public Long getToUserId() {
+        return toUserId;
+    }
+
+    public void setToUserId(Long toUserId) {
+        this.toUserId = toUserId;
+    }
+
+    public String getToNickName() {
+        return toNickName;
+    }
+
+    public void setToNickName(String toNickName) {
+        this.toNickName = toNickName;
+    }
+
+    public String getToAvatar() {
+        return toAvatar;
+    }
+
+    public void setToAvatar(String toAvatar) {
+        this.toAvatar = toAvatar;
+    }
+
+    public Long getContentId() {
+        return contentId;
+    }
+
+    public void setContentId(Long contentId) {
+        this.contentId = contentId;
+    }
+
+    public String getCommentContent() {
+        return commentContent;
+    }
+
+    public void setCommentContent(String commentContent) {
+        this.commentContent = commentContent;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    @Override
+    public String toString() {
+        return "CommentIndexShVo{" +
+                "commentId=" + commentId +
+                ", communityId=" + communityId +
+                ", communityTitle='" + communityTitle + '\'' +
+                ", communityType='" + communityType + '\'' +
+                ", isRoot=" + isRoot +
+                ", parentId=" + parentId +
+                ", userId=" + userId +
+                ", nickName='" + nickName + '\'' +
+                ", avatar='" + avatar + '\'' +
+                ", toUserId=" + toUserId +
+                ", toNickName='" + toNickName + '\'' +
+                ", toAvatar='" + toAvatar + '\'' +
+                ", contentId=" + contentId +
+                ", commentContent='" + commentContent + '\'' +
+                ", status='" + status + '\'' +
+                ", type=" + type +
+                '}';
+    }
+}

+ 31 - 18
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/CommentIndexVo.java

@@ -54,7 +54,7 @@ public class CommentIndexVo implements Serializable {
     /**
      * 回复的人
      */
-    private CommentUserVo commentUserVo;
+    private CommentUser commentUser;
     /**
      * 内容
      */
@@ -75,21 +75,17 @@ public class CommentIndexVo implements Serializable {
      * 评论子集
      */
     private List<CommentChildrenVo> childrenList;
+    /**
+     * 子集总数
+     */
+    private  Integer childrenListCount;
 
-    public Integer getLikeCount() {
-        return likeCount;
-    }
-
-    public void setLikeCount(Integer likeCount) {
-        this.likeCount = likeCount;
-    }
-
-    public String getIsLike() {
-        return isLike;
+    public Integer getChildrenListCount() {
+        return childrenListCount;
     }
 
-    public void setIsLike(String isLike) {
-        this.isLike = isLike;
+    public void setChildrenListCount(Integer childrenListCount) {
+        this.childrenListCount = childrenListCount;
     }
 
     public Long getId() {
@@ -100,12 +96,12 @@ public class CommentIndexVo implements Serializable {
         this.id = id;
     }
 
-    public CommentUserVo getCommentUserVo() {
-        return commentUserVo;
+    public CommentUser getCommentUser() {
+        return commentUser;
     }
 
-    public void setCommentUserVo(CommentUserVo commentUserVo) {
-        this.commentUserVo = commentUserVo;
+    public void setCommentUser(CommentUser commentUser) {
+        this.commentUser = commentUser;
     }
 
     public String getContent() {
@@ -116,6 +112,22 @@ public class CommentIndexVo implements Serializable {
         this.content = content;
     }
 
+    public Integer getLikeCount() {
+        return likeCount;
+    }
+
+    public void setLikeCount(Integer likeCount) {
+        this.likeCount = likeCount;
+    }
+
+    public String getIsLike() {
+        return isLike;
+    }
+
+    public void setIsLike(String isLike) {
+        this.isLike = isLike;
+    }
+
     public Date getCreateTime() {
         return createTime;
     }
@@ -136,12 +148,13 @@ public class CommentIndexVo implements Serializable {
     public String toString() {
         return "CommentIndexVo{" +
                 "id=" + id +
-                ", commentUserVo=" + commentUserVo +
+                ", commentUser=" + commentUser +
                 ", content='" + content + '\'' +
                 ", likeCount=" + likeCount +
                 ", isLike='" + isLike + '\'' +
                 ", createTime=" + createTime +
                 ", childrenList=" + childrenList +
+                ", childrenListCount=" + childrenListCount +
                 '}';
     }
 }

+ 2 - 17
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/CommentUserVo.java → ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/CommentUser.java

@@ -1,9 +1,6 @@
 package com.ruoyi.system.domain.communityNews.vo;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
-
 import java.io.Serializable;
-import java.util.Date;
 
 /**
  * 评论前端所需要格式回复的人
@@ -11,7 +8,7 @@ import java.util.Date;
  * @Date: 2025/2/25 15:56
  * @Describe:
  */
-public class CommentUserVo implements Serializable {
+public class CommentUser implements Serializable {
     private static final long serialVersionUID = 1L;
 
 
@@ -28,17 +25,6 @@ public class CommentUserVo implements Serializable {
      */
     private String avatar;
 
-    /** 创建时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date createTime;
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
 
     public Long getId() {
         return id;
@@ -66,11 +52,10 @@ public class CommentUserVo implements Serializable {
 
     @Override
     public String toString() {
-        return "CommentUserVo{" +
+        return "CommentUser{" +
                 "id=" + id +
                 ", nickName='" + nickName + '\'' +
                 ", avatar='" + avatar + '\'' +
-                ", createTime=" + createTime +
                 '}';
     }
 }

+ 2 - 18
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/TargetUserVo.java → ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/TargetUser.java

@@ -1,9 +1,6 @@
 package com.ruoyi.system.domain.communityNews.vo;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
-
 import java.io.Serializable;
-import java.util.Date;
 
 /**
  * 评论前端所需要格式被回复的人
@@ -11,7 +8,7 @@ import java.util.Date;
  * @Date: 2025/2/25 15:54
  * @Describe:
  */
-public class TargetUserVo implements Serializable {
+public class TargetUser implements Serializable {
     private static final long serialVersionUID = 1L;
     /**
      * 人员的userID
@@ -26,18 +23,6 @@ public class TargetUserVo implements Serializable {
      */
     private String avatar;
 
-    /** 创建时间 */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    private Date createTime;
-
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
     public Long getId() {
         return id;
     }
@@ -64,11 +49,10 @@ public class TargetUserVo implements Serializable {
 
     @Override
     public String toString() {
-        return "CommentUserVo{" +
+        return "TargetUser{" +
                 "id=" + id +
                 ", nickName='" + nickName + '\'' +
                 ", avatar='" + avatar + '\'' +
-                ", createTime=" + createTime +
                 '}';
     }
 }

+ 33 - 25
ruoyi-system/src/main/java/com/ruoyi/system/domain/houseInfo/HouseInfo.java

@@ -5,8 +5,6 @@ import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.annotation.Excels;
 import com.ruoyi.common.core.domain.BaseEntity;
 import com.ruoyi.common.core.domain.entity.ResidentInfo;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -77,6 +75,11 @@ public class HouseInfo extends BaseEntity
     /** 是否有车位,Y表示有,N表示无 */
     @Excel(name = "是否有车位,Y表示有,N表示无")
     private String hasParkingSpace;
+    /**
+     * 车位号
+     */
+    @Excel(name = "车位号")
+    private String parkingNumber;
 
     /** 房屋所在小区名称 */
     @Excel(name = "房屋所在小区名称")
@@ -102,6 +105,14 @@ public class HouseInfo extends BaseEntity
     })
     private List<ResidentInfo> residentInfoList;
 
+    public String getParkingNumber() {
+        return parkingNumber;
+    }
+
+    public void setParkingNumber(String parkingNumber) {
+        this.parkingNumber = parkingNumber;
+    }
+
     public List<ResidentInfo> getResidentInfoList() {
         return residentInfoList;
     }
@@ -257,28 +268,25 @@ public class HouseInfo extends BaseEntity
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("houseId", getHouseId())
-            .append("ownerName", getOwnerName())
-            .append("location", getLocation())
-            .append("rightType", getRightType())
-            .append("area", getArea())
-            .append("documentNumber", getDocumentNumber())
-            .append("propertyUnitNumber", getPropertyUnitNumber())
-            .append("coOwnership", getCoOwnership())
-            .append("usageType", getUsageType())
-            .append("usagePeriod", getUsagePeriod())
-            .append("registrationDate", getRegistrationDate())
-            .append("coOwner", getCoOwner())
-            .append("detailedAddress", getDetailedAddress())
-            .append("hasParkingSpace", getHasParkingSpace())
-            .append("communityName", getCommunityName())
-            .append("houseStatus", getHouseStatus())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return "HouseInfo{" +
+                "houseId=" + houseId +
+                ", ownerName='" + ownerName + '\'' +
+                ", location='" + location + '\'' +
+                ", rightType='" + rightType + '\'' +
+                ", area=" + area +
+                ", documentNumber='" + documentNumber + '\'' +
+                ", propertyUnitNumber='" + propertyUnitNumber + '\'' +
+                ", coOwnership='" + coOwnership + '\'' +
+                ", usageType='" + usageType + '\'' +
+                ", usagePeriod='" + usagePeriod + '\'' +
+                ", registrationDate=" + registrationDate +
+                ", coOwner='" + coOwner + '\'' +
+                ", detailedAddress='" + detailedAddress + '\'' +
+                ", hasParkingSpace='" + hasParkingSpace + '\'' +
+                ", parkingNumber='" + parkingNumber + '\'' +
+                ", communityName='" + communityName + '\'' +
+                ", houseStatus=" + houseStatus +
+                ", residentInfoList=" + residentInfoList +
+                '}';
     }
 }

+ 38 - 21
ruoyi-system/src/main/java/com/ruoyi/system/domain/partyNews/PartyNews.java

@@ -3,8 +3,6 @@ package com.ruoyi.system.domain.partyNews;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 import java.util.Date;
 
@@ -61,8 +59,30 @@ public class PartyNews extends BaseEntity
     /** 是否置顶:Y(置顶)、N(不置顶) */
     @Excel(name = "是否置顶:Y", readConverterExp = "置=顶")
     private String isTop;
+    /** 是否收藏:Y(收藏)、N(不收藏) */
+    private String isStars;
+    /**
+     * 收藏数量
+     */
+    private Integer starsCount;
 
-    public void setPartyId(Long partyId) 
+    public Integer getStarsCount() {
+        return starsCount;
+    }
+
+    public void setStarsCount(Integer starsCount) {
+        this.starsCount = starsCount;
+    }
+
+    public String getIsStars() {
+        return isStars;
+    }
+
+    public void setIsStars(String isStars) {
+        this.isStars = isStars;
+    }
+
+    public void setPartyId(Long partyId)
     {
         this.partyId = partyId;
     }
@@ -164,23 +184,20 @@ public class PartyNews extends BaseEntity
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("partyId", getPartyId())
-            .append("partyTitle", getPartyTitle())
-            .append("partyType", getPartyType())
-            .append("partyContent", getPartyContent())
-            .append("status", getStatus())
-            .append("publishTime", getPublishTime())
-            .append("author", getAuthor())
-            .append("source", getSource())
-            .append("coverImage", getCoverImage())
-            .append("viewCount", getViewCount())
-            .append("isTop", getIsTop())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return "PartyNews{" +
+                "partyId=" + partyId +
+                ", partyTitle='" + partyTitle + '\'' +
+                ", partyType='" + partyType + '\'' +
+                ", partyContent='" + partyContent + '\'' +
+                ", status='" + status + '\'' +
+                ", publishTime=" + publishTime +
+                ", author='" + author + '\'' +
+                ", source='" + source + '\'' +
+                ", coverImage='" + coverImage + '\'' +
+                ", viewCount=" + viewCount +
+                ", isTop='" + isTop + '\'' +
+                ", isStars='" + isStars + '\'' +
+                ", starsCount=" + starsCount +
+                '}';
     }
 }

+ 28 - 24
ruoyi-system/src/main/java/com/ruoyi/system/domain/proprietorCar/ProprietorCar.java

@@ -1,7 +1,5 @@
 package com.ruoyi.system.domain.proprietorCar;
 
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
 
@@ -29,6 +27,8 @@ public class ProprietorCar extends BaseEntity
     /** 业主id */
     @Excel(name = "业主id")
     private Long userId;
+    /** 居住人员表id */
+    private Long residentId;
 
     /** 业主姓名 */
     @Excel(name = "业主姓名")
@@ -70,7 +70,15 @@ public class ProprietorCar extends BaseEntity
     @Excel(name = "发证日期")
     private String issueDate;
 
-    public void setCarId(Long carId) 
+    public Long getResidentId() {
+        return residentId;
+    }
+
+    public void setResidentId(Long residentId) {
+        this.residentId = residentId;
+    }
+
+    public void setCarId(Long carId)
     {
         this.carId = carId;
     }
@@ -199,26 +207,22 @@ public class ProprietorCar extends BaseEntity
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("carId", getCarId())
-            .append("houseId", getHouseId())
-            .append("detailedAddress", getDetailedAddress())
-            .append("userId", getUserId())
-            .append("userName", getUserName())
-            .append("residentPhone", getResidentPhone())
-            .append("plateNumber", getPlateNumber())
-            .append("vehicleBrand", getVehicleBrand())
-            .append("vehicleType", getVehicleType())
-            .append("vehicleColour", getVehicleColour())
-            .append("engineNumber", getEngineNumber())
-            .append("identificationNumber", getIdentificationNumber())
-            .append("registrationDate", getRegistrationDate())
-            .append("issueDate", getIssueDate())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return "ProprietorCar{" +
+                "carId=" + carId +
+                ", houseId=" + houseId +
+                ", detailedAddress='" + detailedAddress + '\'' +
+                ", userId=" + userId +
+                ", residentId=" + residentId +
+                ", userName='" + userName + '\'' +
+                ", residentPhone='" + residentPhone + '\'' +
+                ", plateNumber='" + plateNumber + '\'' +
+                ", vehicleBrand='" + vehicleBrand + '\'' +
+                ", vehicleType='" + vehicleType + '\'' +
+                ", vehicleColour='" + vehicleColour + '\'' +
+                ", engineNumber='" + engineNumber + '\'' +
+                ", identificationNumber='" + identificationNumber + '\'' +
+                ", registrationDate='" + registrationDate + '\'' +
+                ", issueDate='" + issueDate + '\'' +
+                '}';
     }
 }

+ 89 - 0
ruoyi-system/src/main/java/com/ruoyi/system/listener/RedisKeyExpirationListener.java

@@ -0,0 +1,89 @@
+package com.ruoyi.system.listener;
+
+import com.ruoyi.system.domain.communityNews.CommentContent;
+import com.ruoyi.system.domain.communityNews.CommunityNews;
+import com.ruoyi.system.mapper.CommentContentMapper;
+import com.ruoyi.system.mapper.CommunityNewsMapper;
+import org.springframework.data.redis.connection.Message;
+import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
+import org.springframework.data.redis.listener.PatternTopic;
+import org.springframework.data.redis.listener.RedisMessageListenerContainer;
+import org.springframework.data.redis.listener.Topic;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+import static com.ruoyi.common.constant.Constants.ONE_LIKE_COUNT_TIME;
+import static com.ruoyi.common.constant.Constants.TWO_LIKE_COUNT_TIME;
+
+/**
+ * redis过期事件监听器
+ * @Author: tjf
+ * @Date: 2025/2/27 11:13
+ * @Describe:
+ */
+@Component
+public class RedisKeyExpirationListener extends KeyExpirationEventMessageListener {
+    //"__keyevent@0__:expired"表示监听数据库0中的过期事件。如果你想监听特定数据库的过期事件,只需更改@0__中的数字为相应的数据库编号
+    // 。@*__ 表示监听所有redis数据库 redis0-15一共16个数据库
+    //todo 项目上线需要确定redis监听的数据库编号,在此处修改
+    private final Topic top = new PatternTopic("__keyevent@8__:expired");
+
+    @Resource
+    private CommunityNewsMapper communityNewsMapper;
+
+    @Resource
+    private CommentContentMapper commentContentMapper;
+    /**
+     * Creates new {@link MessageListener} for {@code __keyevent@*__:expired} messages.
+     *
+     * @param listenerContainer must not be {@literal null}.
+     */
+    public RedisKeyExpirationListener(RedisMessageListenerContainer listenerContainer) {
+        super(listenerContainer);
+    }
+
+    /*设置绑定的redis数据库编号*/
+    //"__keyevent@0__:expired"表示监听数据库0中的过期事件。如果你想监听特定数据库的过期事件,只需更改@0__中的数字为相应的数据库编号
+    // 。@*__ 表示监听所有redis数据库 redis0-15一共16个数据库
+    @Override
+    protected void doRegister(RedisMessageListenerContainer listenerContainer) {
+        listenerContainer.addMessageListener(this,top);
+    }
+
+    /**
+     *  redis过期key的具体逻辑
+     * @param message 过期的key
+     * @param pattern 空间名称
+     */
+    @Override
+    public void onMessage(Message message, byte[] pattern) {
+        // 过期key 获取不到value
+        String expiredKey = message.toString();
+        //ONE_LIKE_COUNT_TIME = key=one_like_count_time:{文章id}#{数量}
+        // or TWO_LIKE_COUNT_TIME = key=two_like_count_time:{评论id}#{数量}
+        if (expiredKey.contains(ONE_LIKE_COUNT_TIME)){
+            //处理文章的点赞数量
+            String[] split = expiredKey.split(":");
+            //{文章id}#{数量}
+            String[] splitResult = split[1].split("#");
+            CommunityNews communityNews = new CommunityNews();
+            communityNews.setCommunityId(Long.parseLong(splitResult[0]));
+            communityNews.setUserLikes(splitResult[1]);
+            communityNewsMapper.updateCommunityNews(communityNews);
+        }else if (expiredKey.contains(TWO_LIKE_COUNT_TIME)){
+            //处理评论的点赞数量
+            String[] split = expiredKey.split(":");
+            //{评论id}#{数量}
+            String[] splitResult = split[1].split("#");
+            CommentContent commentContent = new CommentContent();
+            commentContent.setCommentId(Long.parseLong(splitResult[0]));
+            commentContent.setLikeCount(Long.parseLong(splitResult[1]));
+            commentContentMapper.updateCommentContentByCommentId(commentContent);
+        }
+        System.out.println("监听key:"+expiredKey);
+    }
+    public Topic getTop() {
+        return top;
+    }
+}

+ 9 - 2
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CommentContentMapper.java

@@ -69,9 +69,16 @@ public interface CommentContentMapper
     public int updateCommentContentByContentId(Long contentId);
 
     /**
-     * 更新社区资讯评论内容表
+     * 删除评论内容表数据
      * @param commentId 评论id
      * @return
      */
-    public int updateCommentContentByCommentId(Long commentId);
+    public int deleteCommentContentByCommentId(Long commentId);
+
+    /**
+     * 更新评论内容表点赞数量
+     * @param commentContent
+     * @return
+     */
+    int updateCommentContentByCommentId(CommentContent commentContent);
 }

+ 25 - 2
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CommentIndexMapper.java

@@ -1,6 +1,8 @@
 package com.ruoyi.system.mapper;
 
 import com.ruoyi.system.domain.communityNews.CommentIndex;
+import com.ruoyi.system.domain.communityNews.vo.CommentChildrenVo;
+import com.ruoyi.system.domain.communityNews.vo.CommentIndexShVo;
 import com.ruoyi.system.domain.communityNews.vo.CommentIndexVo;
 
 import java.util.List;
@@ -31,11 +33,32 @@ public interface CommentIndexMapper
     public List<CommentIndex> selectCommentIndexList(CommentIndex commentIndex);
 
     /**
-     * 查询所有评论组装成前端所需要的数据结构
+     * //查找出所有parent_id = commentId的commentId
+     * @param commentId
+     * @return
+     */
+    public List<Long> selectCommentIdListByCommentId(Long commentId);
+
+    /**
+     * 查询社区资讯评论审核列表
+     * @param commentIndexShVo
+     * @return
+     */
+    public List<CommentIndexShVo> commentSh(CommentIndexShVo commentIndexShVo);
+
+    /**
+     * 根据parent_id查询所有评论组装成前端所需要的子集数据结构 带分页
+     * @param commentIndex
+     * @return
+     */
+    public List<CommentChildrenVo> getParentComment(CommentIndex commentIndex);
+
+    /**
+     * 根据查询所有一级评论组带子集总数组装成前端所需要的数据结构 带分页
      * @param commentIndex
      * @return
      */
-    public List<CommentIndexVo> getAllComment(CommentIndex commentIndex);
+    public List<CommentIndexVo> getRootComment(CommentIndex commentIndex);
 
     /**
      * 新增社区资讯评论

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CommentLikesMapper.java

@@ -29,6 +29,13 @@ public interface CommentLikesMapper
      */
     public List<CommentLikes> selectCommentLikesList(CommentLikes commentLikes);
 
+    /**
+     * 根据点赞目标id' 点赞目标类型(1:资讯 2:回复) 用户id查询是否已经点赞过
+     * @param commentLikes
+     * @return
+     */
+    public CommentLikes  selectCommentLikes(CommentLikes commentLikes);
+
     /**
      * 新增社区资讯点赞
      * 

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CommentStarsMapper.java

@@ -44,6 +44,13 @@ public interface CommentStarsMapper
      */
     public int updateCommentStars(CommentStars commentStars);
 
+    /**
+     * 根据用户id和资讯id更新收藏状态 没删除就已收藏 删除=未收藏
+     * @param commentStars
+     * @return
+     */
+    public int updateCommentStarsByUserIdAndCommunityId(CommentStars commentStars);
+
     /**
      * 删除社区资讯收藏
      * 

+ 9 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/CommunityNewsMapper.java

@@ -1,6 +1,7 @@
 package com.ruoyi.system.mapper;
 
 import com.ruoyi.system.domain.communityNews.CommunityNews;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -60,4 +61,12 @@ public interface CommunityNewsMapper
      * @return 结果
      */
     public int deleteCommunityNewsByCommunityIds(Long[] communityIds);
+
+    /**
+     * 更新收藏数量
+     * @param communityId
+     * @param userStars
+     * @return
+     */
+    public int updateCommunityNewsStars(@Param("communityId") Long communityId, @Param("userStars") String userStars);
 }

+ 8 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/HouseInfoMapper.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.mapper;
 
+import com.ruoyi.common.core.domain.entity.ResidentInfo;
 import com.ruoyi.system.domain.houseInfo.HouseInfo;
 
 import java.util.List;
@@ -29,6 +30,13 @@ public interface HouseInfoMapper
      */
     public List<HouseInfo> selectHouseInfoList(HouseInfo houseInfo);
 
+    /**
+     * 查询房屋信息列表带人员信息
+     * @param residentInfo
+     * @return
+     */
+    public List<ResidentInfo> selectHouseInfoListAndResidentInfo(ResidentInfo residentInfo);
+
     /**
      * 新增房屋信息
      * 

+ 16 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/ICommentIndexService.java

@@ -2,6 +2,8 @@ package com.ruoyi.system.service;
 
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.system.domain.communityNews.CommentIndex;
+import com.ruoyi.system.domain.communityNews.vo.CommentIndexShVo;
+import com.ruoyi.system.domain.communityNews.vo.CommentIndexVo;
 
 import java.util.List;
 
@@ -30,6 +32,11 @@ public interface ICommentIndexService
      */
     public List<CommentIndex> selectCommentIndexList(CommentIndex commentIndex);
 
+    /**
+     * 查询社区资讯评论审核列表
+     */
+    public List<CommentIndexShVo> commentSh(CommentIndexShVo commentIndexShVo);
+
     /**
      * 新增社区资讯评论
      * 
@@ -63,9 +70,16 @@ public interface ICommentIndexService
     public int deleteCommentIndexByCommentId(Long commentId);
 
     /**
-     * 查询所有评论组装成前端所需要的数据结构
+     * 根据parent_id查询所有评论组装成前端所需要的子集数据结构 带分页
+     * @param commentIndex
+     * @return
+     */
+    public AjaxResult getParentComment(CommentIndex commentIndex);
+
+    /**
+     * 根据查询所有一级评论组带子集总数组装成前端所需要的数据结构 带分页
      * @param commentIndex
      * @return
      */
-    public AjaxResult getAllComment(CommentIndex commentIndex);
+    public List<CommentIndexVo> getRootComment(CommentIndex commentIndex);
 }

+ 6 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ICommentLikesService.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.service;
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.system.domain.communityNews.CommentLikes;
 
 import java.util.List;
@@ -59,4 +60,9 @@ public interface ICommentLikesService
      * @return 结果
      */
     public int deleteCommentLikesByLikesId(Long likesId);
+
+    /**
+     * 进行点赞操作
+     */
+    public AjaxResult giveTheThumbs(CommentLikes commentLikes);
 }

+ 15 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/ICommentStarsService.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.service;
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.system.domain.communityNews.CommentStars;
 
 import java.util.List;
@@ -60,4 +61,18 @@ public interface ICommentStarsService
      * @return 结果
      */
     public int deleteCommentStarsByStarsId(Long starsId);
+
+    /**
+     * 社区资讯收藏或取消收藏
+     * @param commentStars
+     * @return
+     */
+    public AjaxResult getStars(CommentStars commentStars);
+
+    /**
+     * 党建收藏或取消收藏
+     * @param commentStars
+     * @return
+     */
+    public AjaxResult getPartyNewsStars(CommentStars commentStars);
 }

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IHouseInfoService.java

@@ -1,6 +1,7 @@
 package com.ruoyi.system.service;
 
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.domain.entity.ResidentInfo;
 import com.ruoyi.system.domain.houseInfo.HouseInfo;
 
 import java.util.List;
@@ -29,6 +30,12 @@ public interface IHouseInfoService
      * @return 房屋信息集合
      */
     public List<HouseInfo> selectHouseInfoList(HouseInfo houseInfo);
+    /**
+     * 查询房屋信息列表带人员信息
+     * @param residentInfo
+     * @return
+     */
+    public List<ResidentInfo> selectHouseInfoListAndResidentInfo(ResidentInfo residentInfo);
 
     /**
      * 新增房屋信息

+ 129 - 22
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommentIndexServiceImpl.java

@@ -1,10 +1,14 @@
 package com.ruoyi.system.service.impl;
 
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.communityNews.CommentContent;
 import com.ruoyi.system.domain.communityNews.CommentIndex;
+import com.ruoyi.system.domain.communityNews.vo.CommentChildrenVo;
+import com.ruoyi.system.domain.communityNews.vo.CommentIndexShVo;
 import com.ruoyi.system.domain.communityNews.vo.CommentIndexVo;
 import com.ruoyi.system.mapper.CommentContentMapper;
 import com.ruoyi.system.mapper.CommentIndexMapper;
@@ -13,8 +17,12 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
+import static com.ruoyi.common.constant.Constants.*;
+
 /**
  * 社区资讯评论Service业务层处理
  *
@@ -28,6 +36,9 @@ public class CommentIndexServiceImpl implements ICommentIndexService {
     @Autowired
     private CommentContentMapper commentContentMapper;
 
+    @Resource
+    private RedisCache redisCache;
+
     /**
      * 查询社区资讯评论
      *
@@ -50,6 +61,14 @@ public class CommentIndexServiceImpl implements ICommentIndexService {
         return commentIndexMapper.selectCommentIndexList(commentIndex);
     }
 
+    /**
+     * 查询社区资讯评论审核列表
+     */
+    @Override
+    public List<CommentIndexShVo> commentSh(CommentIndexShVo commentIndexShVo) {
+        return commentIndexMapper.commentSh(commentIndexShVo);
+    }
+
     /**
      * 新增社区资讯评论
      *
@@ -59,27 +78,31 @@ public class CommentIndexServiceImpl implements ICommentIndexService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public int insertCommentIndex(CommentIndex commentIndex) {
-        Long userId = SecurityUtils.getUserId();
-        String nickName = SecurityUtils.getLoginUser().getUser().getNickName();
-        String avatar = SecurityUtils.getLoginUser().getUser().getAvatar();
-        commentIndex.setUserId(userId);
-        commentIndex.setNickName(nickName);
-        commentIndex.setAvatar(avatar);
-        //需要插入评论内容表
-        CommentContent commentContent = new CommentContent();
-        commentContent.setUserId(userId);
-        commentContent.setCommentContent(commentIndex.getCommentContent());
-        commentContentMapper.insertCommentContent(commentContent);
         int result = 1;
         //有社区资讯ID才能新增评论
-        if (commentIndex.getCommunityId() != null) {
-            //说明是根评论
+        Long communityId = commentIndex.getCommunityId();
+        if (communityId != null) {
+            Long userId = commentIndex.getUserId();
+            //需要插入评论内容表
+            CommentContent commentContent = new CommentContent();
+            commentContent.setUserId(userId);
+            commentContent.setCommentContent(commentIndex.getCommentContent());
+            commentContentMapper.insertCommentContent(commentContent);
             commentIndex.setCreateTime(DateUtils.getNowDate());
             commentIndex.setContentId(commentContent.getContentId());
             result = commentIndexMapper.insertCommentIndex(commentIndex);
             //再把评论内容表更新上资讯评论表id
             commentContent.setCommentId(commentIndex.getCommentId());
             commentContentMapper.updateCommentContent(commentContent);
+            //记录该社区资讯评论的数量
+            String communityCommentCountKey = COMMUNITY_COMMENT_COUNT + communityId;
+            Integer communityCommentCount = redisCache.getCacheObject(communityCommentCountKey);
+            if (communityCommentCount == null) {
+                redisCache.setCacheObject(communityCommentCountKey, 1);
+            } else {
+                //评论数量+1
+                redisCache.setCacheObject(communityCommentCountKey, communityCommentCount + 1);
+            }
         }
         return result;
     }
@@ -119,28 +142,112 @@ public class CommentIndexServiceImpl implements ICommentIndexService {
         //只能删除自己的评论
         CommentIndex commentIndex = commentIndexMapper.selectCommentIndexByCommentId(commentId);
         int result = 0;
+        int communityCommentCount = 0;
+        //查找出所有parent_id = commentId的commentId
+        List<Long> commentIdList = new ArrayList<>();
         if (commentIndex != null && commentIndex.getUserId().equals(SecurityUtils.getUserId())) {
+            //社区资讯id
+            Long communityId = commentIndex.getCommunityId();
             result = commentIndexMapper.updateCommentIndexByCommentId(commentId);
             //删除评论内容表数据
-            commentContentMapper.updateCommentContentByContentId(commentIndex.getCommentId());
+            commentContentMapper.updateCommentContentByContentId(commentId);
             //如果是根评论删除,删除所有子评论
-           if (1 == commentIndex.getIsRoot()){
-               commentIndexMapper.updateCommentIndexByParentId(commentId);
-               //删除评论内容表数据
-               commentContentMapper.updateCommentContentByCommentId(commentIndex.getCommentId());
-           }
+            if (1 == commentIndex.getIsRoot()) {
+                //查找出所有parent_id = commentId的commentId
+                commentIdList = commentIndexMapper.selectCommentIdListByCommentId(commentId);
+                int i = commentIndexMapper.updateCommentIndexByParentId(commentId);
+                result = result + i;
+                //删除评论内容表子集数据
+                commentContentMapper.deleteCommentContentByCommentId(commentId);
+            }
+            //删除该资讯的评论数量
+            String communityCommentCountKey = COMMUNITY_COMMENT_COUNT + communityId;
+            communityCommentCount = redisCache.getCacheObject(communityCommentCountKey);
+            if (communityCommentCount != 0) {
+                //删除所有的评论数量 = 根评论数量+子评论数量
+                communityCommentCount = communityCommentCount - result;
+                if (communityCommentCount < 0) {
+                    communityCommentCount = 0;
+                }
+                redisCache.setCacheObject(communityCommentCountKey, communityCommentCount);
+            }
+            //删除该资讯点赞的数量需要知道所有评论的id
+            //首先获取该文章资讯的总点赞数量
+            Integer likeCount = redisCache.getCacheObject(ONE_LIKE_COUNT + communityId);
+            //再获取删除的评论的点赞数量
+            Integer commentLikeCount = redisCache.getCacheObject(TWO_LIKE_COUNT + commentId);
+            //所有子集的点赞数量
+            int commentLikeChildrenCount = 0;
+            if (commentIdList.size() > 0) {
+                //说明删除了子集、获取所有子集的点赞数量
+                for (Long commentIdChildren : commentIdList) {
+                    String commentLikeChildrenCountString = redisCache.getCacheObject(TWO_LIKE_COUNT + commentIdChildren);
+                    if (StringUtils.isNotBlank(commentLikeChildrenCountString)) {
+                        commentLikeChildrenCount = commentLikeChildrenCount + Integer.parseInt(commentLikeChildrenCountString);
+                    }
+                }
+            }
+            //把删除后点赞数量写入到redis
+            likeCount = likeCount - commentLikeCount - commentLikeChildrenCount;
+            if (likeCount < 0){
+                likeCount = 0;
+            }
+            redisCache.setCacheObject(ONE_LIKE_COUNT + communityId, likeCount);
+            //todo 删除后还需要减少未读互动的数据
         }
         return result;
     }
 
     /**
-     * 查询所有评论组装成前端所需要的数据结构
+     * 根据parent_id查询所有评论组装成前端所需要的子集数据结构 带分页
+     *
      * @param commentIndex
      * @return
      */
     @Override
-    public AjaxResult getAllComment(CommentIndex commentIndex) {
-        List<CommentIndexVo> allComment = commentIndexMapper.getAllComment(commentIndex);
+    public AjaxResult getParentComment(CommentIndex commentIndex) {
+        Long userId = SecurityUtils.getUserId();
+        List<CommentChildrenVo> allComment = commentIndexMapper.getParentComment(commentIndex);
+        //要判断所有评论当前人员是否点赞过
+        if (allComment != null && allComment.size() > 0) {
+            //要判断所有评论当前人员是否点赞过
+            //该用户点赞回复的key
+            String myLikeTwoKey = TWO_MY_LIKE + userId;
+            List<Long> communityIdList = redisCache.getCacheList(myLikeTwoKey);
+            if (communityIdList != null && communityIdList.size() > 0) {
+                for (CommentChildrenVo commentChildrenVo : allComment) {
+                    if (communityIdList.contains(commentChildrenVo.getId())) {
+                        commentChildrenVo.setIsLike("Y");
+                    }
+                }
+            }
+        }
         return AjaxResult.success(allComment);
     }
+
+    /**
+     * 根据查询所有一级评论组带子集总数组装成前端所需要的数据结构 带分页
+     *
+     * @param commentIndex
+     * @return
+     */
+    @Override
+    public List<CommentIndexVo> getRootComment(CommentIndex commentIndex) {
+        Long userId = SecurityUtils.getUserId();
+        List<CommentIndexVo> rootComment = commentIndexMapper.getRootComment(commentIndex);
+        if (rootComment != null && rootComment.size() > 0) {
+            //要判断所有评论当前人员是否点赞过
+            //该用户点赞回复的key
+            String myLikeTwoKey = TWO_MY_LIKE + userId;
+            List<Long> communityIdList = redisCache.getCacheList(myLikeTwoKey);
+            if (communityIdList != null && communityIdList.size() > 0) {
+                for (CommentIndexVo commentIndexVo : rootComment) {
+                    if (communityIdList.contains(commentIndexVo.getId())) {
+                        commentIndexVo.setIsLike("Y");
+                    }
+                }
+            }
+        }
+        return rootComment;
+    }
 }

+ 284 - 21
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommentLikesServiceImpl.java

@@ -1,97 +1,360 @@
 package com.ruoyi.system.service.impl;
 
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.communityNews.CommentLikes;
 import com.ruoyi.system.mapper.CommentLikesMapper;
 import com.ruoyi.system.service.ICommentLikesService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import static com.ruoyi.common.constant.Constants.*;
 
 /**
  * 社区资讯点赞Service业务层处理
- * 
+ *
  * @author boman
  * @date 2025-02-25
  */
 @Service
-public class CommentLikesServiceImpl implements ICommentLikesService 
-{
+public class CommentLikesServiceImpl implements ICommentLikesService {
     @Autowired
     private CommentLikesMapper commentLikesMapper;
 
+    @Autowired
+    private RedisCache redisCache;
+
     /**
      * 查询社区资讯点赞
-     * 
+     *
      * @param likesId 社区资讯点赞主键
      * @return 社区资讯点赞
      */
     @Override
-    public CommentLikes selectCommentLikesByLikesId(Long likesId)
-    {
+    public CommentLikes selectCommentLikesByLikesId(Long likesId) {
         return commentLikesMapper.selectCommentLikesByLikesId(likesId);
     }
 
     /**
      * 查询社区资讯点赞列表
-     * 
+     *
      * @param commentLikes 社区资讯点赞
      * @return 社区资讯点赞
      */
     @Override
-    public List<CommentLikes> selectCommentLikesList(CommentLikes commentLikes)
-    {
+    public List<CommentLikes> selectCommentLikesList(CommentLikes commentLikes) {
         return commentLikesMapper.selectCommentLikesList(commentLikes);
     }
 
     /**
      * 新增社区资讯点赞
-     * 
+     *
      * @param commentLikes 社区资讯点赞
      * @return 结果
      */
     @Override
-    public int insertCommentLikes(CommentLikes commentLikes)
-    {
+    public int insertCommentLikes(CommentLikes commentLikes) {
         commentLikes.setCreateTime(DateUtils.getNowDate());
         return commentLikesMapper.insertCommentLikes(commentLikes);
     }
 
     /**
      * 修改社区资讯点赞
-     * 
+     *
      * @param commentLikes 社区资讯点赞
      * @return 结果
      */
     @Override
-    public int updateCommentLikes(CommentLikes commentLikes)
-    {
+    public int updateCommentLikes(CommentLikes commentLikes) {
         commentLikes.setUpdateTime(DateUtils.getNowDate());
         return commentLikesMapper.updateCommentLikes(commentLikes);
     }
 
     /**
      * 批量删除社区资讯点赞
-     * 
+     *
      * @param likesIds 需要删除的社区资讯点赞主键
      * @return 结果
      */
     @Override
-    public int deleteCommentLikesByLikesIds(Long[] likesIds)
-    {
+    public int deleteCommentLikesByLikesIds(Long[] likesIds) {
         return commentLikesMapper.deleteCommentLikesByLikesIds(likesIds);
     }
 
     /**
      * 删除社区资讯点赞信息
-     * 
+     *
      * @param likesId 社区资讯点赞主键
      * @return 结果
      */
     @Override
-    public int deleteCommentLikesByLikesId(Long likesId)
-    {
+    public int deleteCommentLikesByLikesId(Long likesId) {
         return commentLikesMapper.deleteCommentLikesByLikesId(likesId);
     }
+
+    /**
+     * 进行点赞操作
+     * //点赞数据存储到redis,设置redis过期key监听,继承onMessage类把数据更新到数据库中
+     * //点赞目标id + 目标类型 + 用户信息组装成CommentLikes写入数据库
+     * //文章需要统计点赞的数量和当前登录用户是否已经点赞
+     * //点赞之前应该去查一遍该文章或者回复的点赞key,value应该是点赞的人员id判断用户是否已经点赞过了,点赞过了就取消,没点赞过就加入
+     * //还需要同步到数据库,需要一个完整的点赞key 一个设置过期时间的监听key
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public AjaxResult giveTheThumbs(CommentLikes commentLikes) {
+        String targetType = commentLikes.getTargetType();
+        Long targetId = commentLikes.getTargetId();
+        Long userId = commentLikes.getUserId();
+        //保存点赞信息
+        //根据点赞目标id' 点赞目标类型(1:资讯 2:回复) 用户id查询是否已经点赞过
+        CommentLikes commentLikesOld = commentLikesMapper.selectCommentLikes(commentLikes);
+        if (commentLikesOld != null){
+            commentLikesOld.setDelFlag("Y");
+            commentLikesMapper.updateCommentLikes(commentLikesOld);
+        }else {
+            commentLikesMapper.insertCommentLikes(commentLikes);
+        }
+        if (StringUtils.isNotBlank(targetType)) {
+            if (ONE.equals(targetType)) {
+                // 社区资讯文章点赞的人员集合的key key = LIKE_ONE:{targetId} value = [userId,userId];
+                String likeOneKey = ONE_LIKE + targetId;
+                //社区资讯文章点赞的数量数据库同步的key
+                String likeOneCountTimeKey = ONE_LIKE_COUNT_TIME + targetId;
+                //文章永久点赞的数量key
+                String likeOneCountKey = ONE_LIKE_COUNT + targetId;
+                //先去查看key对应的value集合 value = 点赞人员的id集合
+                List<Long> userIdListValue = redisCache.getCacheList(likeOneKey);
+                //该用户点赞文章的key
+                String myLikeOneKey = ONE_MY_LIKE + userId;
+                List<Long> communityIdList = redisCache.getCacheList(myLikeOneKey);
+                if (userIdListValue != null && userIdListValue.size() > 0) {
+                    //说明该文章被点过赞
+                    //判断该用户是否点过赞
+                    if (userIdListValue.contains(userId)) {
+                        //进行取消点赞
+                        return unLike(commentLikes);
+                    } else {
+                        //新增点赞信息
+                        return isLike(commentLikes);
+                    }
+                } else {
+                    //该文章没有被点过赞直接新增
+                    userIdListValue = new ArrayList<>();
+                    userIdListValue.add(userId);
+                    redisCache.setCacheList(likeOneKey, userIdListValue);
+                    //给数据库同步数据在 redis中增加一个有过期时间的key 1分钟过期时间  key=like_one_count_time:{文章id}#{数量}
+                    redisCache.setCacheObject(likeOneCountTimeKey+"#"+1, 1, 1, TimeUnit.MINUTES);
+                    //给该用户点赞文章的key添加值
+                    communityIdList.add(targetId);
+                    redisCache.setCacheList(myLikeOneKey, communityIdList);
+                    //给该文章永久点赞数量的key添加值
+                    redisCache.setCacheObject(likeOneCountKey, 1);
+                    return AjaxResult.success();
+                }
+            } else {
+                //对回复进行点赞
+                // 社区资讯回复点赞的人员集合的key key = LIKE_ONE:{targetId} value = [userId,userId];
+                String likeTwoKey = TWO_LIKE + targetId;
+                //社区资讯回复点赞的数量数据库同步的key
+                String likeTwoCountTimeKey = TWO_LIKE_COUNT_TIME + targetId;
+                //回复永久点赞的数量key
+                String likeTwoCountKey = TWO_LIKE_COUNT + targetId;
+                //先去查看key对应的value集合 value = 点赞人员的id集合
+                List<Long> userIdListValue = redisCache.getCacheList(likeTwoKey);
+                //该用户点赞回复的key
+                String myLikeTwoKey = TWO_MY_LIKE + userId;
+                List<Long> communityIdList = redisCache.getCacheList(myLikeTwoKey);
+                if (userIdListValue != null && userIdListValue.size() > 0) {
+                    //说明该回复被点过赞
+                    //判断该用户是否点过赞
+                    if (userIdListValue.contains(userId)) {
+                        //进行取消点赞
+                        return unLike(commentLikes);
+                    } else {
+                        //新增点赞信息
+                        return isLike(commentLikes);
+                    }
+                } else {
+                    //该回复没有被点过赞直接新增
+                    userIdListValue = new ArrayList<>();
+                    userIdListValue.add(userId);
+                    redisCache.setCacheList(likeTwoKey, userIdListValue);
+                    //给数据库同步数据在 redis中增加一个有过期时间的key 1分钟过期时间
+                    redisCache.setCacheObject(likeTwoCountTimeKey+"#"+1, 1, 1, TimeUnit.MINUTES);
+                    //给该用户点赞回复的key添加值
+                    communityIdList.add(targetId);
+                    redisCache.setCacheList(myLikeTwoKey, communityIdList);
+                    //给该回复永久点赞数量的key添加值
+                    redisCache.setCacheObject(likeTwoCountKey, 1);
+                    return AjaxResult.success();
+                }
+            }
+        }
+        return AjaxResult.error("点赞失败");
+    }
+
+    /**
+     * 用户点赞,但不是第一次点赞的方法
+     *
+     * @param commentLikes
+     * @return
+     */
+    public AjaxResult isLike(CommentLikes commentLikes) {
+        String targetType = commentLikes.getTargetType();
+        Long targetId = commentLikes.getTargetId();
+        Long userId = commentLikes.getUserId();
+        if (ONE.equals(targetType)) {
+            // 社区资讯文章点赞的人员集合的key key = ONE_LIKE:{targetId} value = [userId,userId];
+            String likeOneKey = ONE_LIKE + targetId;
+            //社区资讯文章点赞的数量数据库同步的key
+            String likeOneCountTimeKey = ONE_LIKE_COUNT + targetId;
+            //文章永久点赞的数量key
+            String likeOneCountKey = ONE_LIKE_COUNT + targetId;
+            //先去查看key对应的value集合 value = 点赞人员的id集合
+            List<Long> userIdListValue = redisCache.getCacheList(likeOneKey);
+            //该用户点赞文章的key
+            String myLikeOneKey = ONE_MY_LIKE + userId;
+            List<Long> communityIdList = redisCache.getCacheList(myLikeOneKey);
+            //新增点赞信息
+            // 新增社区资讯文章点赞的人员集合
+            userIdListValue.add(userId);
+            redisCache.setCacheList(likeOneKey, userIdListValue);
+            //新增该用户点赞文章
+            communityIdList.add(targetId);
+            redisCache.setCacheList(myLikeOneKey, communityIdList);
+            //新增文章永久点赞数量的key更新值
+            Integer likeOneCount = redisCache.getCacheObject(likeOneCountKey);
+            likeOneCount = likeOneCount + 1;
+            redisCache.setCacheObject(likeOneCountKey, likeOneCount);
+            //新增数据库同步数据在 redis中增加一个有过期时间的key 1分钟过期时间
+            redisCache.setCacheObject(likeOneCountTimeKey+"#"+likeOneCount, likeOneCount, 1, TimeUnit.MINUTES);
+            return AjaxResult.success();
+        } else {
+            // 社区资讯文章回复的人员集合的key key = TWO_LIKE:{targetId} value = [userId,userId];
+            String likeTwoKey = TWO_LIKE + targetId;
+            //社区资讯文章回复的数量数据库同步的key
+            String likeTwoCountTimeKey = TWO_LIKE_COUNT_TIME + targetId;
+            //文章永久回复的数量key
+            String likeTwoCountKey = TWO_LIKE_COUNT + targetId;
+            //先去查看key对应的value集合 value = 点赞人员的id集合
+            List<Long> userIdListValue = redisCache.getCacheList(likeTwoKey);
+            //该用户点赞回复的key
+            String myLikeTwoKey = TWO_MY_LIKE + userId;
+            List<Long> communityIdList = redisCache.getCacheList(myLikeTwoKey);
+            //新增点赞信息
+            // 新增社区资讯回复点赞的人员集合
+            userIdListValue.add(userId);
+            redisCache.setCacheList(likeTwoKey, userIdListValue);
+            //新增该用户点赞回复
+            communityIdList.add(targetId);
+            redisCache.setCacheList(myLikeTwoKey, communityIdList);
+            //新增回复永久点赞数量的key更新值
+            Integer likeTwoCount = redisCache.getCacheObject(likeTwoCountKey);
+            likeTwoCount = likeTwoCount + 1;
+            redisCache.setCacheObject(likeTwoCountKey, likeTwoCount);
+            //新增数据库同步数据在 redis中增加一个有过期时间的key 1分钟过期时间
+            redisCache.setCacheObject(likeTwoCountTimeKey+"#"+likeTwoCount, likeTwoCount, 1, TimeUnit.MINUTES);
+            return AjaxResult.success();
+        }
+    }
+
+    /**
+     * 用户取消点赞
+     *
+     * @param commentLikes
+     * @return
+     */
+    public AjaxResult unLike(CommentLikes commentLikes) {
+        //用户点过赞 进行取消点赞
+        String targetType = commentLikes.getTargetType();
+        Long targetId = commentLikes.getTargetId();
+        Long userId = commentLikes.getUserId();
+        if (ONE.equals(targetType)) {
+            //文章永久点赞的数量key
+            String likeOneCountKey = ONE_LIKE_COUNT + targetId;
+            //社区资讯文章点赞的数量数据库同步的key
+            String likeOneCountTimeKey = ONE_LIKE_COUNT_TIME + targetId;
+            //-------------------------删除 社区资讯文章点赞的人员集合value中的userId
+            //  key = ONE_LIKE:{targetId} value = [userId,userId];
+            String likeOneKey = ONE_LIKE + targetId;
+            //先去查看key对应的value集合
+            List<Long> userIdListValue = redisCache.getCacheList(likeOneKey);
+            userIdListValue.remove(userId);
+            if (userIdListValue.size() == 0){
+                redisCache.deleteObject(likeOneKey);
+            }else {
+                // 社区资讯文章点赞的人员集合中删除该用户
+                redisCache.setCacheList(likeOneKey, userIdListValue);
+            }
+
+            //-------------------------删除 该用户点赞文章value中的文章id
+            String myLikeOneKey = ONE_MY_LIKE + userId;
+            List<Long> communityIdListValue = redisCache.getCacheList(myLikeOneKey);
+            communityIdListValue.remove(targetId);
+            if (communityIdListValue.size() == 0){
+                redisCache.deleteObject(myLikeOneKey);
+            }else {
+                redisCache.setCacheList(myLikeOneKey, communityIdListValue);
+            }
+            // ---------点赞数量操作------------------
+            //先获取永久点赞数量的值
+            Integer likeCount = redisCache.getCacheObject(likeOneCountKey);
+            likeCount = likeCount - 1;
+            if (likeCount < 0) {
+                likeCount = 0;
+            }
+            //更新永久点赞数量
+            redisCache.setCacheObject(likeOneCountKey, likeCount);
+            //给数据库同步数据在 redis中增加一个有过期时间的key 1分钟过期时间
+            redisCache.setCacheObject(likeOneCountTimeKey+"#"+likeCount, likeCount, 1, TimeUnit.MINUTES);
+            return AjaxResult.success();
+        } else {
+            //评论的删除
+            //评论永久点赞的数量key
+            String likeTwoCountKey = TWO_LIKE_COUNT + targetId;
+            //社区资讯评论点赞的数量数据库同步的key
+            String likeTwoCountTimeKey = TWO_LIKE_COUNT_TIME + targetId;
+            //-------------------------删除 社区资讯文章评论的人员集合value中的userId
+            //  key = LIKE_ONE:{targetId} value = [userId,userId];
+            String likeTwoKey = TWO_LIKE + targetId;
+            //先去查看key对应的value集合
+            List<Long> userIdListValue = redisCache.getCacheList(likeTwoKey);
+            userIdListValue.remove(userId);
+            if (userIdListValue.size() == 0){
+                redisCache.deleteObject(likeTwoKey);
+            }else {
+                // 社区资讯文章评论的人员集合中删除该用户
+                redisCache.setCacheList(likeTwoKey, userIdListValue);
+            }
+            //-------------------------删除 该用户点赞评论value中的文章id
+            String myLikeTwoKey = TWO_MY_LIKE + userId;
+            List<Long> communityIdListValue = redisCache.getCacheList(myLikeTwoKey);
+            communityIdListValue.remove(targetId);
+            if (communityIdListValue.size() == 0){
+                redisCache.deleteObject(myLikeTwoKey);
+            }else {
+                redisCache.setCacheList(myLikeTwoKey, communityIdListValue);
+            }
+            // ---------点赞数量操作------------------
+            //先获取永久点赞数量的值
+            Integer likeCount = redisCache.getCacheObject(likeTwoCountKey);
+            likeCount = likeCount - 1;
+            if (likeCount < 0) {
+                likeCount = 0;
+            }
+            //更新永久点赞数量
+            redisCache.setCacheObject(likeTwoCountKey, likeCount);
+            //给数据库同步数据在 redis中增加一个有过期时间的key 1分钟过期时间
+            redisCache.setCacheObject(likeTwoCountTimeKey+"#"+likeCount, likeCount, 1, TimeUnit.MINUTES);
+            return AjaxResult.success();
+        }
+    }
 }

+ 133 - 22
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommentStarsServiceImpl.java

@@ -1,97 +1,208 @@
 package com.ruoyi.system.service.impl;
 
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.communityNews.CommentStars;
 import com.ruoyi.system.mapper.CommentStarsMapper;
+import com.ruoyi.system.mapper.CommunityNewsMapper;
 import com.ruoyi.system.service.ICommentStarsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
 
+import static com.ruoyi.common.constant.Constants.*;
+
 /**
  * 社区资讯收藏Service业务层处理
- * 
+ *
  * @author boman
  * @date 2025-02-25
  */
 @Service
-public class CommentStarsServiceImpl implements ICommentStarsService 
-{
+public class CommentStarsServiceImpl implements ICommentStarsService {
     @Autowired
     private CommentStarsMapper commentStarsMapper;
+    @Autowired
+    private CommunityNewsMapper communityNewsMapper;
+    @Autowired
+    private RedisCache redisCache;
 
     /**
      * 查询社区资讯收藏
-     * 
+     *
      * @param starsId 社区资讯收藏主键
      * @return 社区资讯收藏
      */
     @Override
-    public CommentStars selectCommentStarsByStarsId(Long starsId)
-    {
+    public CommentStars selectCommentStarsByStarsId(Long starsId) {
         return commentStarsMapper.selectCommentStarsByStarsId(starsId);
     }
 
     /**
      * 查询社区资讯收藏列表
-     * 
+     *
      * @param commentStars 社区资讯收藏
      * @return 社区资讯收藏
      */
     @Override
-    public List<CommentStars> selectCommentStarsList(CommentStars commentStars)
-    {
+    public List<CommentStars> selectCommentStarsList(CommentStars commentStars) {
         return commentStarsMapper.selectCommentStarsList(commentStars);
     }
 
     /**
      * 新增社区资讯收藏
-     * 
+     *
      * @param commentStars 社区资讯收藏
      * @return 结果
      */
     @Override
-    public int insertCommentStars(CommentStars commentStars)
-    {
-        commentStars.setCreateTime(DateUtils.getNowDate());
+    public int insertCommentStars(CommentStars commentStars) {
         return commentStarsMapper.insertCommentStars(commentStars);
     }
 
     /**
      * 修改社区资讯收藏
-     * 
+     *
      * @param commentStars 社区资讯收藏
      * @return 结果
      */
     @Override
-    public int updateCommentStars(CommentStars commentStars)
-    {
+    public int updateCommentStars(CommentStars commentStars) {
         commentStars.setUpdateTime(DateUtils.getNowDate());
         return commentStarsMapper.updateCommentStars(commentStars);
     }
 
     /**
      * 批量删除社区资讯收藏
-     * 
+     *
      * @param starsIds 需要删除的社区资讯收藏主键
      * @return 结果
      */
     @Override
-    public int deleteCommentStarsByStarsIds(Long[] starsIds)
-    {
+    public int deleteCommentStarsByStarsIds(Long[] starsIds) {
         return commentStarsMapper.deleteCommentStarsByStarsIds(starsIds);
     }
 
     /**
      * 删除社区资讯收藏信息
-     * 
+     *
      * @param starsId 社区资讯收藏主键
      * @return 结果
      */
     @Override
-    public int deleteCommentStarsByStarsId(Long starsId)
-    {
+    public int deleteCommentStarsByStarsId(Long starsId) {
         return commentStarsMapper.deleteCommentStarsByStarsId(starsId);
     }
+
+    /**
+     * 社区资讯收藏或取消收藏
+     */
+    @Override
+    public AjaxResult getStars(CommentStars commentStars) {
+        //当有人收藏了,需要记录到redis作为未读信息,需要统计未读的总数,需要在文章列表也给对应是否有未读标识
+        Long userId = commentStars.getUserId();
+        //收藏或者取消收藏判断用户是否收藏过,收藏过就取消收藏
+        Long targetId = commentStars.getTargetId();
+        String starsCommunityKey = STARS_COMMUNITY + targetId;
+        //该资讯收藏数量的key
+        String starsUserCountKey = STARS_USER_COUNT + targetId;
+        List<Long> userIdList = redisCache.getCacheList(starsCommunityKey);
+        Integer starsCount = 0;
+        if (userIdList != null && userIdList.size() > 0) {
+            //判断该用户是否收藏过
+            if (userIdList.contains(userId)) {
+                //说明收藏过则-----取消收藏
+                userIdList.remove(userId);
+                if (userIdList.size() == 0) {
+                    redisCache.deleteObject(starsCommunityKey);
+                } else {
+                    redisCache.setCacheList(starsCommunityKey, userIdList);
+                }
+                //收藏数量-1
+                starsCount = redisCache.getCacheObject(starsUserCountKey);
+                starsCount = starsCount - 1;
+                if (starsCount < 0) {
+                    starsCount = 0;
+                }
+                redisCache.setCacheObject(starsUserCountKey, starsCount);
+                commentStars.setDelFlag("Y");
+                //更新数据库
+                commentStarsMapper.updateCommentStarsByUserIdAndCommunityId(commentStars);
+            } else {
+                //则-------收藏
+                userIdList.add(userId);
+                redisCache.setCacheList(starsCommunityKey, userIdList);
+                //收藏数量+1
+                starsCount = redisCache.getCacheObject(starsUserCountKey);
+                redisCache.setCacheObject(starsUserCountKey, starsCount + 1);
+                //收藏表新增数据
+                commentStarsMapper.insertCommentStars(commentStars);
+            }
+        } else {
+            //----------第一次有人收藏
+            userIdList = new ArrayList<>();
+            userIdList.add(userId);
+            redisCache.setCacheList(starsCommunityKey, userIdList);
+            starsCount = 1;
+            //收藏数量+1
+            redisCache.setCacheObject(starsUserCountKey, starsCount);
+            //收藏表新增数据
+            commentStarsMapper.insertCommentStars(commentStars);
+        }
+        //更新资讯表中数量
+        communityNewsMapper.updateCommunityNewsStars(targetId, starsCount.toString());
+        return AjaxResult.success();
+    }
+
+    /**
+     * 党建收藏或取消收藏
+     *
+     * @param commentStars
+     * @return
+     */
+    @Override
+    public AjaxResult getPartyNewsStars(CommentStars commentStars) {
+        Long userId = commentStars.getUserId();
+        //收藏或者取消收藏判断用户是否收藏过,收藏过就取消收藏
+        Long targetId = commentStars.getTargetId();
+        String partyKey = STARS_PARTY_NEWS + userId;
+        List<Long> partyIdList = redisCache.getCacheList(partyKey);
+        int starsCount = 0;
+        String starsPartyNewsCount = redisCache.getCacheObject(STARS_PARTY_NEWS_COUNT + targetId);
+        if (partyIdList != null && partyIdList.size() > 0) {
+            if (partyIdList.contains(targetId)) {
+                //说明该党建资讯该用户收藏过     取消收藏
+                partyIdList.remove(targetId);
+                if (partyIdList.size() == 0) {
+                    redisCache.deleteObject(partyKey);
+                } else {
+                    redisCache.setCacheList(partyKey, partyIdList);
+                }
+                commentStarsMapper.updateCommentStarsByUserIdAndCommunityId(commentStars);
+                if (StringUtils.isNotBlank(starsPartyNewsCount)) {
+                    starsCount = Integer.parseInt(starsPartyNewsCount) - 1;
+                    if (starsCount < 0) {
+                        starsCount = 0;
+                    }
+                    redisCache.setCacheObject(STARS_PARTY_NEWS_COUNT + targetId, starsCount);
+                }
+            } else {
+                //则收藏
+                partyIdList.add(targetId);
+                redisCache.setCacheList(partyKey, partyIdList);
+                //收藏表新增数据
+                commentStarsMapper.insertCommentStars(commentStars);
+                //收藏数量+1
+                if (StringUtils.isNotBlank(starsPartyNewsCount)) {
+                    starsCount = Integer.parseInt(starsPartyNewsCount) + 1;
+                    redisCache.setCacheObject(STARS_PARTY_NEWS_COUNT + targetId, starsCount);
+                }
+            }
+        }
+        return AjaxResult.success();
+    }
 }

+ 43 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommunityNewsServiceImpl.java

@@ -1,14 +1,19 @@
 package com.ruoyi.system.service.impl;
 
+import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.system.domain.communityNews.CommunityNews;
 import com.ruoyi.system.mapper.CommunityNewsMapper;
 import com.ruoyi.system.service.ICommunityNewsService;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
 
+import static com.ruoyi.common.constant.Constants.*;
+
 /**
  * 社区资讯Service业务层处理
  * 
@@ -20,6 +25,8 @@ public class CommunityNewsServiceImpl implements ICommunityNewsService
 {
     @Autowired
     private CommunityNewsMapper communityNewsMapper;
+    @Autowired
+    private RedisCache redisCache;
 
     /**
      * 查询社区资讯
@@ -30,7 +37,42 @@ public class CommunityNewsServiceImpl implements ICommunityNewsService
     @Override
     public CommunityNews selectCommunityNewsByCommunityId(Long communityId)
     {
-        return communityNewsMapper.selectCommunityNewsByCommunityId(communityId);
+        CommunityNews communityNews = communityNewsMapper.selectCommunityNewsByCommunityId(communityId);
+        communityNews.setIsStar("N");
+        communityNews.setIsLike("N");
+        Long userId = SecurityUtils.getUserId();
+        String likeOneKey = ONE_LIKE + communityId;
+        List<Long> userIdList = redisCache.getCacheList(likeOneKey);
+        if (userIdList != null && userIdList.size() > 0){
+            if (userIdList.contains(userId)){
+                communityNews.setIsLike("Y");
+            }
+        }
+        //该资讯收藏人员的key
+        String starsCommunityKey = STARS_COMMUNITY + communityId;
+        List<Long> userIdListStars = redisCache.getCacheList(starsCommunityKey);
+        if (userIdListStars != null && userIdListStars.size() > 0){
+            //判断该用户是否收藏过
+            if (userIdListStars.contains(userId)){
+                communityNews.setIsStar("Y");
+            }
+        }
+        //查询redis中的点赞数量,收藏数量,评论数量
+        Object likeCount = redisCache.getCacheObject(ONE_LIKE_COUNT + communityId);
+        if (ObjectUtils.isNotEmpty(likeCount)){
+            communityNews.setUserLikes(likeCount.toString());
+        }
+        //收藏
+        Object startCount = redisCache.getCacheObject(STARS_USER_COUNT + communityId);
+        if (ObjectUtils.isNotEmpty(startCount)){
+            communityNews.setUserStars(startCount.toString());
+        }
+        //评论
+        Object communityCommentCount = redisCache.getCacheObject(COMMUNITY_COMMENT_COUNT + communityId);
+        if (ObjectUtils.isNotEmpty(communityCommentCount)){
+            communityNews.setUserComment(communityCommentCount.toString());
+        }
+        return communityNews;
     }
 
     /**

+ 10 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/HouseInfoServiceImpl.java

@@ -49,6 +49,16 @@ public class HouseInfoServiceImpl implements IHouseInfoService
         return houseInfoMapper.selectHouseInfoList(houseInfo);
     }
 
+    /**
+     * 查询房屋信息列表带人员信息
+     * @param residentInfo
+     * @return
+     */
+    @Override
+    public List<ResidentInfo> selectHouseInfoListAndResidentInfo(ResidentInfo residentInfo) {
+        return houseInfoMapper.selectHouseInfoListAndResidentInfo(residentInfo);
+    }
+
     /**
      * 新增房屋信息
      * 

+ 34 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/PartyNewsServiceImpl.java

@@ -1,6 +1,9 @@
 package com.ruoyi.system.service.impl;
 
+import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.system.domain.partyNews.PartyNews;
 import com.ruoyi.system.mapper.PartyNewsMapper;
 import com.ruoyi.system.service.IPartyNewsService;
@@ -9,6 +12,9 @@ import org.springframework.stereotype.Service;
 
 import java.util.List;
 
+import static com.ruoyi.common.constant.Constants.STARS_PARTY_NEWS;
+import static com.ruoyi.common.constant.Constants.STARS_PARTY_NEWS_COUNT;
+
 /**
  * 党建资讯Service业务层处理
  * 
@@ -21,6 +27,9 @@ public class PartyNewsServiceImpl implements IPartyNewsService
     @Autowired
     private PartyNewsMapper partyNewsMapper;
 
+    @Autowired
+    private RedisCache redisCache;
+
     /**
      * 查询党建资讯
      * 
@@ -30,7 +39,12 @@ public class PartyNewsServiceImpl implements IPartyNewsService
     @Override
     public PartyNews selectPartyNewsByPartyId(Long partyId)
     {
-        return partyNewsMapper.selectPartyNewsByPartyId(partyId);
+        PartyNews partyNews = partyNewsMapper.selectPartyNewsByPartyId(partyId);
+        //观看次数+1
+        Long viewCount = partyNews.getViewCount();
+        partyNews.setViewCount(viewCount+1);
+        partyNewsMapper.updatePartyNews(partyNews);
+        return partyNews;
     }
 
     /**
@@ -42,7 +56,25 @@ public class PartyNewsServiceImpl implements IPartyNewsService
     @Override
     public List<PartyNews> selectPartyNewsList(PartyNews partyNews)
     {
-        return partyNewsMapper.selectPartyNewsList(partyNews);
+        List<PartyNews> partyNewsList = partyNewsMapper.selectPartyNewsList(partyNews);
+        if (partyNewsList != null && partyNewsList.size() > 0){
+            String partyKey = STARS_PARTY_NEWS+ SecurityUtils.getUserId();
+            List<Long> partyIdList = redisCache.getCacheList(partyKey);
+            for (PartyNews news : partyNewsList) {
+                news.setIsStars("N");
+                Long partyId = news.getPartyId();
+                if (partyIdList.contains(partyId)){
+                    news.setIsStars("Y");
+                }
+                //插入收藏数量
+                partyNews.setStarsCount(0);
+                String startCount = redisCache.getCacheObject(STARS_PARTY_NEWS_COUNT + partyId);
+                if (StringUtils.isNotBlank(startCount)){
+                    partyNews.setStarsCount(Integer.parseInt(startCount));
+                }
+            }
+        }
+        return partyNewsList;
     }
 
     /**

+ 57 - 27
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProprietorCarServiceImpl.java

@@ -9,57 +9,58 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * 业主车辆管理Service业务层处理
- * 
+ *
  * @author boman
  * @date 2025-02-20
  */
 @Service
-public class ProprietorCarServiceImpl implements IProprietorCarService 
-{
+public class ProprietorCarServiceImpl implements IProprietorCarService {
     @Autowired
     private ProprietorCarMapper proprietorCarMapper;
 
     /**
      * 查询业主车辆管理
-     * 
+     *
      * @param carId 业主车辆管理主键
      * @return 业主车辆管理
      */
     @Override
-    public ProprietorCar selectProprietorCarByCarId(Long carId)
-    {
+    public ProprietorCar selectProprietorCarByCarId(Long carId) {
         return proprietorCarMapper.selectProprietorCarByCarId(carId);
     }
 
     /**
      * 查询业主车辆管理列表
-     * 
+     *
      * @param proprietorCar 业主车辆管理
      * @return 业主车辆管理
      */
     @Override
-    public List<ProprietorCar> selectProprietorCarList(ProprietorCar proprietorCar)
-    {
+    public List<ProprietorCar> selectProprietorCarList(ProprietorCar proprietorCar) {
         return proprietorCarMapper.selectProprietorCarList(proprietorCar);
     }
 
     /**
      * 新增业主车辆管理
-     * 
+     *
      * @param proprietorCar 业主车辆管理
      * @return 结果
      */
     @Override
-    public int insertProprietorCar(ProprietorCar proprietorCar)
-    {
+    public int insertProprietorCar(ProprietorCar proprietorCar) {
         //根据车牌号判断是否是新能源
         proprietorCar.setCreateTime(DateUtils.getNowDate());
         String plateNumber = proprietorCar.getPlateNumber();
+        if (!checkPlateNumber(plateNumber)){
+            return 0;
+        }
         String vehicleType = "燃油车";
-        if (isNewEnergyVehicle(plateNumber)){
+        if (isNewEnergyVehicle(plateNumber)) {
             vehicleType = "新能源";
         }
         proprietorCar.setVehicleType(vehicleType);
@@ -69,6 +70,7 @@ public class ProprietorCarServiceImpl implements IProprietorCarService
 
     /**
      * 判断是否是新能源
+     *
      * @param licensePlate
      * @return
      */
@@ -77,26 +79,56 @@ public class ProprietorCarServiceImpl implements IProprietorCarService
             return false;
         }
 
-        // 获取车牌号的第一个字符
-        char firstChar = licensePlate.charAt(0);
+        // 去除所有非汉字、字母和数字的字符
+        String cleaned = licensePlate.replaceAll("[^\\u4e00-\\u9fa5A-Z0-9]", "");
+
+        // 检查总长度是否为7或8位
+        int length = cleaned.length();
+        if (length != 7 && length != 8) {
+            return false;
+        }
+
+        // 正则表达式验证结构
+        String regex = "^[\u4e00-\u9fa5]" +         // 省份汉字
+                "[A-HJ-NP-Z]" +              // 发牌机关(排除I/O)
+                "[DFABCEGHJKLMNP]" +                     // 新能源标识(D/F)
+                "[A-HJ-NP-Z0-9]{4,5}$";      // 后续字符(排除I/O)
 
-        // 判断是否是新能源车辆
-        return firstChar == 'D' || firstChar == 'F';
+        return cleaned.matches(regex);
     }
 
+    /**
+     * 判断车牌号是否合规
+     *
+     * @param plateNumber
+     * @return
+     */
+    public static boolean checkPlateNumber(String plateNumber) {
+        String regEx = "^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$";
+        // 编译正则表达式
+        //Pattern pattern = Pattern.compile(regEx);
+        // 忽略大小写的写法
+        Pattern pat = Pattern.compile(regEx, Pattern.CASE_INSENSITIVE);
+
+        Matcher matcher = pat.matcher(plateNumber);
+        // 字符串是否与正则表达式相匹配
+        return matcher.matches();
+    }
     /**
      * 修改业主车辆管理
-     * 
+     *
      * @param proprietorCar 业主车辆管理
      * @return 结果
      */
     @Override
-    public int updateProprietorCar(ProprietorCar proprietorCar)
-    {
+    public int updateProprietorCar(ProprietorCar proprietorCar) {
         proprietorCar.setUpdateTime(DateUtils.getNowDate());
         String plateNumber = proprietorCar.getPlateNumber();
+        if (!checkPlateNumber(plateNumber)){
+            return 0;
+        }
         String vehicleType = "燃油车";
-        if (isNewEnergyVehicle(plateNumber)){
+        if (isNewEnergyVehicle(plateNumber)) {
             vehicleType = "新能源";
         }
         proprietorCar.setVehicleType(vehicleType);
@@ -105,25 +137,23 @@ public class ProprietorCarServiceImpl implements IProprietorCarService
 
     /**
      * 批量删除业主车辆管理
-     * 
+     *
      * @param carIds 需要删除的业主车辆管理主键
      * @return 结果
      */
     @Override
-    public int deleteProprietorCarByCarIds(Long[] carIds)
-    {
+    public int deleteProprietorCarByCarIds(Long[] carIds) {
         return proprietorCarMapper.deleteProprietorCarByCarIds(carIds);
     }
 
     /**
      * 删除业主车辆管理信息
-     * 
+     *
      * @param carId 业主车辆管理主键
      * @return 结果
      */
     @Override
-    public int deleteProprietorCarByCarId(Long carId)
-    {
+    public int deleteProprietorCarByCarId(Long carId) {
         return proprietorCarMapper.deleteProprietorCarByCarId(carId);
     }
 }

+ 9 - 2
ruoyi-system/src/main/resources/mapper/system/CommentContentMapper.xml

@@ -41,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where content_id = #{contentId}
     </select>
 
-    <insert id="insertCommentContent" parameterType="CommentContent">
+    <insert id="insertCommentContent" parameterType="CommentContent" useGeneratedKeys="true" keyProperty="contentId">
         insert into comment_content
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="contentId != null">content_id,</if>
@@ -96,8 +96,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updateCommentContentByContentId" parameterType="CommentContent">
         update comment_content set del_flag = 'Y' where content_id = #{contentId}
     </update>
+    <update id="deleteCommentContentByCommentId" parameterType="CommentContent">
+        update comment_content set del_flag = 'Y' where comment_id in(select comment_id from comment_index where parent_id = #{commentId})
+    </update>
     <update id="updateCommentContentByCommentId" parameterType="CommentContent">
-        update comment_content set del_flag = 'Y' where comment_id = #{commentId}
+        update comment_content
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="likeCount != null">like_count = #{likeCount},</if>
+        </trim>
+        where comment_id = #{commentId}
     </update>
 
     <delete id="deleteCommentContentByContentId" parameterType="Long">

+ 132 - 40
ruoyi-system/src/main/resources/mapper/system/CommentIndexMapper.xml

@@ -8,6 +8,7 @@
         <result property="commentId" column="comment_id"/>
         <result property="communityId" column="community_id"/>
         <result property="communityType" column="community_type"/>
+        <result property="communityTitle"    column="community_title"    />
         <result property="isRoot" column="is_root"/>
         <result property="parentId" column="parent_id"/>
         <result property="userId" column="user_id"/>
@@ -25,38 +26,64 @@
         <result property="updateTime" column="update_time"/>
         <result property="remark" column="remark"/>
     </resultMap>
+
+    <resultMap type="com.ruoyi.system.domain.communityNews.vo.CommentIndexShVo" id="CommentIndexShVoResult">
+        <result property="commentId" column="comment_id"/>
+        <result property="communityId" column="community_id"/>
+        <result property="communityType" column="community_type"/>
+        <result property="communityTitle"    column="community_title"    />
+        <result property="isRoot" column="is_root"/>
+        <result property="parentId" column="parent_id"/>
+        <result property="userId" column="user_id"/>
+        <result property="nickName" column="nick_name"/>
+        <result property="avatar" column="avatar"/>
+        <result property="toUserId" column="to_user_id"/>
+        <result property="toNickName" column="to_nick_name"/>
+        <result property="toAvatar" column="to_avatar"/>
+        <result property="contentId" column="content_id"/>
+        <result property="commentContent" column="comment_content"/>
+        <result property="status"    column="status"    />
+        <result property="type"    column="type"    />
+    </resultMap>
     <!--回复列表返回给前端的格式-->
     <resultMap type="com.ruoyi.system.domain.communityNews.vo.CommentIndexVo" id="CommentIndexVoResult">
         <id property="id" column="ci_id"/>
         <result property="content" column="ci_content"/>
-        <result property="likeCount" column="ci_likeCount"/>
-        <result property="isLike" column="ci_isLike"/>
+        <result property="likeCount" column="ci_like_count"/>
+        <result property="isLike" column="ci_is_like"/>
         <result property="createTime" column="ci_create_time"/>
-        <association property="commentUserVo" javaType="com.ruoyi.system.domain.communityNews.vo.CommentUserVo"
-                     resultMap="CommentUserVoResult"/>
+        <result property="childrenListCount" column="ci_children_list_count"/>
+        <association property="commentUser" javaType="com.ruoyi.system.domain.communityNews.vo.CommentUser"
+                     resultMap="CommentUserOneResult"/>
         <collection property="childrenList" javaType="java.util.List" resultMap="ChildrenListResult"/>
     </resultMap>
     <resultMap id="ChildrenListResult" type="com.ruoyi.system.domain.communityNews.vo.CommentChildrenVo">
+        <result property="id" column="cl_id"/>
         <result property="content" column="cl_content"/>
-        <result property="likeCount" column="cl_likeCount"/>
-        <result property="isLike" column="cl_isLike"/>
+        <result property="likeCount" column="cl_like_count"/>
+        <result property="isLike" column="cl_is_like"/>
         <result property="createTime" column="cl_create_time"/>
-        <association property="commentUserVo" javaType="com.ruoyi.system.domain.communityNews.vo.CommentUserVo"
-                     resultMap="CommentUserVoResult"/>
-        <association property="targetUserVo" javaType="com.ruoyi.system.domain.communityNews.vo.TargetUserVo"
+        <association property="commentUser" javaType="com.ruoyi.system.domain.communityNews.vo.CommentUser"
+                     resultMap="CommentUserTwoResult"/>
+        <association property="targetUser" javaType="com.ruoyi.system.domain.communityNews.vo.TargetUser"
                      resultMap="TargetUserVoResult"/>
     </resultMap>
-    <resultMap id="CommentUserVoResult" type="com.ruoyi.system.domain.communityNews.vo.CommentUserVo">
-        <id property="id" column="cu_id"/>
-        <result property="nickName" column="cu_nickName"/>
-        <result property="avatar" column="cu_avatar"/>
-        <result property="createTime" column="cl_create_time"/>
+    <!--一级评论对象评论人对象-->
+    <resultMap id="CommentUserOneResult" type="com.ruoyi.system.domain.communityNews.vo.CommentUser">
+        <id property="id" column="cu_one_id"/>
+        <result property="nickName" column="cu_one_nick_name"/>
+        <result property="avatar" column="cu_one_avatar"/>
+    </resultMap>
+    <!--子集评论评论人对象-->
+    <resultMap id="CommentUserTwoResult" type="com.ruoyi.system.domain.communityNews.vo.CommentUser">
+        <id property="id" column="cu_two_id"/>
+        <result property="nickName" column="cu_two_nick_name"/>
+        <result property="avatar" column="cu_two_avatar"/>
     </resultMap>
-    <resultMap id="TargetUserVoResult" type="com.ruoyi.system.domain.communityNews.vo.TargetUserVo">
+    <resultMap id="TargetUserVoResult" type="com.ruoyi.system.domain.communityNews.vo.TargetUser">
         <id property="id" column="tu_id"/>
-        <result property="nickName" column="tu_nickName"/>
+        <result property="nickName" column="tu_nick_name"/>
         <result property="avatar" column="tu_avatar"/>
-        <result property="createTime" column="tu_create_time"/>
     </resultMap>
 
 
@@ -64,6 +91,7 @@
         select comment_id,
                community_id,
                community_type,
+               community_title,
                is_root,
                parent_id,
                user_id,
@@ -107,57 +135,119 @@
         where comment_id = #{commentId}
     </select>
 
-    <select id="getAllComment" parameterType="CommentIndex" resultMap="CommentIndexVoResult">
+
+    <select id="getRootComment" parameterType="CommentIndex" resultMap="CommentIndexVoResult">
         SELECT
             i.comment_id AS ci_id,
             i.create_time AS ci_create_time,
             c.comment_content AS ci_content,
-            children.cu_id AS cu_id,
-            children.cu_nick_name AS cu_nickName,
-            children.cu_avatar AS cu_avatar,
-            children.cl_create_time AS cl_create_time,
-            children.ta_id AS tu_id,
-            children.ta_nick_name AS tu_nickName,
-            children.ta_avatar AS tu_avatar,
-            children.tu_create_time AS tu_create_time,
-            children.c_content AS cl_content
+            i.user_id AS cu_one_id,
+            i.nick_name AS cu_one_nick_name,
+            i.avatar AS cu_one_avatar,
+            c.like_count AS ci_like_count,
+            ifnull(children.ci_children_list_count,0) AS ci_children_list_count
         FROM
             comment_index i
                 LEFT JOIN comment_content c ON i.content_id = c.content_id
                 LEFT JOIN (
                 SELECT
-                    i.community_id AS ci_id,
-                    i.parent_id AS ci_parent_id,
-                    i.user_id AS cu_id,
-                    i.nick_name AS cu_nick_name,
-                    i.avatar AS cu_avatar,
-                    i.to_user_id AS ta_id,
-                    i.to_nick_name AS ta_nick_name,
-                    i.to_avatar AS ta_avatar,
-                    i.create_time AS cl_create_time,
-                    i.create_time AS tu_create_time,
-                    c.comment_content AS c_content
+                    count( 1 ) AS ci_children_list_count,
+                    i.parent_id AS ci_parent_id
                 FROM
                     comment_index i
                         LEFT JOIN comment_content c ON i.content_id = c.content_id
-                WHERE
+        <where>
                     c.STATUS = '2'
                   AND i.is_root = 2
                   AND c.del_flag = 'N'
                   AND i.del_flag = 'N'
+            <if test="communityId != null ">and i.community_id = #{communityId}</if>
+        </where>
+                 GROUP BY i.parent_id
             ) AS children ON children.ci_parent_id = i.comment_id
-        WHERE
+        <where>
             c.STATUS = '2'
           AND i.is_root = 1
           AND c.del_flag = 'N'
           AND i.del_flag = 'N'
+        <if test="communityId != null ">and i.community_id = #{communityId}</if>
+        </where>
+        ORDER BY
+            ci_create_time,
+            ci_like_count DESC
+    </select>
+    <select id="getParentComment" parameterType="CommentIndex" resultMap="ChildrenListResult">
+        SELECT
+        i.comment_id AS cl_id,
+        i.user_id AS cu_two_id,
+        i.nick_name AS cu_two_nick_name,
+        i.avatar AS cu_two_avatar,
+        i.to_user_id AS tu_id,
+        i.to_nick_name AS tu_nick_name,
+        i.to_avatar AS tu_avatar,
+        i.create_time AS cl_create_time,
+        c.comment_content AS cl_content,
+        c.like_count AS cl_like_count
+        FROM
+        comment_index i
+        LEFT JOIN comment_content c ON i.content_id = c.content_id
+        <where>
+            c.STATUS = '2'
+            AND i.is_root = 2
+            AND c.del_flag = 'N'
+            AND i.del_flag = 'N'
+            <if test="parentId != null ">and i.parent_id = #{parentId}</if>
+        </where>
+        order by cl_create_time ,cl_like_count DESC
     </select>
+    <select id="commentSh" parameterType="com.ruoyi.system.domain.communityNews.vo.CommentIndexShVo" resultMap="CommentIndexShVoResult">
+        SELECT
+            i.comment_id,
+            i.community_id,
+            i.community_type,
+            i.community_title,
+            i.is_root,
+            i.parent_id,
+            i.user_id,
+            i.nick_name,
+            i.avatar,
+            i.to_user_id,
+            i.to_nick_name,
+            i.to_avatar,
+            i.content_id,
+            i.comment_content,
+            c.status,
+            c.type
+        FROM
+            comment_index i
+                LEFT JOIN comment_content c ON i.content_id = c.content_id
+        <where>
+            <if test="communityId != null ">and i.community_id = #{communityId}</if>
+            <if test="communityType != null  and communityType != ''">and i.community_type = #{communityType}</if>
+            <if test="isRoot != null ">and i.is_root = #{isRoot}</if>
+            <if test="parentId != null ">and i.parent_id = #{parentId}</if>
+            <if test="userId != null ">and i.user_id = #{userId}</if>
+            <if test="nickName != null  and nickName != ''">and i.nick_name like concat('%', #{nickName}, '%')</if>
+            <if test="avatar != null  and avatar != ''">and i.avatar = #{avatar}</if>
+            <if test="toUserId != null ">and i.to_user_id = #{toUserId}</if>
+            <if test="toNickName != null  and toNickName != ''">and i.to_nick_name like concat('%', #{toNickName}, '%')
+            </if>
+            <if test="toAvatar != null  and toAvatar != ''">and i.to_avatar = #{toAvatar}</if>
+            <if test="status != null and status != ''"> and c.status = #{status}</if>
+            <if test="type != null "> and c.type = #{type}</if>
+        </where>
+    </select>
+    <select id="selectCommentIdListByCommentId" resultType="java.lang.Long">
+        select comment_id from comment_index where parent_id = #{commentId}
+    </select>
+
 
     <insert id="insertCommentIndex" parameterType="CommentIndex" useGeneratedKeys="true" keyProperty="commentId">
         insert into comment_index
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="communityId != null">community_id,</if>
             <if test="communityType != null and communityType != ''">community_type,</if>
+            <if test="communityTitle != null and communityTitle != ''">community_title,</if>
             <if test="isRoot != null">is_root,</if>
             <if test="parentId != null">parent_id,</if>
             <if test="userId != null">user_id,</if>
@@ -178,6 +268,7 @@
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="communityId != null">#{communityId},</if>
             <if test="communityType != null and communityType != ''">#{communityType},</if>
+            <if test="communityTitle != null and communityTitle != ''">#{communityTitle},</if>
             <if test="isRoot != null">#{isRoot},</if>
             <if test="parentId != null">#{parentId},</if>
             <if test="userId != null">#{userId},</if>
@@ -202,6 +293,7 @@
         <trim prefix="SET" suffixOverrides=",">
             <if test="communityId != null">community_id = #{communityId},</if>
             <if test="communityType != null and communityType != ''">community_type = #{communityType},</if>
+            <if test="communityTitle != null and communityTitle != ''">community_title = #{communityTitle},</if>
             <if test="isRoot != null">is_root = #{isRoot},</if>
             <if test="parentId != null">parent_id = #{parentId},</if>
             <if test="userId != null">user_id = #{userId},</if>

+ 15 - 2
ruoyi-system/src/main/resources/mapper/system/CommentLikesMapper.xml

@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="likesId"    column="likes_id"    />
         <result property="targetId"    column="target_id"    />
         <result property="targetType"    column="target_type"    />
+        <result property="targetTitle"    column="target_title"    />
         <result property="userId"    column="user_id"    />
         <result property="nickName"    column="nick_name"    />
         <result property="avatar"    column="avatar"    />
@@ -20,12 +21,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectCommentLikesVo">
-        select likes_id, target_id, target_type, user_id, nick_name, avatar, del_flag, create_by, create_time, update_by, update_time, remark from comment_likes
+        select likes_id, target_id, target_type,target_title, user_id, nick_name, avatar, del_flag, create_by, create_time, update_by, update_time, remark from comment_likes
     </sql>
 
     <select id="selectCommentLikesList" parameterType="CommentLikes" resultMap="CommentLikesResult">
         <include refid="selectCommentLikesVo"/>
-        <where>  
+        <where>
+            del_flag = 'Y'
             <if test="targetId != null "> and target_id = #{targetId}</if>
             <if test="targetType != null  and targetType != ''"> and target_type = #{targetType}</if>
             <if test="userId != null "> and user_id = #{userId}</if>
@@ -38,12 +40,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectCommentLikesVo"/>
         where likes_id = #{likesId}
     </select>
+    <select id="selectCommentLikes" parameterType="CommentLikes" resultMap="CommentLikesResult">
+        <include refid="selectCommentLikesVo"/>
+        <where>
+        <if test="targetId != null "> and target_id = #{targetId}</if>
+        <if test="targetType != null  and targetType != ''"> and target_type = #{targetType}</if>
+        <if test="userId != null "> and user_id = #{userId}</if>
+        </where> limit 1
+    </select>
 
     <insert id="insertCommentLikes" parameterType="CommentLikes" useGeneratedKeys="true" keyProperty="likesId">
         insert into comment_likes
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="targetId != null">target_id,</if>
             <if test="targetType != null">target_type,</if>
+            <if test="targetTitle != null">target_title,</if>
             <if test="userId != null">user_id,</if>
             <if test="nickName != null">nick_name,</if>
             <if test="avatar != null">avatar,</if>
@@ -57,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="targetId != null">#{targetId},</if>
             <if test="targetType != null">#{targetType},</if>
+            <if test="targetTitle != null">#{targetTitle},</if>
             <if test="userId != null">#{userId},</if>
             <if test="nickName != null">#{nickName},</if>
             <if test="avatar != null">#{avatar},</if>
@@ -74,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="SET" suffixOverrides=",">
             <if test="targetId != null">target_id = #{targetId},</if>
             <if test="targetType != null">target_type = #{targetType},</if>
+            <if test="targetTitle != null">target_title = #{targetTitle},</if>
             <if test="userId != null">user_id = #{userId},</if>
             <if test="nickName != null">nick_name = #{nickName},</if>
             <if test="avatar != null">avatar = #{avatar},</if>

+ 26 - 17
ruoyi-system/src/main/resources/mapper/system/CommentStarsMapper.xml

@@ -3,11 +3,12 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.system.mapper.CommentStarsMapper">
-    
+
     <resultMap type="CommentStars" id="CommentStarsResult">
         <result property="starsId"    column="stars_id"    />
-        <result property="communityId"    column="community_id"    />
-        <result property="communityType"    column="community_type"    />
+        <result property="targetId"    column="target_id"    />
+        <result property="targetType"    column="target_type"    />
+        <result property="targetTitle"    column="target_title"    />
         <result property="userId"    column="user_id"    />
         <result property="nickName"    column="nick_name"    />
         <result property="avatar"    column="avatar"    />
@@ -20,14 +21,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectCommentStarsVo">
-        select stars_id, community_id, community_type, user_id, nick_name, avatar, del_flag, create_by, create_time, update_by, update_time, remark from comment_stars
+        select stars_id, target_id, target_type, target_title, user_id, nick_name, avatar, del_flag, create_by, create_time, update_by, update_time, remark from comment_stars
     </sql>
 
     <select id="selectCommentStarsList" parameterType="CommentStars" resultMap="CommentStarsResult">
         <include refid="selectCommentStarsVo"/>
-        <where>  
-            <if test="communityId != null "> and community_id = #{communityId}</if>
-            <if test="communityType != null  and communityType != ''"> and community_type = #{communityType}</if>
+        <where>
+            <if test="targetId != null "> and target_id = #{targetId}</if>
+            <if test="targetType != null  and targetType != ''"> and target_type = #{targetType}</if>
+            <if test="targetTitle != null  and targetTitle != ''"> and target_title = #{targetTitle}</if>
             <if test="userId != null "> and user_id = #{userId}</if>
             <if test="nickName != null  and nickName != ''"> and nick_name like concat('%', #{nickName}, '%')</if>
             <if test="avatar != null  and avatar != ''"> and avatar = #{avatar}</if>
@@ -42,38 +44,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <insert id="insertCommentStars" parameterType="CommentStars" useGeneratedKeys="true" keyProperty="starsId">
         insert into comment_stars
         <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="communityId != null">community_id,</if>
-            <if test="communityType != null and communityType != ''">community_type,</if>
+            <if test="targetId != null">target_id,</if>
+            <if test="targetType != null and targetType != ''">target_type,</if>
+            <if test="targetTitle != null">target_title,</if>
             <if test="userId != null">user_id,</if>
             <if test="nickName != null">nick_name,</if>
             <if test="avatar != null">avatar,</if>
             <if test="delFlag != null">del_flag,</if>
             <if test="createBy != null">create_by,</if>
-            <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
             <if test="remark != null">remark,</if>
-         </trim>
+            create_time
+        </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="communityId != null">#{communityId},</if>
-            <if test="communityType != null and communityType != ''">#{communityType},</if>
+            <if test="targetId != null">#{targetId},</if>
+            <if test="targetType != null and targetType != ''">#{targetType},</if>
+            <if test="targetTitle != null">#{targetTitle},</if>
             <if test="userId != null">#{userId},</if>
             <if test="nickName != null">#{nickName},</if>
             <if test="avatar != null">#{avatar},</if>
             <if test="delFlag != null">#{delFlag},</if>
             <if test="createBy != null">#{createBy},</if>
-            <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
-         </trim>
+            sysdate()
+        </trim>
     </insert>
 
     <update id="updateCommentStars" parameterType="CommentStars">
         update comment_stars
         <trim prefix="SET" suffixOverrides=",">
-            <if test="communityId != null">community_id = #{communityId},</if>
-            <if test="communityType != null and communityType != ''">community_type = #{communityType},</if>
+            <if test="targetId != null">target_id = #{targetId},</if>
+            <if test="targetType != null and targetType != ''">target_type = #{targetType},</if>
+            <if test="targetTitle != null">target_title = #{targetTitle},</if>
             <if test="userId != null">user_id = #{userId},</if>
             <if test="nickName != null">nick_name = #{nickName},</if>
             <if test="avatar != null">avatar = #{avatar},</if>
@@ -86,6 +91,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </trim>
         where stars_id = #{starsId}
     </update>
+    <update id="updateCommentStarsByUserIdAndCommunityId" parameterType="CommentStars">
+        update comment_stars set del_flag = 'Y'
+        where user_id = #{userId} and target_id = #{targetId} and target_type = #{targetType}
+    </update>
 
     <delete id="deleteCommentStarsByStarsId" parameterType="Long">
         delete from comment_stars where stars_id = #{starsId}

+ 3 - 0
ruoyi-system/src/main/resources/mapper/system/CommunityNewsMapper.xml

@@ -137,6 +137,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </trim>
         where community_id = #{communityId}
     </update>
+    <update id="updateCommunityNewsStars" parameterType="CommunityNews">
+        update community_news set user_stars = #{userStars} where community_id = #{communityId}
+    </update>
 
     <delete id="deleteCommunityNewsByCommunityId" parameterType="Long">
         delete from community_news where community_id = #{communityId}

+ 56 - 1
ruoyi-system/src/main/resources/mapper/system/HouseInfoMapper.xml

@@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="coOwner"    column="co_owner"    />
         <result property="detailedAddress"    column="detailed_address"    />
         <result property="hasParkingSpace"    column="has_parking_space"    />
+        <result property="parkingNumber"    column="parking_number"    />
         <result property="communityName"    column="community_name"    />
         <result property="houseStatus"    column="house_status"    />
         <result property="createBy"    column="create_by"    />
@@ -26,10 +27,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
         <result property="remark"    column="remark"    />
+        <collection property="residentInfoList" javaType="java.util.List" resultMap="ResidentInfoResult"  />
     </resultMap>
 
+    <resultMap type="ResidentInfo" id="ResidentInfoResult">
+        <result property="residentId"    column="resident_id"    />
+        <result property="houseId"    column="house_id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="detailedAddress"    column="detailed_address"    />
+        <result property="residentName"    column="resident_name"    />
+        <result property="residentIdCard"    column="resident_id_card"    />
+        <result property="residentBirthday"    column="resident_birthday"    />
+        <result property="residentPhone"    column="resident_phone"    />
+        <result property="residentGender"    column="resident_gender"    />
+        <result property="residentRelationship"    column="resident_relationship"    />
+        <result property="isHouseholder"    column="is_householder"    />
+        <result property="isTenant"    column="is_tenant"    />
+        <result property="residentEmployer"    column="resident_employer"    />
+        <result property="specialType"    column="special_type"    />
+        <result property="residentHobby"    column="resident_hobby"    />
+        <result property="residentAppearance"    column="resident_appearance"    />
+        <result property="idCardFront"    column="id_card_front"    />
+        <result property="idCardBack"    column="id_card_back"    />
+        <result property="idCardAddress"    column="id_card_address"    />
+        <result property="facePhoto"    column="face_photo"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
     <sql id="selectHouseInfoVo">
-        select house_id, owner_name, location, right_type, area, document_number, property_unit_number, co_ownership, usage_type, usage_period, registration_date, co_owner, detailed_address, has_parking_space, community_name, house_status, create_by, create_time, update_by, update_time, remark from house_info
+        select house_id, owner_name, location, right_type, area, parking_number,document_number, property_unit_number, co_ownership, usage_type, usage_period, registration_date, co_owner, detailed_address, has_parking_space, community_name, house_status, create_by, create_time, update_by, update_time, remark from house_info
     </sql>
 
     <select id="selectHouseInfoList" parameterType="HouseInfo" resultMap="HouseInfoResult">
@@ -48,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="coOwner != null  and coOwner != ''"> and co_owner = #{coOwner}</if>
             <if test="detailedAddress != null  and detailedAddress != ''"> and detailed_address = #{detailedAddress}</if>
             <if test="hasParkingSpace != null  and hasParkingSpace != ''"> and has_parking_space = #{hasParkingSpace}</if>
+            <if test="parkingNumber != null  and parkingNumber != ''"> and parking_number = #{parkingNumber}</if>
             <if test="communityName != null  and communityName != ''"> and community_name like concat('%', #{communityName}, '%')</if>
             <if test="houseStatus != null "> and house_status = #{houseStatus}</if>
         </where>
@@ -57,6 +87,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectHouseInfoVo"/>
         where house_id = #{houseId}
     </select>
+    <select id="selectHouseInfoListAndResidentInfo" parameterType="ResidentInfo" resultMap="HouseInfoResult">
+        SELECT
+            h.house_id,
+            h.detailed_address,
+            h.house_status,
+            r.resident_id,
+            r.resident_name,
+            r.resident_id_card,
+            r.resident_gender,
+            r.resident_relationship,
+            r.is_householder,
+            r.is_tenant,
+            r.resident_appearance
+        FROM
+            house_info h
+                left JOIN
+            resident_info r on h.house_id = r.house_id
+        <where>
+            <if test="residentName != null  and residentName != ''"> and r.resident_name like concat('%', #{residentName}, '%')</if>
+            <if test="residentAppearance != null  and residentAppearance != ''"> and r.resident_appearance = #{residentAppearance}</if>
+        </where>
+    </select>
 
     <insert id="insertHouseInfo" parameterType="HouseInfo" useGeneratedKeys="true" keyProperty="houseId">
         insert into house_info
@@ -74,6 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="coOwner != null">co_owner,</if>
             <if test="detailedAddress != null">detailed_address,</if>
             <if test="hasParkingSpace != null">has_parking_space,</if>
+            <if test="parkingNumber != null">parking_number,</if>
             <if test="communityName != null">community_name,</if>
             <if test="houseStatus != null">house_status,</if>
             <if test="createBy != null">create_by,</if>
@@ -96,6 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="coOwner != null">#{coOwner},</if>
             <if test="detailedAddress != null">#{detailedAddress},</if>
             <if test="hasParkingSpace != null">#{hasParkingSpace},</if>
+            <if test="parkingNumber != null">#{parkingNumber},</if>
             <if test="communityName != null">#{communityName},</if>
             <if test="houseStatus != null">#{houseStatus},</if>
             <if test="createBy != null">#{createBy},</if>
@@ -122,6 +176,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="coOwner != null">co_owner = #{coOwner},</if>
             <if test="detailedAddress != null">detailed_address = #{detailedAddress},</if>
             <if test="hasParkingSpace != null">has_parking_space = #{hasParkingSpace},</if>
+            <if test="parkingNumber != null">parking_number = #{parkingNumber},</if>
             <if test="communityName != null">community_name = #{communityName},</if>
             <if test="houseStatus != null">house_status = #{houseStatus},</if>
             <if test="createBy != null">create_by = #{createBy},</if>

+ 78 - 46
ruoyi-system/src/main/resources/mapper/system/ResidentInfoMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruoyi.system.mapper.ResidentInfoMapper">
-    
+
     <resultMap type="ResidentInfo" id="ResidentInfoResult">
         <result property="residentId"    column="resident_id"    />
         <result property="houseId"    column="house_id"    />
@@ -18,7 +18,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="isHouseholder"    column="is_householder"    />
         <result property="isTenant"    column="is_tenant"    />
         <result property="residentEmployer"    column="resident_employer"    />
+        <result property="specialType"    column="special_type"    />
+        <result property="residentHobby"    column="resident_hobby"    />
         <result property="residentAppearance"    column="resident_appearance"    />
+        <result property="idCardFront"    column="id_card_front"    />
+        <result property="idCardBack"    column="id_card_back"    />
+        <result property="idCardAddress"    column="id_card_address"    />
+        <result property="facePhoto"    column="face_photo"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
@@ -27,12 +33,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectResidentInfoVo">
-        select resident_id, house_id, user_id, detailed_address, resident_name, resident_id_card, resident_birthday, resident_phone, resident_gender, resident_relationship, is_householder, is_tenant, resident_employer, resident_appearance, create_by, create_time, update_by, update_time, remark from resident_info
+        select resident_id, house_id, user_id, detailed_address, resident_name, resident_id_card, resident_birthday, resident_phone, resident_gender, resident_relationship, is_householder, is_tenant, resident_employer, special_type, resident_hobby, resident_appearance, id_card_front, id_card_back, id_card_address, face_photo, create_by, create_time, update_by, update_time, remark from resident_info
     </sql>
 
     <select id="selectResidentInfoList" parameterType="ResidentInfo" resultMap="ResidentInfoResult">
         <include refid="selectResidentInfoVo"/>
-        <where>  
+        <where>
             <if test="houseId != null "> and house_id = #{houseId}</if>
             <if test="userId != null "> and user_id = #{userId}</if>
             <if test="detailedAddress != null  and detailedAddress != ''"> and detailed_address = #{detailedAddress}</if>
@@ -45,7 +51,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isHouseholder != null  and isHouseholder != ''"> and is_householder = #{isHouseholder}</if>
             <if test="isTenant != null  and isTenant != ''"> and is_tenant = #{isTenant}</if>
             <if test="residentEmployer != null  and residentEmployer != ''"> and resident_employer = #{residentEmployer}</if>
+            <if test="specialType != null  and specialType != ''"> and special_type = #{specialType}</if>
+            <if test="residentHobby != null  and residentHobby != ''"> and resident_hobby = #{residentHobby}</if>
             <if test="residentAppearance != null  and residentAppearance != ''"> and resident_appearance = #{residentAppearance}</if>
+            <if test="idCardFront != null  and idCardFront != ''"> and id_card_front = #{idCardFront}</if>
+            <if test="idCardBack != null  and idCardBack != ''"> and id_card_back = #{idCardBack}</if>
+            <if test="idCardAddress != null  and idCardAddress != ''"> and id_card_address = #{idCardAddress}</if>
+            <if test="facePhoto != null  and facePhoto != ''"> and face_photo = #{facePhoto}</if>
         </where>
     </select>
     
@@ -58,49 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where user_id = #{userId}
     </select>
 
-    <insert id="insertResidentInfo" parameterType="ResidentInfo" useGeneratedKeys="true" keyProperty="residentId">
-        insert into resident_info
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="houseId != null">house_id,</if>
-            <if test="userId != null">user_id,</if>
-            <if test="detailedAddress != null">detailed_address,</if>
-            <if test="residentName != null">resident_name,</if>
-            <if test="residentIdCard != null">resident_id_card,</if>
-            <if test="residentBirthday != null">resident_birthday,</if>
-            <if test="residentPhone != null">resident_phone,</if>
-            <if test="residentGender != null">resident_gender,</if>
-            <if test="residentRelationship != null">resident_relationship,</if>
-            <if test="isHouseholder != null">is_householder,</if>
-            <if test="isTenant != null">is_tenant,</if>
-            <if test="residentEmployer != null">resident_employer,</if>
-            <if test="residentAppearance != null">resident_appearance,</if>
-            <if test="createBy != null">create_by,</if>
-            <if test="createTime != null">create_time,</if>
-            <if test="updateBy != null">update_by,</if>
-            <if test="updateTime != null">update_time,</if>
-            <if test="remark != null">remark,</if>
-         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="houseId != null">#{houseId},</if>
-            <if test="userId != null">#{userId},</if>
-            <if test="detailedAddress != null">#{detailedAddress},</if>
-            <if test="residentName != null">#{residentName},</if>
-            <if test="residentIdCard != null">#{residentIdCard},</if>
-            <if test="residentBirthday != null">#{residentBirthday},</if>
-            <if test="residentPhone != null">#{residentPhone},</if>
-            <if test="residentGender != null">#{residentGender},</if>
-            <if test="residentRelationship != null">#{residentRelationship},</if>
-            <if test="isHouseholder != null">#{isHouseholder},</if>
-            <if test="isTenant != null">#{isTenant},</if>
-            <if test="residentEmployer != null">#{residentEmployer},</if>
-            <if test="residentAppearance != null">#{residentAppearance},</if>
-            <if test="createBy != null">#{createBy},</if>
-            <if test="createTime != null">#{createTime},</if>
-            <if test="updateBy != null">#{updateBy},</if>
-            <if test="updateTime != null">#{updateTime},</if>
-            <if test="remark != null">#{remark},</if>
-         </trim>
-    </insert>
+
     <insert id="insertResidentInfoList">
         insert into resident_info(house_id,
            user_id,
@@ -143,6 +113,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </insert>
 
+    <insert id="insertResidentInfo" parameterType="ResidentInfo" useGeneratedKeys="true" keyProperty="residentId">
+        insert into resident_info
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="houseId != null">house_id,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="detailedAddress != null">detailed_address,</if>
+            <if test="residentName != null">resident_name,</if>
+            <if test="residentIdCard != null">resident_id_card,</if>
+            <if test="residentBirthday != null">resident_birthday,</if>
+            <if test="residentPhone != null">resident_phone,</if>
+            <if test="residentGender != null">resident_gender,</if>
+            <if test="residentRelationship != null">resident_relationship,</if>
+            <if test="isHouseholder != null">is_householder,</if>
+            <if test="isTenant != null">is_tenant,</if>
+            <if test="residentEmployer != null">resident_employer,</if>
+            <if test="specialType != null">special_type,</if>
+            <if test="residentHobby != null">resident_hobby,</if>
+            <if test="residentAppearance != null">resident_appearance,</if>
+            <if test="idCardFront != null">id_card_front,</if>
+            <if test="idCardBack != null">id_card_back,</if>
+            <if test="idCardAddress != null">id_card_address,</if>
+            <if test="facePhoto != null">face_photo,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="houseId != null">#{houseId},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="detailedAddress != null">#{detailedAddress},</if>
+            <if test="residentName != null">#{residentName},</if>
+            <if test="residentIdCard != null">#{residentIdCard},</if>
+            <if test="residentBirthday != null">#{residentBirthday},</if>
+            <if test="residentPhone != null">#{residentPhone},</if>
+            <if test="residentGender != null">#{residentGender},</if>
+            <if test="residentRelationship != null">#{residentRelationship},</if>
+            <if test="isHouseholder != null">#{isHouseholder},</if>
+            <if test="isTenant != null">#{isTenant},</if>
+            <if test="residentEmployer != null">#{residentEmployer},</if>
+            <if test="specialType != null">#{specialType},</if>
+            <if test="residentHobby != null">#{residentHobby},</if>
+            <if test="residentAppearance != null">#{residentAppearance},</if>
+            <if test="idCardFront != null">#{idCardFront},</if>
+            <if test="idCardBack != null">#{idCardBack},</if>
+            <if test="idCardAddress != null">#{idCardAddress},</if>
+            <if test="facePhoto != null">#{facePhoto},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+        </trim>
+    </insert>
+
     <update id="updateResidentInfo" parameterType="ResidentInfo">
         update resident_info
         <trim prefix="SET" suffixOverrides=",">
@@ -158,7 +184,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="isHouseholder != null">is_householder = #{isHouseholder},</if>
             <if test="isTenant != null">is_tenant = #{isTenant},</if>
             <if test="residentEmployer != null">resident_employer = #{residentEmployer},</if>
+            <if test="specialType != null">special_type = #{specialType},</if>
+            <if test="residentHobby != null">resident_hobby = #{residentHobby},</if>
             <if test="residentAppearance != null">resident_appearance = #{residentAppearance},</if>
+            <if test="idCardFront != null">id_card_front = #{idCardFront},</if>
+            <if test="idCardBack != null">id_card_back = #{idCardBack},</if>
+            <if test="idCardAddress != null">id_card_address = #{idCardAddress},</if>
+            <if test="facePhoto != null">face_photo = #{facePhoto},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>