Browse Source

add:遥控函数添加

zhongwei
haungxing 6 months ago
parent
commit
8a172849be
  1. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/constants/FuncRouteEnum.java
  2. 2
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/interactive/service/impl/ExtraResolveStrategyService.java
  3. 13
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java

2
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;

2
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<DeviceInstanceFuncVO> funcVOR = deviceClient.getFuncById(remoteParam.getFuncId());
if(funcVOR.isSuccess()) {
Map<String,Object> param = new HashMap(1);

13
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));
}

Loading…
Cancel
Save