Commit 0a2d7ffd by zhangjw

1:已知bug修复

parent f4be0377
...@@ -15,4 +15,5 @@ public class SessionInfo extends Session { ...@@ -15,4 +15,5 @@ public class SessionInfo extends Session {
private Long recordId; private Long recordId;
private String latestRecord; private String latestRecord;
} }
...@@ -22,7 +22,10 @@ public abstract class BaseHandler<T> extends SimpleChannelInboundHandler<T> { ...@@ -22,7 +22,10 @@ public abstract class BaseHandler<T> extends SimpleChannelInboundHandler<T> {
@Override @Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception { public void channelInactive(ChannelHandlerContext ctx) throws Exception {
singleChatFactory.getService(ctx.channel().attr(ChannelAttributeKey.ROLE_TYPE).get()).offline(ctx); final String roleType = ctx.channel().attr(ChannelAttributeKey.ROLE_TYPE).get();
if (roleType != null) {
singleChatFactory.getService(roleType).offline(ctx);
}
} }
@Override @Override
......
...@@ -36,6 +36,7 @@ public class SessionListServiceImpl extends ServiceImpl<SessionListMapper, Sessi ...@@ -36,6 +36,7 @@ public class SessionListServiceImpl extends ServiceImpl<SessionListMapper, Sessi
final ChatRecord latestMsg = chatRecordService.getLatestMsg(userId, session.getMerchantId()); final ChatRecord latestMsg = chatRecordService.getLatestMsg(userId, session.getMerchantId());
final SessionInfo sessionModel = new SessionInfo().setLatestRecord(latestMsg.getMsgInfo()).setRecordId(latestMsg.getId()); final SessionInfo sessionModel = new SessionInfo().setLatestRecord(latestMsg.getMsgInfo()).setRecordId(latestMsg.getId());
BeanUtils.copyProperties(session, sessionModel); BeanUtils.copyProperties(session, sessionModel);
sessionModel.setModifyTime(latestMsg.getCreateTime());//最后一条信息创建时间为呼叫列表更新时间
sessions.add(sessionModel); sessions.add(sessionModel);
}); });
return new MsgBody<List<SessionInfo>>().setCode(ResultStatus.SUCCESS.getCode()).setData(sessions); return new MsgBody<List<SessionInfo>>().setCode(ResultStatus.SUCCESS.getCode()).setData(sessions);
......
...@@ -29,7 +29,7 @@ public class StaffServiceImpl implements StaffService { ...@@ -29,7 +29,7 @@ public class StaffServiceImpl implements StaffService {
public StaffSocketInfo getIdleStaff(Long merchantId, Long userId) { public StaffSocketInfo getIdleStaff(Long merchantId, Long userId) {
final Map<Long, StaffSocketInfo> socketInfoMap = channelGroup.STAFF_GROUP.get(merchantId); final Map<Long, StaffSocketInfo> socketInfoMap = channelGroup.STAFF_GROUP.get(merchantId);
if (socketInfoMap == null) { if (socketInfoMap.size() == 0) {
return null; return null;
} }
final LinkedHashMap<Long, StaffSocketInfo> collect = socketInfoMap final LinkedHashMap<Long, StaffSocketInfo> collect = socketInfoMap
......
...@@ -216,10 +216,13 @@ public class UserSingleChatServiceImpl implements ChatService { ...@@ -216,10 +216,13 @@ public class UserSingleChatServiceImpl implements ChatService {
private void broadcastUserOnline(Long userId) { private void broadcastUserOnline(Long userId) {
final Map staffIds = channelGroup.USER_GROUP.get(userId).getStaffIds(); final Map staffIds = channelGroup.USER_GROUP.get(userId).getStaffIds();
staffIds.forEach((merchantId, staffId) -> { staffIds.forEach((merchantId, staffId) -> {
channelGroup.STAFF_GROUP.get(Long.valueOf(merchantId.toString())).values().forEach(staffSocketInfo -> { final Map<Long, StaffSocketInfo> staffSocketInfoMap = channelGroup.STAFF_GROUP.get(Long.valueOf(merchantId.toString()));
staffSocketInfo.getUserIds().remove(userId); if (staffSocketInfoMap != null) {
staffSocketInfo.writeAndFlush(new MsgBody<>().setCode(MsgBody.USERS_ONLINE).setData(new IdModel().setStaffId(Long.valueOf(staffId.toString())).setUserId(userId))); staffSocketInfoMap.values().forEach(staffSocketInfo -> {
}); staffSocketInfo.getUserIds().remove(userId);
staffSocketInfo.writeAndFlush(new MsgBody<>().setCode(MsgBody.USERS_ONLINE).setData(new IdModel().setStaffId(Long.valueOf(staffId.toString())).setUserId(userId)));
});
}
}); });
} }
......
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