From 090de658ffe5a2c68bf2d11e24ee43b06d8fa1d2 Mon Sep 17 00:00:00 2001 From: wanggeng <450292408@qq.com> Date: Wed, 8 Dec 2021 11:57:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8D=8E=E4=B8=BA=E8=9E=8D?= =?UTF-8?q?=E5=90=88=E9=80=9A=E4=BF=A1=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../websocket/WebSocketCustomTypeEnum.java | 3 +- .../WebSocketTextCustomServiceImpl.java | 31 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) 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); } } }