Browse Source

Merge remote-tracking branch 'origin/dev_group0329' into dev_temp

master
yinzuomei 4 years ago
parent
commit
09a25d486a
  1. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ResiGroupMemberDao.java
  2. 19
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java
  3. 10
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java
  4. 13
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java
  5. 20
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  6. 13
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml

10
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<ResiGroupMemberEntity> {
* @author sun
*/
int delByGroupAndUserId(@Param("groupId")String groupId, @Param("userId")String userId);
/**
* @return java.util.List<com.epmet.resi.group.dto.member.ResiGroupMemberDTO>
* @param groupId
* @param userId
* @author yinzuomei
* @description 查询当前用户被移出群的记录按创建时间降序
* @Date 2021/4/6 12:50
**/
List<ResiGroupMemberDTO> queryMemberRemovedRecs(@Param("groupId")String groupId, @Param("userId")String userId);
}

19
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<String,Object> param = new HashMap<>();
/*Map<String,Object> 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<ResiGroupMemberDTO> memberList = memberService.list(param);
List<ResiGroupMemberDTO> memberList = memberService.list(param);*/
List<ResiGroupMemberDTO> memberList=new ArrayList<>();
ResiGroupMemberDTO resiGroupMemberDTO=memberService.getResiGroupMember(groupId,userId);
if (null == resiGroupMemberDTO) {
//查询组员被移除的记录
List<ResiGroupMemberDTO> 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()));

10
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<ResiGroupMemberEntit
* @Date 2021/3/30 10:17
**/
ResiGroupMemberDTO getGroupLeader(String groupId);
/**
* @return java.util.List<com.epmet.resi.group.dto.member.ResiGroupMemberDTO>
* @param groupId
* @param userId
* @author yinzuomei
* @description 查询当前用户被移出群的记录按创建时间降序
* @Date 2021/4/6 12:48
**/
List<ResiGroupMemberDTO> queryMemberRemovedRecs(String groupId, String userId);
}

13
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<ResiGroupMemberD
return groupLeader;
}
/**
* @param groupId
* @param userId
* @return java.util.List<com.epmet.resi.group.dto.member.ResiGroupMemberDTO>
* @author yinzuomei
* @description 查询当前用户被移出群的记录按创建时间降序
* @Date 2021/4/6 12:48
**/
@Override
public List<ResiGroupMemberDTO> queryMemberRemovedRecs(String groupId, String userId) {
return baseDao.queryMemberRemovedRecs(groupId,userId);
}
/**
* @param groupMemberListFormDTO
* @return com.epmet.commons.tools.utils.Result

20
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -1218,15 +1218,17 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
//存入缓存
ResiGroupMemberInfoRedisDTO memberRedisDTO = new ResiGroupMemberInfoRedisDTO();
ResiGroupMemberDTO memberMySql = resiGroupMemberDao.selectGroupMemberInfo(groupId, user.getUserId());
memberRedisDTO.setMemberStatus(memberMySql.getStatus());
memberRedisDTO.setUserId(user.getUserId());
memberRedisDTO.setUserShowName(user.getShowName());
memberRedisDTO.setEnterGroupType(memberMySql.getEnterGroupType());
memberRedisDTO.setGroupLeaderFlag(memberMySql.getGroupLeaderFlag());
memberRedisDTO.setUserHeadPhoto(user.getHeadPhoto());
memberRedisDTO.setMemberMobile(user.getRegMobile());
memberRedisDTO.setGroupId(groupId);
resiGroupMemberRedis.set(memberRedisDTO);
if (null != memberMySql) {
memberRedisDTO.setMemberStatus(memberMySql.getStatus());
memberRedisDTO.setUserId(user.getUserId());
memberRedisDTO.setUserShowName(user.getShowName());
memberRedisDTO.setEnterGroupType(memberMySql.getEnterGroupType());
memberRedisDTO.setGroupLeaderFlag(memberMySql.getGroupLeaderFlag());
memberRedisDTO.setUserHeadPhoto(user.getHeadPhoto());
memberRedisDTO.setMemberMobile(user.getRegMobile());
memberRedisDTO.setGroupId(groupId);
resiGroupMemberRedis.set(memberRedisDTO);
}
}
} else {

13
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml

@ -178,4 +178,17 @@
LIMIT 1
</update>
<select id="queryMemberRemovedRecs" parameterType="map" resultType="com.epmet.resi.group.dto.member.ResiGroupMemberDTO">
SELECT
*
FROM
resi_group_member rgm
WHERE
rgm.RESI_GROUP_ID = #{groupId}
AND rgm.CUSTOMER_USER_ID = #{userId}
AND rgm.DEL_FLAG = '1'
AND rgm.STATUS = 'removed'
ORDER BY
rgm.CREATED_TIME DESC
</select>
</mapper>

Loading…
Cancel
Save