diff --git a/src/main/java/cn/com/tenlion/usercenter/enums/websocket/WebSocketCustomTypeEnum.java b/src/main/java/cn/com/tenlion/usercenter/enums/websocket/WebSocketCustomTypeEnum.java index edb7da9..386364e 100644 --- a/src/main/java/cn/com/tenlion/usercenter/enums/websocket/WebSocketCustomTypeEnum.java +++ b/src/main/java/cn/com/tenlion/usercenter/enums/websocket/WebSocketCustomTypeEnum.java @@ -13,7 +13,8 @@ public enum WebSocketCustomTypeEnum { HUAWEI_RTC_CALL(11002, "华为实时通讯呼叫"), HUAWEI_RTC_CALL_LOGIN_SUCCESS(11201, "华为实时通讯呼叫登录成功"), HUAWEI_RTC_CALL_NOT_SUPPORTED(11401, "华为实时通讯呼叫不支持"), - HUAWEI_RTC_CALL_LOGIN_FAILED(11402, "华为实时通讯呼叫登录失败"); + HUAWEI_RTC_CALL_LOGIN_FAILED(11402, "华为实时通讯呼叫登录失败"), + HUAWEI_RTC_EXIT_LOGIN(11403, "退出登录"); private int value; private String summary; diff --git a/src/main/java/cn/com/tenlion/usercenter/service/websocket/WebSocketTextCustomServiceImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/websocket/WebSocketTextCustomServiceImpl.java index 8dba15b..64ba011 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/websocket/WebSocketTextCustomServiceImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/websocket/WebSocketTextCustomServiceImpl.java @@ -1,12 +1,11 @@ package cn.com.tenlion.usercenter.service.websocket; import cn.com.tenlion.usercenter.enums.websocket.WebSocketCustomTypeEnum; -import cn.com.tenlion.usercenter.service.userrealtimelocation.IUserRealtimeLocationService; import cn.com.tenlion.usercenter.service.huaweirtc.IHuaweiRtcService; +import cn.com.tenlion.usercenter.service.userrealtimelocation.IUserRealtimeLocationService; import com.alibaba.fastjson.JSONObject; import ink.wgink.common.base.DefaultBaseService; import ink.wgink.exceptions.websocket.BaseSocketException; -import ink.wgink.exceptions.websocket.CustomHandleException; import ink.wgink.module.instantmessage.service.IWebSocketTextCustomService; import ink.wgink.module.instantmessage.websocket.pojo.WebSocketClientMessage; import ink.wgink.module.map.pojo.vos.userlocation.UserLocationVO; @@ -31,21 +30,19 @@ public class WebSocketTextCustomServiceImpl extends DefaultBaseService implement @Override public void handle(Channel fromChannel, WebSocketClientMessage webSocketClientMessage) throws BaseSocketException { - try { - if (WebSocketCustomTypeEnum.LOCATION_REALTIME.getValue() == webSocketClientMessage.getType()) { - UserLocationVO userLocationVO = JSONObject.parseObject(webSocketClientMessage.getBody(), UserLocationVO.class); - userRealtimeLocationService.save(userLocationVO); - } else if (WebSocketCustomTypeEnum.HUAWEI_RTC_CALL.getValue() == webSocketClientMessage.getType()) { - huaweiRtcService.rtcCall(webSocketClientMessage); - } else if (WebSocketCustomTypeEnum.HUAWEI_RTC_CALL_LOGIN_SUCCESS.getValue() == webSocketClientMessage.getType()) { - huaweiRtcService.rtcCall(webSocketClientMessage); - } else if (WebSocketCustomTypeEnum.HUAWEI_RTC_CALL_LOGIN_FAILED.getValue() == webSocketClientMessage.getType()) { - huaweiRtcService.rtcCall(webSocketClientMessage); - } else if (WebSocketCustomTypeEnum.HUAWEI_RTC_CALL_NOT_SUPPORTED.getValue() == webSocketClientMessage.getType()) { - huaweiRtcService.rtcCall(webSocketClientMessage); - } - } catch (Exception e) { - throw new CustomHandleException(e.getMessage(), e); + if (WebSocketCustomTypeEnum.LOCATION_REALTIME.getValue() == webSocketClientMessage.getType()) { + UserLocationVO userLocationVO = JSONObject.parseObject(webSocketClientMessage.getBody(), UserLocationVO.class); + userRealtimeLocationService.save(userLocationVO); + } else if (WebSocketCustomTypeEnum.HUAWEI_RTC_CALL.getValue() == webSocketClientMessage.getType()) { + huaweiRtcService.rtcCall(webSocketClientMessage); + } else if (WebSocketCustomTypeEnum.HUAWEI_RTC_CALL_LOGIN_SUCCESS.getValue() == webSocketClientMessage.getType()) { + huaweiRtcService.rtcCall(webSocketClientMessage); + } else if (WebSocketCustomTypeEnum.HUAWEI_RTC_CALL_LOGIN_FAILED.getValue() == webSocketClientMessage.getType()) { + huaweiRtcService.rtcCall(webSocketClientMessage); + } else if (WebSocketCustomTypeEnum.HUAWEI_RTC_CALL_NOT_SUPPORTED.getValue() == webSocketClientMessage.getType()) { + huaweiRtcService.rtcCall(webSocketClientMessage); + } else if (WebSocketCustomTypeEnum.HUAWEI_RTC_EXIT_LOGIN.getValue() == webSocketClientMessage.getType()) { + huaweiRtcService.rtcCall(webSocketClientMessage); } } }