From 577fe18c211294b04f3a01b5eb5fdb102f6f147c Mon Sep 17 00:00:00 2001 From: wulin Date: Tue, 10 Oct 2023 19:15:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0U3d=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qiuguo/iot/base/enums/KeyTypeEnum.java | 22 ++++++++ .../com/qiuguo/iot/data/resp/u3d/U3dMsg.java | 52 +++++++++++++++++++ .../entity/SystemTalkKeyAndDeviceName.java | 2 +- .../qiuguo/iot/third/service/NlpService.java | 23 ++++++-- .../customer/http/api/mysql/MysqlMain.java | 2 +- 5 files changed, 94 insertions(+), 7 deletions(-) create mode 100644 iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/KeyTypeEnum.java create mode 100644 iot-common/iot-data/src/main/java/com/qiuguo/iot/data/resp/u3d/U3dMsg.java diff --git a/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/KeyTypeEnum.java b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/KeyTypeEnum.java new file mode 100644 index 0000000..c2c4dd4 --- /dev/null +++ b/iot-common/iot-base/src/main/java/com/qiuguo/iot/base/enums/KeyTypeEnum.java @@ -0,0 +1,22 @@ +package com.qiuguo.iot.base.enums; + +/* +* 关键字梅举 +* 作者:吴林 +* */ +public enum KeyTypeEnum { + SYSTEM_COMMAND(0, "系统自定义名称关键字"), + USER_BIND_NAME(1, "用户绑定的设备名称"), + SYSTEM_ACTION(2, "系统自定义动作动词"), + ; + KeyTypeEnum(Integer c, String n){ + code = c; + name = n; + } + private Integer code; + private String name; + + public Integer getCode() {return code;} + + public String getName() {return name;} +} diff --git a/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/resp/u3d/U3dMsg.java b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/resp/u3d/U3dMsg.java new file mode 100644 index 0000000..f66164d --- /dev/null +++ b/iot-common/iot-data/src/main/java/com/qiuguo/iot/data/resp/u3d/U3dMsg.java @@ -0,0 +1,52 @@ +package com.qiuguo.iot.data.resp.u3d; + +import lombok.Data; + +/** + * 与U3D通过MQ交互信息 + */ +@Data +public class U3dMsg { + /** + * 消息类型:0:跳舞 1 :换装 2:口型 100:IOT + */ + private Integer msgType; + + /** + * msgType=0,1,3时数字人ID,msgType=3时设备所在虚拟世界ID + */ + private Long metaId; + + /** + * 状态ID + */ + private Long statusId; + + /** + * 场景ID + */ + private Long scenceId; + + /** + * 类型ID + */ + private Long typeId; + + /** + * 坐标x + */ + String x; + /** + * 坐标y + */ + String y; + + /** + * 坐标z + */ + String z; + /** + * 发送时间 + */ + Long time; +} diff --git a/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/nlp/entity/SystemTalkKeyAndDeviceName.java b/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/nlp/entity/SystemTalkKeyAndDeviceName.java index 773ed84..eb99cda 100644 --- a/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/nlp/entity/SystemTalkKeyAndDeviceName.java +++ b/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/nlp/entity/SystemTalkKeyAndDeviceName.java @@ -14,7 +14,7 @@ public class SystemTalkKeyAndDeviceName { int index; /** - * 类型 0 系统自定义关键字 1 用户设备名称 + * 类型 0 系统自定义名称关键字 1 用户设备名称 2 系统自定义动词 */ Integer type; } diff --git a/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/service/NlpService.java b/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/service/NlpService.java index fbb4e39..d667e1e 100644 --- a/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/service/NlpService.java +++ b/iot-common/iot-third/src/main/java/com/qiuguo/iot/third/service/NlpService.java @@ -1,5 +1,6 @@ package com.qiuguo.iot.third.service; +import com.qiuguo.iot.base.enums.KeyTypeEnum; import com.qiuguo.iot.base.enums.YesNo; import com.qiuguo.iot.third.enums.ChinesePartSpeechEnum; import com.qiuguo.iot.base.enums.DeviceTypeEnum; @@ -58,16 +59,25 @@ public class NlpService { for(SystemTalkAnswerConfigEntity entity : systemTalkAnswerConfigService.getCommandList()){ SystemTalkKeyAndDeviceName systemTalkKeyAndDeviceName = new SystemTalkKeyAndDeviceName(); systemTalkKeyAndDeviceName.setKey(entity.getAskKey()); - systemTalkKeyAndDeviceName.setType(0); + systemTalkKeyAndDeviceName.setType(KeyTypeEnum.SYSTEM_COMMAND.getCode()); systemTalkKeyAndDeviceName.setIndex(i++); systemTalkKeyAndDeviceNameList.add(systemTalkKeyAndDeviceName); } + /*i = 0; + for(SystemTalkAnswerConfigEntity entity : systemTalkAnswerConfigService.getSystemTalkWithKeyGroup().values()){ + SystemTalkKeyAndDeviceName systemTalkKeyAndDeviceName = new SystemTalkKeyAndDeviceName(); + systemTalkKeyAndDeviceName.setKey(entity.getAskKey()); + systemTalkKeyAndDeviceName.setType(KeyTypeEnum.SYSTEM_ACTION.getCode()); + systemTalkKeyAndDeviceName.setIndex(i++); + systemTalkKeyAndDeviceNameList.add(systemTalkKeyAndDeviceName); + }*/ + i = 0; for(DeviceUserBindEntity entity : deviceUserBindEntityPagerResult.getData()){ SystemTalkKeyAndDeviceName systemTalkKeyAndDeviceName = new SystemTalkKeyAndDeviceName(); systemTalkKeyAndDeviceName.setKey(entity.getBindName()); - systemTalkKeyAndDeviceName.setType(1); + systemTalkKeyAndDeviceName.setType(KeyTypeEnum.USER_BIND_NAME.getCode()); systemTalkKeyAndDeviceName.setIndex(i++); systemTalkKeyAndDeviceNameList.add(systemTalkKeyAndDeviceName); } @@ -82,15 +92,18 @@ public class NlpService { for(SystemTalkKeyAndDeviceName sysTalkKeyAndDeviceName :systemTalkKeyAndDeviceNameList){ if(pText.indexOf(sysTalkKeyAndDeviceName.getKey()) >= 0){ //找到对应的名称 - if(sysTalkKeyAndDeviceName.getType().equals(YesNo.YES.getCode())){ + if(sysTalkKeyAndDeviceName.getType().equals(KeyTypeEnum.USER_BIND_NAME.getCode())){ //用户绑定设备名称 pText = pText.replace(sysTalkKeyAndDeviceName.getKey(), ">" + (i++) + ">"); includs.add(deviceUserBindEntityPagerResult.getData().get(sysTalkKeyAndDeviceName.getIndex())); - }else{ + }else if(sysTalkKeyAndDeviceName.getType().equals(KeyTypeEnum.SYSTEM_COMMAND.getCode())){ //是系统自定义动词后的名称 pText = pText.replace(sysTalkKeyAndDeviceName.getKey(), "#" + (j++) + "#"); commands.add(systemTalkAnswerConfigService.getCommandList().get(sysTalkKeyAndDeviceName.getIndex())); - + }else{ + //系统自定义动作 + pText = pText.replace(sysTalkKeyAndDeviceName.getKey(), "<" + (j++) + "<"); + commands.add(systemTalkAnswerConfigService.getCommandList().get(sysTalkKeyAndDeviceName.getIndex())); } } } diff --git a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlMain.java b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlMain.java index 18fa023..8faf9f7 100644 --- a/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlMain.java +++ b/iot-modules/iot-customer-http-api/src/test/java/com/qiuguo/iot/customer/http/api/mysql/MysqlMain.java @@ -59,7 +59,7 @@ public class MysqlMain { } List list = new ArrayList<>(); - list.add(new TablesBean("device_user_bind")); + list.add(new TablesBean("system_address")); //list.add(new TablesBean("system_same_talk")); List list2 = new ArrayList();