Browse Source

fix:完善问题选项问题解析

zhongwei
haungxing 7 months ago
parent
commit
d89c8cd5a0
  1. 18
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java

18
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/websocket/handler/InteractiveHandler.java

@ -18,6 +18,7 @@ import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
@ -67,9 +68,9 @@ public class InteractiveHandler extends TextWebSocketHandler {
private void handleMessage(JSONObject messageContext,String sessionId) {
Boolean isSpecial = messageContext.getBoolean("isSpecial");
if(Func.isEmpty(isSpecial) || !isSpecial) {
String context = messageContext.getString("context");
String userId = messageContext.getString("userId");
if(Func.isEmpty(isSpecial) || !isSpecial) {
IInteractiveService interactiveService = SpringUtil.getBean(IInteractiveService.class);
R askResult = interactiveService.ask(context, sessionId, userId);
log.info("返回结果为:"+ JSON.toJSONString(askResult));
@ -79,7 +80,7 @@ public class InteractiveHandler extends TextWebSocketHandler {
FuncRouteEnum funcEnum = FuncRouteEnum.getEnumByFuncCode(funcCode);
switch (funcEnum) {
case CHOOSE_STATION:
this.handleChooseStation(messageContext);
this.handleChooseStation(messageContext,sessionId);
break;
default:
break;
@ -87,8 +88,17 @@ public class InteractiveHandler extends TextWebSocketHandler {
}
}
private void handleChooseStation(JSONObject messageContext) {
private void handleChooseStation(JSONObject messageContext,String sessionId) {
IInteractiveService interactiveService = SpringUtil.getBean(IInteractiveService.class);
String userId = messageContext.getString("userId");
String funcCode = messageContext.getString("funcCode");
StationSelectionVO selectionVO = messageContext.getObject("selection",StationSelectionVO.class);
JSONObject data = new JSONObject();
data.put("station_id",selectionVO.getId());
data.put("station_name",selectionVO.getName());
Map<String, Object> extra = new HashMap<>(2);
extra.put("func",funcCode);
extra.put("data",data);
interactiveService.specialAsk(sessionId,userId,extra);
}
}

Loading…
Cancel
Save