|
|
@ -6,6 +6,9 @@ import com.hnac.hzims.business.ws.alart.vo.AlartParamVo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springblade.core.tool.utils.ObjectUtil; |
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
import org.springblade.core.tool.utils.StringUtil; |
|
|
|
|
|
|
|
import org.springblade.system.feign.IDeptClient; |
|
|
|
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.web.socket.CloseStatus; |
|
|
|
import org.springframework.web.socket.CloseStatus; |
|
|
|
import org.springframework.web.socket.TextMessage; |
|
|
|
import org.springframework.web.socket.TextMessage; |
|
|
@ -31,13 +34,11 @@ public class AlarmHandler extends TextWebSocketHandler { |
|
|
|
session.getAttributes().put("userId", uid); |
|
|
|
session.getAttributes().put("userId", uid); |
|
|
|
log.info("sessionId: " + session.getId()); |
|
|
|
log.info("sessionId: " + session.getId()); |
|
|
|
log.info("session connection successful!"); |
|
|
|
log.info("session connection successful!"); |
|
|
|
AlarmSocketPool.pool.put(session.getId(), this); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) { |
|
|
|
public void afterConnectionClosed(WebSocketSession session, CloseStatus status) { |
|
|
|
AlarmSessionManager.removeAndClose(session.getId()); |
|
|
|
AlarmSessionManager.removeAndClose(session.getId()); |
|
|
|
AlarmSocketPool.pool.remove(session.getId()); |
|
|
|
|
|
|
|
log.info("sessionId: " + session.getId()); |
|
|
|
log.info("sessionId: " + session.getId()); |
|
|
|
log.info("uri: " + session.getUri()); |
|
|
|
log.info("uri: " + session.getUri()); |
|
|
|
log.info("session closed successful!"); |
|
|
|
log.info("session closed successful!"); |
|
|
@ -46,7 +47,6 @@ public class AlarmHandler extends TextWebSocketHandler { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void handleTransportError(WebSocketSession session, Throwable exception) { |
|
|
|
public void handleTransportError(WebSocketSession session, Throwable exception) { |
|
|
|
AlarmSessionManager.removeAndClose(session.getId()); |
|
|
|
AlarmSessionManager.removeAndClose(session.getId()); |
|
|
|
AlarmSocketPool.pool.remove(session.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|