rn content; ? } ? return content.substring(0, content.lastIndexOf("&")); ?} ? ?/** ? * 获取发送人信息 ? * @param content String ? * @return String ? */ ?private String getToUserName(String content) { ? if (!AssertUtil.hasValue(content)) { ? ?return null; ? } ? if (!content.contains("&")) { ? ?return null; ? } ? return content.substring(content.lastIndexOf("&")+1, content.length()); ?} ? ?/** ? * 链接打开之后将开发人员添加到回话池中 ? * @param session ? */ ?@OnOpen ?public void onOpen(Session session) { ? String poolId = this.getPoolId(session); ? if (AssertUtil.hasValue(poolId)) { ? ?WebChatPool.add(poolId, session.getId(), session); ? } ?} ? ?@OnClose ?public void onClose(Session session) { ? String poolId = this.getPoolId(session); ? if (AssertUtil.hasValue(poolId)) { ? ?WebChatPool.remvoe(poolId, session.getId()); ? } ?} ? ? ?/** ? * 当前会话池ID ? * @param session ? * @return ? */ ?private String getPoolId(Session session) { ? Map> paramMap = session.getRequestParameterMap(); ? if (AssertUtil.hasValue(paramMap)) { ? ?List wx101IdList = paramMap.get("wx101id"); ? ?if (AssertUtil.hasValue(wx101IdList)) { ? ? return wx101IdList.get(0); ? ?} ? } ? return null; ?} }
|