From 8a172849bead5048a686b01e6b6f9c6862148807 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 21 May 2024 15:25:26 +0800 Subject: [PATCH] =?UTF-8?q?add:=E9=81=A5=E6=8E=A7=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/bigmodel/interactive/constants/FuncRouteEnum.java | 2 +- .../service/impl/ExtraResolveStrategyService.java | 2 +- .../bigmodel/websocket/handler/InteractiveHandler.java | 13 +++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java index 174df24..46887e8 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java @@ -19,7 +19,7 @@ public enum FuncRouteEnum { CHOOSE_VIDEO("choose_video","选择视频",null), CHOOSE_CANVAS("choose_canvas","选择画面",null), CHOOSE_FAULT("choose_fault","选择故障",null), - CONFIRM_YK("confirm_yk","遥控确认", FunctionConstants.TypeEnum.CONFIRM), + CONFIRM_YK("confirm_yk","遥控确认", FunctionConstants.TypeEnum.PARAMS), ; @Getter private String funcCode; diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java index c464e05..a9c63a6 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java @@ -81,7 +81,7 @@ public class ExtraResolveStrategyService { ExtraVO result = new ExtraVO(); RemoteParamVO remoteParam = JSONObject.parseObject(JSON.toJSONString(extra.get("data")), RemoteParamVO.class); result.setFuncCode(FuncRouteEnum.CONFIRM_YK.getFuncCode()); - result.setType(FunctionConstants.TypeEnum.CONFIRM.getType()); + result.setType(FuncRouteEnum.CONFIRM_YK.getType().getType()); R funcVOR = deviceClient.getFuncById(remoteParam.getFuncId()); if(funcVOR.isSuccess()) { Map param = new HashMap(1); diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java index 0f3d200..23b8d2e 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java @@ -12,11 +12,16 @@ import com.hnac.hzims.bigmodel.interactive.service.IInteractiveService; import com.hnac.hzims.bigmodel.websocket.constants.RedisKeyConstants; import com.hnac.hzims.bigmodel.websocket.service.InteractiveWsService; import com.hnac.hzims.bigmodel.websocket.sessionManager.InteractiveSessionManager; +import lombok.AllArgsConstructor; +import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.SpringUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Component; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketSession; @@ -33,7 +38,12 @@ import java.util.function.Function; * @Date: 2024/04/28 13:45 */ @Slf4j +@Component public class InteractiveHandler extends TextWebSocketHandler { + + @Autowired + private RedisTemplate redisTemplate; + @Override public void afterConnectionEstablished(WebSocketSession session) { String[] split = session.getUri().toString().split("/"); @@ -67,9 +77,8 @@ public class InteractiveHandler extends TextWebSocketHandler { } } else { String sessionId = InteractiveSessionManager.getEntryBySession(session).getKey(); - if(Func.isNotEmpty(messageJSON.containsKey("content"))) { + if(messageJSON.containsKey("content")) { // 将发送参数存入redis - RedisTemplate redisTemplate = SpringUtil.getBean(RedisTemplate.class); redisTemplate.expire(RedisKeyConstants.SESSION_CONTENT_KEY,30, TimeUnit.MINUTES); redisTemplate.opsForHash().put(RedisKeyConstants.SESSION_CONTENT_KEY,sessionId,messageJSON.getObject("content", SessionContentVO.class)); }