瀏覽代碼

物业管理端评论

tjf 4 月之前
父節點
當前提交
9a8289dd19

+ 11 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/communityNews/CommunityNewsController.java

@@ -7,6 +7,7 @@ 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.CommunityNews;
+import com.ruoyi.system.domain.communityNews.vo.CommentInteractionVo;
 import com.ruoyi.system.service.ICommunityNewsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -88,4 +89,14 @@ public class CommunityNewsController extends BaseController {
     public AjaxResult remove(@PathVariable Long[] communityIds) {
         return toAjax(communityNewsService.deleteCommunityNewsByCommunityIds(communityIds));
     }
+
+
+    /**
+     * 获取未读互动列表
+     */
+    @PreAuthorize("@ss.hasPermi('wuYe:news:getCommentInteraction')")
+    @PostMapping("/getCommentInteraction")
+    public AjaxResult getCommentInteraction(@RequestBody CommentInteractionVo commentInteractionVo) {
+        return communityNewsService.getCommentInteraction(commentInteractionVo);
+    }
 }

+ 8 - 3
ruoyi-common/src/main/java/com/ruoyi/common/constant/Constants.java

@@ -175,6 +175,7 @@ public class Constants
     public static final String TWO ="2";
     public static final String THR ="3";
     public static final String FOR ="4";
+    public static final String FIV ="5";
 
 
     //------------------文章的key----------------------------
@@ -213,7 +214,11 @@ public class Constants
     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>>
+    //记录社区资讯某个用户一共有多少个未读的互动(点赞,收藏,回复),记录成map形式{} key = comment_interaction_user:{userId} hkey = {targetType:targetId} value= CommentInteractionVo
+    public static final String COMMENT_INTERACTION_USER ="comment_interaction_user:";
+    //记录社区资讯某个用户一共有多少个未读的互动的数量key = comment_interaction_user_count:{userId} value = 未读的互动的数量
+    public static final String COMMENT_INTERACTION_USER_COUNT ="comment_interaction_user_count:";
+    //记录社区资讯某个用户对应资讯下有多少个未读的互动key=comment_interaction_community_user_count:{userId} hkey = {community_id} value = 资讯下有多少个未读的互动(点赞,收藏,回复)
+    public static final String COMMENT_INTERACTION_COMMUNITY_USER_COUNT ="comment_interaction_community_user_count:";
+
 }

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

@@ -32,7 +32,7 @@ public class CommentContent extends BaseEntity
 
     /** 状态:1:待审核 2:审核通过 3:审核不通过 4:审核通过后下架 */
     @Excel(name = "状态:1:待审核 2:审核通过 3:审核不通过 4:审核通过后下架")
-    private Integer status;
+    private String status;
 
     /** 类型:1:文字 2:图片 */
     @Excel(name = "类型:1:文字 2:图片")
@@ -81,16 +81,16 @@ public class CommentContent extends BaseEntity
     {
         return commentContent;
     }
-    public void setStatus(Integer status) 
-    {
-        this.status = status;
-    }
 
-    public Integer getStatus() 
-    {
+    public String getStatus() {
         return status;
     }
-    public void setType(Integer type) 
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public void setType(Integer type)
     {
         this.type = type;
     }

+ 22 - 16
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/CommentLikes.java

@@ -1,7 +1,5 @@
 package com.ruoyi.system.domain.communityNews;
 
-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;
 
@@ -17,6 +15,9 @@ public class CommentLikes extends BaseEntity
 
     /** 点赞ID */
     private Long likesId;
+    /** 社区资讯ID */
+    @Excel(name = "社区资讯ID")
+    private Long communityId;
 
     /** 点赞目标id */
     @Excel(name = "点赞目标id")
@@ -45,6 +46,14 @@ public class CommentLikes extends BaseEntity
     /** 逻辑删除(Y:已删除,N:未删除) */
     private String delFlag;
 
+    public Long getCommunityId() {
+        return communityId;
+    }
+
+    public void setCommunityId(Long communityId) {
+        this.communityId = communityId;
+    }
+
     public String getTargetTitle() {
         return targetTitle;
     }
@@ -119,19 +128,16 @@ public class CommentLikes extends BaseEntity
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("likesId", getLikesId())
-            .append("targetId", getTargetId())
-            .append("targetType", getTargetType())
-            .append("userId", getUserId())
-            .append("nickName", getNickName())
-            .append("avatar", getAvatar())
-            .append("delFlag", getDelFlag())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
+        return "CommentLikes{" +
+                "likesId=" + likesId +
+                ", communityId=" + communityId +
+                ", targetId=" + targetId +
+                ", targetType='" + targetType + '\'' +
+                ", targetTitle='" + targetTitle + '\'' +
+                ", userId=" + userId +
+                ", nickName='" + nickName + '\'' +
+                ", avatar='" + avatar + '\'' +
+                ", delFlag='" + delFlag + '\'' +
+                '}';
     }
 }

+ 14 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/CommunityNews.java

@@ -95,6 +95,18 @@ public class CommunityNews extends BaseEntity
      * 是否收藏 N:未收藏 Y:收藏
      */
     private String isStar;
+    /**
+     * 是否有未读互动 N:否 Y:是
+     */
+    private String isInteraction;
+
+    public String getIsInteraction() {
+        return isInteraction;
+    }
+
+    public void setIsInteraction(String isInteraction) {
+        this.isInteraction = isInteraction;
+    }
 
     public String getIsComment() {
         return isComment;
@@ -274,6 +286,7 @@ public class CommunityNews extends BaseEntity
         return userStars;
     }
 
