From 7d17ebfd987bb684aa7c8bfe186b098dcc7c849d Mon Sep 17 00:00:00 2001 From: wulin Date: Mon, 30 Oct 2023 14:56:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E5=8F=B2=E6=80=BB=E8=B7=B3?= =?UTF-8?q?=E8=88=9E=E6=8C=87=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/command/U3DActionCommand.java | 21 ++++++++++++++----- .../api/controller/WebsocketController.java | 16 ++++++++++++++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/command/U3DActionCommand.java b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/command/U3DActionCommand.java index fe54c0e..31663f8 100644 --- a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/command/U3DActionCommand.java +++ b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/command/U3DActionCommand.java @@ -43,12 +43,23 @@ public class U3DActionCommand extends ActionCommand implements IActionCommand{ //数字人的id直接用用户id来代替 if(U3dMsgTypeEnum.DANCE.getCode().equals(systemTalkBindU3d.getU3dType())){ //推送客户端跳舞 + BoxMessageResp resp = new BoxMessageResp(); - resp.setType(AskTypeEnum.U3D.getCode()); - resp.setText("开始跳舞"); - ActionResp actionResp = new ActionResp(); - actionResp.setType(7); - resp.setAction(actionResp); + if(baseSession.getUserId().equals(1291978L)){ + resp.setType(AskTypeEnum.TTS.getCode()); + resp.setText("抱歉,我还么学会跳舞"); + /*ActionResp actionResp = new ActionResp(); + actionResp.setType(7); + resp.setAction(actionResp);*/ + }else{ + resp.setType(AskTypeEnum.U3D.getCode()); + resp.setText("开始跳舞"); + ActionResp actionResp = new ActionResp(); + actionResp.setType(7); + resp.setAction(actionResp); + } + + return baseWebSocketService.sendMessage(action, baseSession, resp); }else{ //推送MQ换装 diff --git a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/controller/WebsocketController.java b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/controller/WebsocketController.java index 823feff..6ad4860 100644 --- a/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/controller/WebsocketController.java +++ b/iot-modules/iot-box-websocket-api/src/main/java/com/qiuguo/iot/box/websocket/api/controller/WebsocketController.java @@ -11,9 +11,11 @@ import com.qiuguo.iot.base.utils.StringUtils; import com.qiuguo.iot.box.websocket.api.domain.box.BoxSession; import com.qiuguo.iot.box.websocket.api.service.BaseWebSocketService; import com.qiuguo.iot.box.websocket.api.service.WebsocketService; +import com.qiuguo.iot.data.constants.YunxiRabbitConst; import com.qiuguo.iot.data.entity.device.DeviceInfoEntity; import com.qiuguo.iot.data.request.device.DeviceInfoRequest; import com.qiuguo.iot.data.service.device.DeviceInfoService; +import com.qiuguo.iot.data.service.mq.MqService; import com.qiuguo.iot.data.service.system.SystemTalkAnswerConfigService; import com.qiuguo.iot.third.nlp.Nlp; import com.qiuguo.iot.third.service.LacNlpService; @@ -63,6 +65,9 @@ public class WebsocketController { @Value("${Ali.accesskeySecret}") private String aliAccessSecret; + @Resource + MqService mqService; + @GetMapping("/push/message") public Mono pushMessage(@RequestParam String message, @RequestParam String id, @RequestParam Integer type) { @@ -83,6 +88,17 @@ public class WebsocketController { } + @GetMapping("/mq/test") + public Mono sysTalkAnswer(@RequestParam String value) { + return mqService.sendMessageWithConfirmation(YunxiRabbitConst.EXCHANGE_YUNXI_EVENT, + "U3D.TO", + value, + 2).flatMap(b -> { + return Mono.just("测试MQ发送" + b); + }); + + } + @GetMapping("/test/nlp") public Mono nlp(@RequestParam String value, @RequestParam String type) {