Commit 91b31c16 by 罗长华

Merge remote-tracking branch 'origin/xiaohudou_20220427' into xiaohudou_20220427

parents 4526cd88 785b6363
......@@ -27,16 +27,16 @@ spring:
# Redis配置
redis:
# database: 0
# host: 127.0.0.1
# password:
# port: 6379
database: 0
host: 121.37.22.224
password: temple123456
host: 127.0.0.1
password:
port: 6379
# database: 0
# host: 121.37.22.224
# password: temple123456
# port: 6379
dubbo:
protocol:
port: 20882
......
......@@ -280,7 +280,7 @@ public class ConversationAction {
/**
* 全量获取聊天室成员
*/
@PostMapping("/listChatRoomMember")
@ActionMapping("/listChatRoomMember")
@ApiOperation(value = "全量获取聊天室成员", notes = "全量获取聊天室成员")
public WsResponse<List<ChatRoomMemberVo>> listChatRoomMember(ChatRoomMemberPageParam data) {
log.info("全量获取聊天室成员入参 {}", JSON.toJSONString(data));
......
......@@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -25,9 +26,9 @@ public class ChatRoomCacheManager {
/**
* redis的群聊天室房间键 key
*/
public static final String CHAT_ROOM_KEY = "chat_room_";
public static final String CHAT_MEMBER_KEY = "chat_member_";
@Autowired
@Resource
private RedisUtils redisUtils;
/**
......@@ -38,7 +39,7 @@ public class ChatRoomCacheManager {
* @param platform
*/
public void intoRoom(Long clientId, Long chatRoomId, Integer platform) {
redisUtils.hashset(CHAT_ROOM_KEY + chatRoomId, clientId + RedisUtils.SPLIT + platform, GetIpUtils.getlanIp(),
redisUtils.hashset(CHAT_MEMBER_KEY + chatRoomId, clientId + RedisUtils.SPLIT + platform, GetIpUtils.getlanIp(),
2, TimeUnit.DAYS);
}
......@@ -51,7 +52,7 @@ public class ChatRoomCacheManager {
* @param platform
*/
public void exitRoom(Long clientId, Long chatRoomId, Integer platform) {
redisUtils.hashdel(CHAT_ROOM_KEY + chatRoomId, clientId + RedisUtils.SPLIT + platform);
redisUtils.hashdel(CHAT_MEMBER_KEY + chatRoomId, clientId + RedisUtils.SPLIT + platform);
}
/**
......@@ -61,7 +62,7 @@ public class ChatRoomCacheManager {
* @return 在线成员的key-val,其中key是 client的主键id:platform, val是 ip
*/
public Map<String, String> findOnlineClientsByChatRoomId(Long chatRoomId) {
return redisUtils.hashgetll(CHAT_ROOM_KEY + chatRoomId);
return redisUtils.hashgetll(CHAT_MEMBER_KEY + chatRoomId);
}
/**
......
......@@ -45,7 +45,7 @@ public class ImConversation extends BaseEntity {
@ApiModelProperty("群成员数量")
private Integer memberCount;
@ApiModelProperty("会话属性,1:单聊,2:普通群,3:万人群")
@ApiModelProperty("会话属性,1:单聊,2:普通群,3:万人群,4:聊天室")
private Integer chatType;
@NotNull(message = "应用appid不能为空")
......
......@@ -24,4 +24,7 @@ public class ImConversationQueryParam implements Serializable {
@ApiModelProperty("会话id")
private Long id;
@ApiModelProperty("会话属性,1:单聊,2:普通群,3:万人群 4:聊天室")
private Integer chatType;
}
......@@ -52,7 +52,7 @@ public class ImConversationQueryVo implements Serializable {
@ApiModelProperty("群成员数量")
private Integer memberCount;
@ApiModelProperty("会话属性,1:单聊,2:普通群,3:万人群")
@ApiModelProperty("会话属性,1:单聊,2:普通群,3:万人群,4:聊天室")
private Integer chatType;
/**
......
......@@ -1135,6 +1135,15 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
try {
// 获取当前client
ImClient client = contextService.getImClientIfNotNullOrThrow();
if (param.getChatType() != null && param.getChatType() == 4) {
// 聊天室
ImConversation imConversation = imConversationMapper.selectById(param.getId());
if (imConversation != null) {
ConversationVo conversationVo = new ConversationVo();
BeanUtils.copyProperties(imConversation, conversationVo);
return conversationVo;
}
}
// 查询用户加入的所有会话 与每个会话的未读条数 成员
List<ConversationVo> conversationList = imConversationMapper.getMyImConversationListAndMsgCount(client.getId(), client.getClientId(), param.getId());
if (CollectionUtils.isEmpty(conversationList)) {
......
......@@ -67,7 +67,7 @@ public class Conversation implements Serializable {
private String members;
/**
* "会话属性,1:单聊,2:普通群,3:万人群"
* "会话属性,1:单聊,2:普通群,3:万人群,4:聊天室"
*/
private Integer chatType;
......
......@@ -19,7 +19,7 @@ public class ListConversationRequest extends WebServiceRequest {
private static final long serialVersionUID = -3602523207000275557L;
/**
* 会话属性,1:单聊,2:普通群,3:万人群
* 会话属性,1:单聊,2:普通群,3:万人群,4:聊天室
*/
private Integer chatType;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment