增加U3d同步协议

This commit is contained in:
wulin 2023-10-10 19:15:26 +08:00
parent 989f0a723b
commit 577fe18c21
5 changed files with 94 additions and 7 deletions

View File

@ -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;}
}

View File

@ -0,0 +1,52 @@
package com.qiuguo.iot.data.resp.u3d;
import lombok.Data;
/**
* 与U3D通过MQ交互信息
*/
@Data
public class U3dMsg {
/**
* 消息类型0跳舞 1 换装 2口型 100IOT
*/
private Integer msgType;
/**
* msgType=013时数字人IDmsgType=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;
}

View File

@ -14,7 +14,7 @@ public class SystemTalkKeyAndDeviceName {
int index;
/**
* 类型 0 系统自定义关键字 1 用户设备名称
* 类型 0 系统自定义名称关键字 1 用户设备名称 2 系统自定义动词
*/
Integer type;
}

View File

@ -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()));
}
}
}

View File

@ -59,7 +59,7 @@ public class MysqlMain {
}
List<TablesBean> list = new ArrayList<>();
list.add(new TablesBean("device_user_bind"));
list.add(new TablesBean("system_address"));
//list.add(new TablesBean("system_same_talk"));
List<TablesBean> list2 = new ArrayList<TablesBean>();