From 1c47e0779aa4f0dedb90a1b405bee733f82994fb Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 6 Apr 2021 11:12:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?setCacheUserInfoWithIssue=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ResiTopicServiceImpl.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java index fafbef7b2e..c5b81bde52 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java @@ -1190,15 +1190,17 @@ public class ResiTopicServiceImpl extends BaseServiceImpl Date: Tue, 6 Apr 2021 12:54:29 +0800 Subject: [PATCH 2/2] =?UTF-8?q?ResiGroupMemberRedis.get=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../member/dao/ResiGroupMemberDao.java | 10 ++++++++++ .../member/redis/ResiGroupMemberRedis.java | 19 +++++++++++++++---- .../service/ResiGroupMemberService.java | 10 ++++++++++ .../impl/ResiGroupMemberServiceImpl.java | 13 +++++++++++++ .../mapper/member/ResiGroupMemberDao.xml | 13 +++++++++++++ 5 files changed, 61 insertions(+), 4 deletions(-) diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java index b3cf2cd38f..6b2df49d00 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java @@ -134,4 +134,14 @@ public interface ResiGroupMemberDao extends BaseDao { * @author sun */ int delByGroupAndUserId(@Param("groupId")String groupId, @Param("userId")String userId); + + /** + * @return java.util.List + * @param groupId + * @param userId + * @author yinzuomei + * @description 查询当前用户被移出群的记录,按创建时间降序 + * @Date 2021/4/6 12:50 + **/ + List queryMemberRemovedRecs(@Param("groupId")String groupId, @Param("userId")String userId); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java index 6786ea2e81..f3d5f52942 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java @@ -19,7 +19,6 @@ package com.epmet.modules.member.redis; import cn.hutool.core.bean.BeanUtil; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; @@ -32,10 +31,10 @@ import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.modules.utils.ModuleConstant; -import com.epmet.resi.group.constant.TopicConstant; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -99,11 +98,23 @@ public class ResiGroupMemberRedis { (ResiGroupMemberInfoRedisDTO) redisUtils.get(ResiGroupRedisKeys.getResiGroupMemberInfoKey(groupId,userId)); //如果缓存中没有该成员数据 if(null == memberCache || StringUtils.isBlank(memberCache.getUserId())){ - Map param = new HashMap<>(); + /*Map param = new HashMap<>(); param.put(TopicConstant.CUSTOMER_USER_ID,userId); param.put(TopicConstant.RESI_GROUP_ID,groupId); param.put(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR); - List memberList = memberService.list(param); + List memberList = memberService.list(param);*/ + List memberList=new ArrayList<>(); + ResiGroupMemberDTO resiGroupMemberDTO=memberService.getResiGroupMember(groupId,userId); + if (null == resiGroupMemberDTO) { + //查询组员被移除的记录 + List delMemberList = memberService.queryMemberRemovedRecs(groupId, userId); + if (CollectionUtils.isNotEmpty(delMemberList)) { + logger.warn(String.format("groupId=%s,userId=%s,组员已被删除", groupId, userId)); + memberList.add(delMemberList.get(NumConstant.ZERO)); + } + }else{ + memberList.add(resiGroupMemberDTO); + } if(null != memberList && memberList.size() >= 1){ if(memberList.size() > 1) { memberList.sort(Comparator.comparing(ResiGroupMemberDTO::getCreatedTime, Collections.reverseOrder())); diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java index 522be90e6a..5a9563141b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java @@ -215,4 +215,14 @@ public interface ResiGroupMemberService extends BaseService + * @param groupId + * @param userId + * @author yinzuomei + * @description 查询当前用户被移出群的记录,按创建时间降序 + * @Date 2021/4/6 12:48 + **/ + List queryMemberRemovedRecs(String groupId, String userId); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java index c566a5ec94..7fd7e48259 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java @@ -326,6 +326,19 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl + * @author yinzuomei + * @description 查询当前用户被移出群的记录,按创建时间降序 + * @Date 2021/4/6 12:48 + **/ + @Override + public List queryMemberRemovedRecs(String groupId, String userId) { + return baseDao.queryMemberRemovedRecs(groupId,userId); + } + /** * @param groupMemberListFormDTO * @return com.epmet.commons.tools.utils.Result diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml index 6fb5735ffe..183de49bad 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml @@ -178,4 +178,17 @@ LIMIT 1 +