|
@@ -1,8 +1,10 @@
|
|
|
package cn.com.ty.lift.ud.chat.service.impl;
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.ZoneOffset;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
import cn.com.ty.lift.common.model.PushMessage;
|
|
|
import cn.com.ty.lift.common.model.PushUserInfo;
|
|
@@ -128,6 +130,8 @@ public class ChatSessionServiceImpl extends ServiceImpl<ChatSessionMapper, ChatS
|
|
|
public RestResponse findDBListByUserId(ChatSessionQuery query) {
|
|
|
IPage page = query.page();
|
|
|
List<ChatSessionEntity> list = sessionMapper.findDBListByUserId(query.getUserId());
|
|
|
+ Set<String> keys = redis.keys("ROOM:");
|
|
|
+
|
|
|
page.setRecords(list);
|
|
|
return RestResponse.success(page);
|
|
|
}
|
|
@@ -148,8 +152,9 @@ public class ChatSessionServiceImpl extends ServiceImpl<ChatSessionMapper, ChatS
|
|
|
|
|
|
if (StringUtils.isBlank(sessionId)) {
|
|
|
ChatSessionEntity record = new ChatSessionEntity();
|
|
|
+ //添加自己到房间
|
|
|
sessionId = UUIDUtil.getUuidByTime9();
|
|
|
- record.setUserId(request.getUserId());
|
|
|
+ record.setUserId(request.getCreateUserId());
|
|
|
record.setCreateUserId(request.getCreateUserId());
|
|
|
record.setSessionid(sessionId);
|
|
|
record.setDataTable(3);
|
|
@@ -157,9 +162,9 @@ public class ChatSessionServiceImpl extends ServiceImpl<ChatSessionMapper, ChatS
|
|
|
record.setStatuz(1);
|
|
|
record.setCreateTime(LocalDateTime.now());
|
|
|
sessionMapper.insertSelective(record);
|
|
|
-
|
|
|
+ //添加对方用户到房间
|
|
|
record = new ChatSessionEntity();
|
|
|
- record.setUserId(request.getCreateUserId());
|
|
|
+ record.setUserId(request.getUserId());
|
|
|
record.setSessionid(sessionId);
|
|
|
record.setDataTable(3);
|
|
|
record.setEntrance(1);
|
|
@@ -173,7 +178,8 @@ public class ChatSessionServiceImpl extends ServiceImpl<ChatSessionMapper, ChatS
|
|
|
RoomInfo roomInfo = new RoomInfo();
|
|
|
roomInfo.setSessionid(record.getSessionid());
|
|
|
roomInfo.setDataTable(record.getDataTable());
|
|
|
- roomInfo.setLastTime(record.getCreateTime());
|
|
|
+ roomInfo.setLastTime(record.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli());
|
|
|
+
|
|
|
UserInfo userInfo1 = new UserInfo();
|
|
|
userInfo1.setUserId(request.getUserId());
|
|
|
UserInfo userInfo2 = new UserInfo();
|
|
@@ -181,6 +187,7 @@ public class ChatSessionServiceImpl extends ServiceImpl<ChatSessionMapper, ChatS
|
|
|
List<UserInfo> userList = new ArrayList<>();
|
|
|
userList.add(userInfo1);
|
|
|
userList.add(userInfo2);
|
|
|
+
|
|
|
roomInfo.setUserLIst(userList);
|
|
|
redis.setValue("ROOM:"+vo.getRoom(),roomInfo);
|
|
|
} else {
|