+
     @Override
     public String toString() {
         return "CommunityNews{" +
@@ -297,6 +310,7 @@ public class CommunityNews extends BaseEntity
                 ", isLike='" + isLike + '\'' +
                 ", userStars='" + userStars + '\'' +
                 ", isStar='" + isStar + '\'' +
+                ", isInteraction='" + isInteraction + '\'' +
                 '}';
     }
 }

+ 151 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/communityNews/vo/CommentInteractionVo.java

@@ -0,0 +1,151 @@
+package com.ruoyi.system.domain.communityNews.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 未读互动接收对象
+ * @Author: tjf
+ * @Date: 2025/3/4 9:09
+ * @Describe:
+ */
+public class CommentInteractionVo implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 目标id */
+    private Long targetId;
+
+    /** 目标类型(1:资讯评论 2:资讯点赞 3:资讯收藏 4:评论回复 5:回复点赞) */
+    private String targetType;
+    /**
+     * 目标标题
+     */
+    private String targetTitle;
+
+    /** 目标用户id */
+
+    private Long targetUserId;
+    /**
+     * 操作人员id
+     */
+    private Long userId;
+
+    /** 用户昵称 */
+
+    private String nickName;
+
+    /** 头像地址 */
+
+    private String avatar;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+    /**
+     * 1:是新增 2:是删除
+     */
+    private String type;
+
+    /** 社区资讯ID 当是点赞回复的时候有值 */
+    private Long communityId;
+
+
+    public Long getCommunityId() {
+        return communityId;
+    }
+
+    public void setCommunityId(Long communityId) {
+        this.communityId = communityId;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public Long getTargetUserId() {
+        return targetUserId;
+    }
+
+    public void setTargetUserId(Long targetUserId) {
+        this.targetUserId = targetUserId;
+    }
+
+    public Long getTargetId() {
+        return targetId;
+    }
+
+    public void setTargetId(Long targetId) {
+        this.targetId = targetId;
+    }
+
+    public String getTargetType() {
+        return targetType;
+    }
+
+    public void setTargetType(String targetType) {
+        this.targetType = targetType;
+    }
+
+    public String getTargetTitle() {
+        return targetTitle;
+    }
+
+    public void setTargetTitle(String targetTitle) {
+        this.targetTitle = targetTitle;
+    }
+
+    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 Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    @Override
+    public String toString() {
+        return "CommentInteractionVo{" +
+                "targetId=" + targetId +
+                ", targetType='" + targetType + '\'' +
+                ", targetTitle='" + targetTitle + '\'' +
+                ", targetUserId=" + targetUserId +
+                ", userId=" + userId +
+                ", nickName='" + nickName + '\'' +
+                ", avatar='" + avatar + '\'' +
+                ", createTime=" + createTime +
+                ", type='" + type + '\'' +
+                ", communityId=" + communityId +
+                '}';
+    }
+}

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

@@ -1,6 +1,8 @@
 package com.ruoyi.system.service;
 
+import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.system.domain.communityNews.CommunityNews;
+import com.ruoyi.system.domain.communityNews.vo.CommentInteractionVo;
 
 import java.util.List;
 
@@ -60,4 +62,17 @@ public interface ICommunityNewsService
      * @return 结果
      */
     public int deleteCommunityNewsByCommunityId(Long communityId);
+
+    /**
+     * 设置未读互动
+     * @param commentInteractionVo 接收未读互动的参数
+     */
+    public void setCommentInteraction(CommentInteractionVo commentInteractionVo);
+
+    /**
+     * 获取未读互动列表
+     * @param commentInteractionVo
+     * @return
+     */
+    public AjaxResult getCommentInteraction(CommentInteractionVo commentInteractionVo);
 }

+ 62 - 22
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommentContentServiceImpl.java

@@ -2,96 +2,136 @@ package com.ruoyi.system.service.impl;
 
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.system.domain.communityNews.CommentContent;
+import com.ruoyi.system.domain.communityNews.CommentIndex;
+import com.ruoyi.system.domain.communityNews.CommunityNews;
+import com.ruoyi.system.domain.communityNews.vo.CommentInteractionVo;
 import com.ruoyi.system.mapper.CommentContentMapper;
+import com.ruoyi.system.mapper.CommentIndexMapper;
+import com.ruoyi.system.mapper.CommunityNewsMapper;
 import com.ruoyi.system.service.ICommentContentService;
+import com.ruoyi.system.service.ICommunityNewsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
 
+import static com.ruoyi.common.constant.Constants.*;
+
 /**
  * 社区资讯评论内容Service业务层处理
- * 
+ *
  * @author boman
  * @date 2025-02-25
  */
 @Service
-public class CommentContentServiceImpl implements ICommentContentService 
-{
+public class CommentContentServiceImpl implements ICommentContentService {
     @Autowired
     private CommentContentMapper commentContentMapper;
+    @Autowired
+    private CommentIndexMapper commentIndexMapper;
+    @Autowired
+    private CommunityNewsMapper communityNewsMapper;
+    @Autowired
+    private ICommunityNewsService communityNewsService;
 
     /**
      * 查询社区资讯评论内容
-     * 
+     *
      * @param contentId 社区资讯评论内容主键
      * @return 社区资讯评论内容
      */
     @Override
-    public CommentContent selectCommentContentByContentId(Long contentId)
-    {
+    public CommentContent selectCommentContentByContentId(Long contentId) {
         return commentContentMapper.selectCommentContentByContentId(contentId);
     }
 
     /**
      * 查询社区资讯评论内容列表
-     * 
+     *
      * @param commentContent 社区资讯评论内容
      * @return 社区资讯评论内容
      */
     @Override
-    public List<CommentContent> selectCommentContentList(CommentContent commentContent)
-    {
+    public List<CommentContent> selectCommentContentList(CommentContent commentContent) {
         return commentContentMapper.selectCommentContentList(commentContent);
     }
 
     /**
      * 新增社区资讯评论内容
-     * 
+     *
      * @param commentContent 社区资讯评论内容
      * @return 结果
      */
     @Override
-    public int insertCommentContent(CommentContent commentContent)
-    {
+    public int insertCommentContent(CommentContent commentContent) {
         commentContent.setCreateTime(DateUtils.getNowDate());
         return commentContentMapper.insertCommentContent(commentContent);
     }
 
     /**
      * 修改社区资讯评论内容
-     * 
+     *
      * @param commentContent 社区资讯评论内容
      * @return 结果
      */
     @Override
-    public int updateCommentContent(CommentContent commentContent)
-    {
+    public int updateCommentContent(CommentContent commentContent) {
         commentContent.setUpdateTime(DateUtils.getNowDate());
-        return commentContentMapper.updateCommentContent(commentContent);
+        int i = commentContentMapper.updateCommentContent(commentContent);
+        if (TWO.equals(commentContent.getStatus())) {
+            CommentIndex commentIndex = commentIndexMapper.selectCommentIndexByCommentId(commentContent.getCommentId());
+            Long communityId = commentIndex.getCommunityId();
+            Long userId = commentIndex.getUserId();
+            //评论审核通过
+            //------设置未读互动,评论的谁就给谁在redis中新增一条未读的互动--------
+            CommentInteractionVo commentInteractionVo = new CommentInteractionVo();
+            Integer isRoot = commentIndex.getIsRoot();
+            //默认是子评论
+            commentInteractionVo.setTargetType(FOR);
+            commentInteractionVo.setTargetUserId(commentIndex.getToUserId());
+            //默认标题是子评论的评论
+            commentInteractionVo.setTargetTitle(commentIndex.getCommentContent());
+            if (1 == isRoot) {
+                //说明是根评论
+                //查询该资讯是谁发的
+                CommunityNews communityNews = communityNewsMapper.selectCommunityNewsByCommunityId(communityId);
+                commentInteractionVo.setTargetUserId(communityNews.getUserId());
+                commentInteractionVo.setTargetType(ONE);
+                //社区资讯标题
+                commentInteractionVo.setTargetTitle(commentIndex.getCommunityTitle());
+            }
+            commentInteractionVo.setUserId(userId);
+            commentInteractionVo.setAvatar(commentIndex.getAvatar());
+            commentInteractionVo.setNickName(commentIndex.getNickName());
+            commentInteractionVo.setCreateTime(DateUtils.getNowDate());
+            commentInteractionVo.setTargetId(commentIndex.getCommentId());
+            //新增
+            commentInteractionVo.setType(ONE);
+            communityNewsService.setCommentInteraction(commentInteractionVo);
+            //----------------------设置未读互动完成--------
+        }
+        return i;
     }
 
     /**
      * 批量删除社区资讯评论内容
-     * 
+     *
      * @param contentIds 需要删除的社区资讯评论内容主键
      * @return 结果
      */
     @Override
-    public int deleteCommentContentByContentIds(Long[] contentIds)
-    {
+    public int deleteCommentContentByContentIds(Long[] contentIds) {
         return commentContentMapper.deleteCommentContentByContentIds(contentIds);
     }
 
     /**
      * 删除社区资讯评论内容信息
-     * 
+     *
      * @param contentId 社区资讯评论内容主键
      * @return 结果
      */
     @Override
-    public int deleteCommentContentByContentId(Long contentId)
-    {
+    public int deleteCommentContentByContentId(Long contentId) {
         return commentContentMapper.deleteCommentContentByContentId(contentId);
     }
 }

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

@@ -11,7 +11,9 @@ 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;
+import com.ruoyi.system.mapper.CommunityNewsMapper;
 import com.ruoyi.system.service.ICommentIndexService;
+import com.ruoyi.system.service.ICommunityNewsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -33,6 +35,10 @@ public class CommentIndexServiceImpl implements ICommentIndexService {
     private CommentIndexMapper commentIndexMapper;
     @Autowired
     private CommentContentMapper commentContentMapper;
+    @Resource
+    private ICommunityNewsService iCommunityNewsService;
+    @Resource
+    private CommunityNewsMapper communityNewsMapper;
 
     @Resource
     private RedisCache redisCache;
@@ -212,6 +218,7 @@ public class CommentIndexServiceImpl implements ICommentIndexService {
             }
             redisCache.setCacheObject(ONE_LIKE_COUNT + communityId, likeCount);*/
             //todo 删除后还需要减少未读互动的数据
+
         }
         return result;
     }

+ 98 - 16
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommentLikesServiceImpl.java

@@ -4,13 +4,20 @@ 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.CommentIndex;
 import com.ruoyi.system.domain.communityNews.CommentLikes;
+import com.ruoyi.system.domain.communityNews.CommunityNews;
+import com.ruoyi.system.domain.communityNews.vo.CommentInteractionVo;
+import com.ruoyi.system.mapper.CommentIndexMapper;
 import com.ruoyi.system.mapper.CommentLikesMapper;
+import com.ruoyi.system.mapper.CommunityNewsMapper;
 import com.ruoyi.system.service.ICommentLikesService;
+import com.ruoyi.system.service.ICommunityNewsService;
 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 java.util.concurrent.TimeUnit;
@@ -27,10 +34,17 @@ import static com.ruoyi.common.constant.Constants.*;
 public class CommentLikesServiceImpl implements ICommentLikesService {
     @Autowired
     private CommentLikesMapper commentLikesMapper;
+    @Autowired
+    private CommentIndexMapper commentIndexMapper;
 
     @Autowired
     private RedisCache redisCache;
 
+    @Resource
+    private ICommunityNewsService iCommunityNewsService;
+    @Resource
+    private CommunityNewsMapper communityNewsMapper;
+
     /**
      * 查询社区资讯点赞
      *
@@ -116,13 +130,15 @@ public class CommentLikesServiceImpl implements ICommentLikesService {
         //保存点赞信息
         //根据点赞目标id' 点赞目标类型(1:资讯 2:回复) 用户id查询是否已经点赞过
         CommentLikes commentLikesOld = commentLikesMapper.selectCommentLikes(commentLikes);
-        if (commentLikesOld != null){
+        if (commentLikesOld != null) {
             commentLikesOld.setDelFlag("Y");
             commentLikesMapper.updateCommentLikes(commentLikesOld);
-        }else {
+        } else {
             commentLikesMapper.insertCommentLikes(commentLikes);
         }
         if (StringUtils.isNotBlank(targetType)) {
+            //设置未读点赞互动的方法
+            setCommentInteractionVo(commentLikes);
             if (ONE.equals(targetType)) {
                 // 社区资讯文章点赞的人员集合的key key = LIKE_ONE:{targetId} value = [userId,userId];
                 String likeOneKey = ONE_LIKE + targetId;
@@ -151,7 +167,7 @@ public class CommentLikesServiceImpl implements ICommentLikesService {
                     userIdListValue.add(userId);
                     redisCache.setCacheList(likeOneKey, userIdListValue);
                     //给数据库同步数据在 redis中增加一个有过期时间的key 1分钟过期时间  key=like_one_count_time:{文章id}#{数量}
-                    redisCache.setCacheObject(likeOneCountTimeKey+"#"+1, 1, 1, TimeUnit.MINUTES);
+                    redisCache.setCacheObject(likeOneCountTimeKey + "#" + 1, 1, 1, TimeUnit.MINUTES);
                     //给该用户点赞文章的key添加值
                     communityIdList.add(targetId);
                     redisCache.setCacheList(myLikeOneKey, communityIdList);
@@ -188,7 +204,7 @@ public class CommentLikesServiceImpl implements ICommentLikesService {
                     userIdListValue.add(userId);
                     redisCache.setCacheList(likeTwoKey, userIdListValue);
                     //给数据库同步数据在 redis中增加一个有过期时间的key 1分钟过期时间
-                    redisCache.setCacheObject(likeTwoCountTimeKey+"#"+1, 1, 1, TimeUnit.MINUTES);
+                    redisCache.setCacheObject(likeTwoCountTimeKey + "#" + 1, 1, 1, TimeUnit.MINUTES);
                     //给该用户点赞回复的key添加值
                     communityIdList.add(targetId);
                     redisCache.setCacheList(myLikeTwoKey, communityIdList);
@@ -235,7 +251,7 @@ public class CommentLikesServiceImpl implements ICommentLikesService {
             likeOneCount = likeOneCount + 1;
             redisCache.setCacheObject(likeOneCountKey, likeOneCount);
             //新增数据库同步数据在 redis中增加一个有过期时间的key 1分钟过期时间
-            redisCache.setCacheObject(likeOneCountTimeKey+"#"+likeOneCount, likeOneCount, 1, TimeUnit.MINUTES);
+            redisCache.setCacheObject(likeOneCountTimeKey + "#" + likeOneCount, likeOneCount, 1, TimeUnit.MINUTES);
             return AjaxResult.success();
         } else {
             // 社区资讯文章回复的人员集合的key key = TWO_LIKE:{targetId} value = [userId,userId];
@@ -261,7 +277,7 @@ public class CommentLikesServiceImpl implements ICommentLikesService {
             likeTwoCount = likeTwoCount + 1;
             redisCache.setCacheObject(likeTwoCountKey, likeTwoCount);
             //新增数据库同步数据在 redis中增加一个有过期时间的key 1分钟过期时间
-            redisCache.setCacheObject(likeTwoCountTimeKey+"#"+likeTwoCount, likeTwoCount, 1, TimeUnit.MINUTES);
+            redisCache.setCacheObject(likeTwoCountTimeKey + "#" + likeTwoCount, likeTwoCount, 1, TimeUnit.MINUTES);
             return AjaxResult.success();
         }
     }
@@ -288,9 +304,9 @@ public class CommentLikesServiceImpl implements ICommentLikesService {
             //先去查看key对应的value集合
             List<Long> userIdListValue = redisCache.getCacheList(likeOneKey);
             userIdListValue.remove(userId);
-            if (userIdListValue.size() == 0){
+            if (userIdListValue.size() == 0) {
                 redisCache.deleteObject(likeOneKey);
-            }else {
+            } else {
                 redisCache.deleteObject(likeOneKey);
                 // 社区资讯文章点赞的人员集合中删除该用户
                 redisCache.setCacheList(likeOneKey, userIdListValue);
@@ -300,9 +316,9 @@ public class CommentLikesServiceImpl implements ICommentLikesService {
             String myLikeOneKey = ONE_MY_LIKE + userId;
             List<Long> communityIdListValue = redisCache.getCacheList(myLikeOneKey);
             communityIdListValue.remove(targetId);
-            if (communityIdListValue.size() == 0){
+            if (communityIdListValue.size() == 0) {
                 redisCache.deleteObject(myLikeOneKey);
-            }else {
+            } else {
                 redisCache.deleteObject(myLikeOneKey);
                 redisCache.setCacheList(myLikeOneKey, communityIdListValue);
             }
@@ -316,7 +332,7 @@ public class CommentLikesServiceImpl implements ICommentLikesService {
             //更新永久点赞数量
             redisCache.setCacheObject(likeOneCountKey, likeCount);
             //给数据库同步数据在 redis中增加一个有过期时间的key 1分钟过期时间
-            redisCache.setCacheObject(likeOneCountTimeKey+"#"+likeCount, likeCount, 1, TimeUnit.MINUTES);
+            redisCache.setCacheObject(likeOneCountTimeKey + "#" + likeCount, likeCount, 1, TimeUnit.MINUTES);
             return AjaxResult.success();
         } else {
             //评论的删除
@@ -330,9 +346,9 @@ public class CommentLikesServiceImpl implements ICommentLikesService {
             //先去查看key对应的value集合
             List<Long> userIdListValue = redisCache.getCacheList(likeTwoKey);
             userIdListValue.remove(userId);
-            if (userIdListValue.size() == 0){
+            if (userIdListValue.size() == 0) {
                 redisCache.deleteObject(likeTwoKey);
-            }else {
+            } else {
                 redisCache.deleteObject(likeTwoKey);
                 // 社区资讯文章评论的人员集合中删除该用户
                 redisCache.setCacheList(likeTwoKey, userIdListValue);
@@ -341,9 +357,9 @@ public class CommentLikesServiceImpl implements ICommentLikesService {
             String myLikeTwoKey = TWO_MY_LIKE + userId;
             List<Long> communityIdListValue = redisCache.getCacheList(myLikeTwoKey);
             communityIdListValue.remove(targetId);
-            if (communityIdListValue.size() == 0){
+            if (communityIdListValue.size() == 0) {
                 redisCache.deleteObject(myLikeTwoKey);
-            }else {
+            } else {
                 redisCache.deleteObject(myLikeTwoKey);
                 redisCache.setCacheList(myLikeTwoKey, communityIdListValue);
             }
@@ -357,8 +373,74 @@ public class CommentLikesServiceImpl implements ICommentLikesService {
             //更新永久点赞数量
             redisCache.setCacheObject(likeTwoCountKey, likeCount);
             //给数据库同步数据在 redis中增加一个有过期时间的key 1分钟过期时间
-            redisCache.setCacheObject(likeTwoCountTimeKey+"#"+likeCount, likeCount, 1, TimeUnit.MINUTES);
+            redisCache.setCacheObject(likeTwoCountTimeKey + "#" + likeCount, likeCount, 1, TimeUnit.MINUTES);
             return AjaxResult.success();
         }
     }
+
+    /**
+     * 设置未读点赞互动的方法
+     *
+     * @param commentLikes
+     */
+    public void setCommentInteractionVo(CommentLikes commentLikes) {
+        Long userId = commentLikes.getUserId();
+        Long targetId = commentLikes.getTargetId();
+        //------设置未读收藏,在redis中新增一条未读的互动--------
+        CommentInteractionVo commentInteractionVo = new CommentInteractionVo();
+        //先判断是资讯点赞还是回复点赞
+        String targetType = commentLikes.getTargetType();
+        commentInteractionVo.setTargetType(TWO);
+        commentInteractionVo.setType(ONE);
+        if (ONE.equals(targetType)) {
+            //说明是资讯点赞
+            //根据targetId获取该资讯的内容
+            CommunityNews communityNews = communityNewsMapper.selectCommunityNewsByCommunityId(targetId);
+            commentInteractionVo.setTargetUserId(communityNews.getUserId());
+            //-------------判断是点赞还是取消点赞-------------------
+            // 社区资讯文章点赞的人员集合的key key = LIKE_ONE:{targetId} value = [userId,userId];
+            String likeOneKey = ONE_LIKE + targetId;
+            //先去查看key对应的value集合 value = 点赞人员的id集合
+            List<Long> userIdListValue = redisCache.getCacheList(likeOneKey);
+            if (userIdListValue != null && userIdListValue.size() > 0) {
+                //说明该文章被点过赞
+                //判断该用户是否点过赞
+                if (userIdListValue.contains(userId)) {
+                    //设置取消点赞
+                    commentInteractionVo.setType(TWO);
+                }
+            }
+            //-------------判断是点赞还是取消点赞结束-------------------
+        } else if (TWO.equals(targetType)) {
+            //说明是回复点赞
+            commentInteractionVo.setTargetType(FIV);
+            //根据targetId获取该评论的内容
+            CommentIndex commentIndex = commentIndexMapper.selectCommentIndexByCommentId(targetId);
+            commentInteractionVo.setTargetUserId(commentIndex.getUserId());
+            commentInteractionVo.setCommunityId(commentLikes.getCommunityId());
+
+            //-------------判断是点赞还是取消点赞-------------------
+            // 社区资讯回复点赞的人员集合的key key = LIKE_ONE:{targetId} value = [userId,userId];
+            String likeTwoKey = TWO_LIKE + targetId;
+            //先去查看key对应的value集合 value = 点赞人员的id集合
+            List<Long> userIdListValue = redisCache.getCacheList(likeTwoKey);
+            if (userIdListValue != null && userIdListValue.size() > 0) {
+                //说明该回复被点过赞
+                //判断该用户是否点过赞
+                if (userIdListValue.contains(userId)) {
+                    //设置取消点赞
+                    commentInteractionVo.setType(TWO);
+                }
+            }
+            //-------------判断是点赞还是取消点赞-------------------
+        }
+        commentInteractionVo.setTargetTitle(commentLikes.getTargetTitle());
+        commentInteractionVo.setUserId(commentLikes.getUserId());
+        commentInteractionVo.setAvatar(commentLikes.getAvatar());
+        commentInteractionVo.setNickName(commentLikes.getNickName());
+        commentInteractionVo.setCreateTime(DateUtils.getNowDate());
+        commentInteractionVo.setTargetId(commentLikes.getTargetId());
+        iCommunityNewsService.setCommentInteraction(commentInteractionVo);
+        //----------------------设置未读互动完成--------
+    }
 }

+ 26 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommentStarsServiceImpl.java

@@ -4,13 +4,17 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.system.domain.communityNews.CommentStars;
+import com.ruoyi.system.domain.communityNews.CommunityNews;
+import com.ruoyi.system.domain.communityNews.vo.CommentInteractionVo;
 import com.ruoyi.system.mapper.CommentStarsMapper;
 import com.ruoyi.system.mapper.CommunityNewsMapper;
 import com.ruoyi.system.service.ICommentStarsService;
+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 javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -28,9 +32,12 @@ public class CommentStarsServiceImpl implements ICommentStarsService {
     private CommentStarsMapper commentStarsMapper;
     @Autowired
     private CommunityNewsMapper communityNewsMapper;
-    @Autowired
+    @Resource
     private RedisCache redisCache;
 
+    @Resource
+    private ICommunityNewsService iCommunityNewsService;
+
     /**
      * 查询社区资讯收藏
      *
@@ -112,9 +119,12 @@ public class CommentStarsServiceImpl implements ICommentStarsService {
         String starsUserCountKey = STARS_USER_COUNT + targetId;
         List<Long> userIdList = redisCache.getCacheList(starsCommunityKey);
         Integer starsCount = 0;
+        CommentInteractionVo commentInteractionVo = new CommentInteractionVo();
+        commentInteractionVo.setType(ONE);
         if (userIdList != null && userIdList.size() > 0) {
             //判断该用户是否收藏过
             if (userIdList.contains(userId)) {
+                commentInteractionVo.setType(TWO);
                 //说明收藏过则-----取消收藏
                 userIdList.remove(userId);
                 if (userIdList.size() == 0) {
@@ -156,6 +166,21 @@ public class CommentStarsServiceImpl implements ICommentStarsService {
         }
         //更新资讯表中数量
         communityNewsMapper.updateCommunityNewsStars(targetId, starsCount.toString());
+
+
+        //------设置未读收藏,在redis中新增一条未读的互动--------
+        commentInteractionVo.setTargetType(THR);
+        //根据targetId获取该资讯的内容
+        CommunityNews communityNews = communityNewsMapper.selectCommunityNewsByCommunityId(targetId);
+        commentInteractionVo.setTargetUserId(communityNews.getUserId());
+        commentInteractionVo.setTargetTitle(commentStars.getTargetTitle());
+        commentInteractionVo.setUserId(userId);
+        commentInteractionVo.setAvatar(commentStars.getAvatar());
+        commentInteractionVo.setNickName(commentStars.getNickName());
+        commentInteractionVo.setCreateTime(DateUtils.getNowDate());
+        commentInteractionVo.setTargetId(commentStars.getTargetId());
+        iCommunityNewsService.setCommentInteraction(commentInteractionVo);
+        //----------------------设置未读互动完成--------
         return AjaxResult.success();
     }
 

+ 147 - 29
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommunityNewsServiceImpl.java

@@ -1,28 +1,33 @@
 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.CommunityNews;
+import com.ruoyi.system.domain.communityNews.vo.CommentInteractionVo;
 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.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static com.ruoyi.common.constant.Constants.*;
 
 /**
  * 社区资讯Service业务层处理
- * 
+ *
  * @author boman
  * @date 2025-02-14
  */
 @Service
-public class CommunityNewsServiceImpl implements ICommunityNewsService 
-{
+public class CommunityNewsServiceImpl implements ICommunityNewsService {
     @Autowired
     private CommunityNewsMapper communityNewsMapper;
     @Autowired
@@ -30,46 +35,45 @@ public class CommunityNewsServiceImpl implements ICommunityNewsService
 
     /**
      * 查询社区资讯
-     * 
+     *
      * @param communityId 社区资讯主键
      * @return 社区资讯
      */
     @Override
-    public CommunityNews selectCommunityNewsByCommunityId(Long communityId)
-    {
+    public CommunityNews selectCommunityNewsByCommunityId(Long 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)){
+        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 != null && userIdListStars.size() > 0) {
             //判断该用户是否收藏过
-            if (userIdListStars.contains(userId)){
+            if (userIdListStars.contains(userId)) {
                 communityNews.setIsStar("Y");
             }
         }
         //查询redis中的点赞数量,收藏数量,评论数量
         Object likeCount = redisCache.getCacheObject(ONE_LIKE_COUNT + communityId);
-        if (ObjectUtils.isNotEmpty(likeCount)){
+        if (ObjectUtils.isNotEmpty(likeCount)) {
             communityNews.setUserLikes(likeCount.toString());
         }
         //收藏
         Object startCount = redisCache.getCacheObject(STARS_USER_COUNT + communityId);
-        if (ObjectUtils.isNotEmpty(startCount)){
+        if (ObjectUtils.isNotEmpty(startCount)) {
             communityNews.setUserStars(startCount.toString());
         }
         //评论
         Object communityCommentCount = redisCache.getCacheObject(COMMUNITY_COMMENT_COUNT + communityId);
-        if (ObjectUtils.isNotEmpty(communityCommentCount)){
+        if (ObjectUtils.isNotEmpty(communityCommentCount)) {
             communityNews.setUserComment(communityCommentCount.toString());
         }
         return communityNews;
@@ -77,63 +81,177 @@ public class CommunityNewsServiceImpl implements ICommunityNewsService
 
     /**
      * 查询社区资讯列表
-     * 
+     *
      * @param communityNews 社区资讯
      * @return 社区资讯
      */
     @Override
-    public List<CommunityNews> selectCommunityNewsList(CommunityNews communityNews)
-    {
-        return communityNewsMapper.selectCommunityNewsList(communityNews);
+    public List<CommunityNews> selectCommunityNewsList(CommunityNews communityNews) {
+        Long userId = SecurityUtils.getUserId();
+        List<CommunityNews> communityNewsList = communityNewsMapper.selectCommunityNewsList(communityNews);
+        //设置是否有未读互动
+        if (communityNewsList != null && communityNewsList.size() > 0) {
+            for (CommunityNews news : communityNewsList) {
+                news.setIsInteraction("N");
+                //key=comment_interaction_community_user_count:{userId} hkey = {community_id} value = 资讯下有多少个未读的互动(点赞,收藏,回复)
+                Object commentInteractionCommunityUserCount = redisCache.getCacheMapValue(COMMENT_INTERACTION_COMMUNITY_USER_COUNT + userId, news.getCommunityId().toString());
+                if (ObjectUtils.isNotEmpty(commentInteractionCommunityUserCount)) {
+                    news.setIsInteraction("Y");
+                }
+            }
+        }
+        return communityNewsList;
     }
 
     /**
      * 新增社区资讯
-     * 
+     *
      * @param communityNews 社区资讯
      * @return 结果
      */
     @Override
-    public int insertCommunityNews(CommunityNews communityNews)
-    {
+    public int insertCommunityNews(CommunityNews communityNews) {
+        communityNews.setUserId(SecurityUtils.getUserId());
         communityNews.setCreateTime(DateUtils.getNowDate());
         return communityNewsMapper.insertCommunityNews(communityNews);
     }
 
     /**
      * 修改社区资讯
-     * 
+     *
      * @param communityNews 社区资讯
      * @return 结果
      */
     @Override
-    public int updateCommunityNews(CommunityNews communityNews)
-    {
+    public int updateCommunityNews(CommunityNews communityNews) {
         communityNews.setUpdateTime(DateUtils.getNowDate());
         return communityNewsMapper.updateCommunityNews(communityNews);
     }
 
     /**
      * 批量删除社区资讯
-     * 
+     *
      * @param communityIds 需要删除的社区资讯主键
      * @return 结果
      */
     @Override
-    public int deleteCommunityNewsByCommunityIds(Long[] communityIds)
-    {
+    public int deleteCommunityNewsByCommunityIds(Long[] communityIds) {
         return communityNewsMapper.deleteCommunityNewsByCommunityIds(communityIds);
     }
 
     /**
      * 删除社区资讯信息
-     * 
+     *
      * @param communityId 社区资讯主键
      * @return 结果
      */
     @Override
-    public int deleteCommunityNewsByCommunityId(Long communityId)
-    {
+    public int deleteCommunityNewsByCommunityId(Long communityId) {
         return communityNewsMapper.deleteCommunityNewsByCommunityId(communityId);
     }
+
+    /**
+     * 设置未读互动
+     *
+     * @return
+     */
+    @Override
+    public void setCommentInteraction(CommentInteractionVo commentInteractionVo) {
+        //把对应用户的未读互动存储到redis 还需要记录数量
+        //目标用户id
+        Long targetUserId = commentInteractionVo.getTargetUserId();
+        String targetType = commentInteractionVo.getTargetType();
+        String type = commentInteractionVo.getType();
+        Long targetId = commentInteractionVo.getTargetId();
+        /* 社区资讯ID 当是点赞回复的时候有值 */
+        Long communityId = commentInteractionVo.getTargetId();
+        //判断是否是点赞回复
+        if (targetType.equals(FIV)) {
+            communityId = commentInteractionVo.getCommunityId();
+        }
+        //-------------------获取设置用户的未读互动数量----------------
+        String commentInteractionUserCountKey = COMMENT_INTERACTION_USER_COUNT + targetUserId;
+        Integer commentInteractionUserCount = redisCache.getCacheObject(commentInteractionUserCountKey);
+        if (commentInteractionUserCount != null) {
+            //判断是删除还是新增
+            if (ONE.equals(type)) {
+                redisCache.setCacheObject(commentInteractionUserCountKey, commentInteractionUserCount + 1);
+            } else {
+                commentInteractionUserCount = commentInteractionUserCount - 1;
+                if (commentInteractionUserCount < 0) {
+                    commentInteractionUserCount = 0;
+                }
+                redisCache.setCacheObject(commentInteractionUserCountKey, commentInteractionUserCount);
+            }
+        } else {
+            if (ONE.equals(type)) {
+                redisCache.setCacheObject(commentInteractionUserCountKey, 1);
+            }
+        }
+        //-------------------设置用户的未读互动数量结束----------------
+        //-------------------设置用户的未读资讯的id和该资讯下一共有多少未读互动数量----------------
+        //key=comment_interaction_community_user_count:{userId} hkey = {community_id} value = 资讯下有多少个未读的互动(点赞,收藏,回复)
+        String commentInteractionCommunityUserCount = redisCache.getCacheMapValue(COMMENT_INTERACTION_COMMUNITY_USER_COUNT + targetUserId, communityId.toString());
+        //判断是删除还是新增
+        if (ONE.equals(type)) {
+            //新增
+            if (StringUtils.isNotBlank(commentInteractionCommunityUserCount)) {
+                redisCache.setCacheMapValue(COMMENT_INTERACTION_COMMUNITY_USER_COUNT + targetUserId, communityId.toString(), String.valueOf(Integer.parseInt(commentInteractionCommunityUserCount) + 1));
+            } else {
+                redisCache.setCacheMapValue(COMMENT_INTERACTION_COMMUNITY_USER_COUNT + targetUserId, communityId.toString(), ONE);
+            }
+        } else {
+            //删除
+            if (StringUtils.isNotBlank(commentInteractionCommunityUserCount)) {
+                int commentInteractionCommunityUserCountResult = Integer.parseInt(commentInteractionCommunityUserCount) - 1;
+                if (commentInteractionCommunityUserCountResult <= 0) {
+                    redisCache.deleteCacheMapValue(COMMENT_INTERACTION_COMMUNITY_USER_COUNT + targetUserId, communityId.toString());
+                } else {
+                    redisCache.setCacheMapValue(COMMENT_INTERACTION_COMMUNITY_USER_COUNT + targetUserId, communityId.toString(), commentInteractionCommunityUserCountResult);
+                }
+            }
+        }
+        //-------------------设置用户的未读资讯的id和该资讯下一共有多少未读互动数量结束----------------
+        //-------------------存储用户的未读资讯数据----------------
+        String commentInteractionUserKey = COMMENT_INTERACTION_USER + targetUserId;
+        Map<String, Object> commentInteractionUserMap = redisCache.getCacheMap(commentInteractionUserKey);
+        //hKey={targetType:targetId}
+        String hKey = targetType + ":" + targetId;
+        if (ONE.equals(type)) {
+            //新增/追加一条数据
+            redisCache.setCacheMapValue(commentInteractionUserKey, hKey, commentInteractionVo);
+        } else {
+            //删除
+            if (commentInteractionUserMap != null && commentInteractionUserMap.size() > 0) {
+                //删除一条数据
+                redisCache.deleteCacheMapValue(commentInteractionUserKey, hKey);
+            }
+        }
+        //-------------------存储用户的未读资讯数据结束----------------
+    }
+
+    /**
+     * 获取未读互动列表
+     */
+    @Override
+    public AjaxResult getCommentInteraction(CommentInteractionVo commentInteractionVo) {
+        Long userId = SecurityUtils.getUserId();
+        Map<String, Object> resultMap = new HashMap<>();
+        String commentInteractionUserCountKey = COMMENT_INTERACTION_USER_COUNT + userId;
+        Object commentInteractionUserCount = redisCache.getCacheObject(commentInteractionUserCountKey);
+        int commentInteractionUserCountInt = 0;
+        if (ObjectUtils.isNotEmpty(commentInteractionUserCount)) {
+            commentInteractionUserCountInt = Integer.parseInt(commentInteractionUserCount.toString());
+        }
+        resultMap.put("total", commentInteractionUserCountInt);
+        //-------------------存储用户的未读资讯数据----------------
+        String commentInteractionUserKey = COMMENT_INTERACTION_USER + userId;
+        Map<String, Object> commentInteractionUserMap = redisCache.getCacheMap(commentInteractionUserKey);
+        List<Object> resultList = new ArrayList<>();
+        if (commentInteractionUserMap != null && commentInteractionUserMap.size() > 0) {
+            resultList.addAll(commentInteractionUserMap.values());
+        }
+        resultMap.put("list", resultList);
+        return AjaxResult.success(resultMap);
+    }
 }

+ 0 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProprietorCarServiceImpl.java

@@ -96,7 +96,6 @@ public class ProprietorCarServiceImpl implements IProprietorCarService {
 
         return cleaned.matches(regex);
     }
-
     /**
      * 判断车牌号是否合规
      *

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

@@ -38,7 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="checkPointManageId != null "> and check_point_manage_id = #{checkPointManageId}</if>
             <if test="dateTimeNum != null  and dateTimeNum != ''"> and date_time_num = #{dateTimeNum}</if>
             <if test="checkType != null  and checkType != ''"> and check_type = #{checkType}</if>
-            <if test="checkTime != null "> and check_time = #{checkTime}</if>
+            <if test="checkTime != null "> and  date_format(check_time,'%Y%m%d') = date_format(#{checkTime},'%Y%m%d')</if>
             <if test="checkAddress != null  and checkAddress != ''"> and check_address = #{checkAddress}</if>
             <if test="userName != null  and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
             <if test="useId != null "> and use_id = #{useId}</if>