增加跳舞推送客户端
This commit is contained in:
parent
ffa401c6e9
commit
d17b974c74
@ -13,6 +13,7 @@ public enum AskTypeEnum {
|
|||||||
|
|
||||||
U3D(4, "U3D动作"),
|
U3D(4, "U3D动作"),
|
||||||
MUSIC(5, "音乐,声音"),
|
MUSIC(5, "音乐,声音"),
|
||||||
|
TIME(6, "询问时间"),
|
||||||
|
|
||||||
UPDATE(100, "固件升级"),
|
UPDATE(100, "固件升级"),
|
||||||
BOX_ON_LINE(101, "Box配网成功"),
|
BOX_ON_LINE(101, "Box配网成功"),
|
||||||
|
|||||||
@ -69,7 +69,7 @@ public class SystemTalkAnswerConfigEntity extends GenericEntity<Long> {
|
|||||||
@Column(name = "key_order", nullable = false)
|
@Column(name = "key_order", nullable = false)
|
||||||
private Long keyOrder;
|
private Long keyOrder;
|
||||||
|
|
||||||
@Comment("回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 400:全部,所有,一切忽略词")
|
@Comment("回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 400:全部,所有,一切忽略词")
|
||||||
@Column(name = "answer_type", nullable = false)
|
@Column(name = "answer_type", nullable = false)
|
||||||
private Integer answerType;
|
private Integer answerType;
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ public class SystemTalkAnswerConfigRequest implements java.io.Serializable {
|
|||||||
//关键字的排序,越小越第一个匹配上
|
//关键字的排序,越小越第一个匹配上
|
||||||
private Long keyOrder;
|
private Long keyOrder;
|
||||||
|
|
||||||
//回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 400:全部,所有,一切忽略词
|
//回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 400:全部,所有,一切忽略词
|
||||||
private Integer answerType;
|
private Integer answerType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public class SystemTalkAnswerConfigResp {
|
|||||||
//关键字的排序,越小越第一个匹配上
|
//关键字的排序,越小越第一个匹配上
|
||||||
private Long keyOrder;
|
private Long keyOrder;
|
||||||
|
|
||||||
//回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 400:全部,所有,一切忽略词
|
//回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 400:全部,所有,一切忽略词
|
||||||
private Integer answerType;
|
private Integer answerType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -416,7 +416,18 @@ public enum ChinesePartSpeechEnum implements IChinesePartSpeech{
|
|||||||
List<SystemTalkAnswerConfigEntity> systemTalkAnswerConfigEntities,
|
List<SystemTalkAnswerConfigEntity> systemTalkAnswerConfigEntities,
|
||||||
List<DeviceUserBindEntity> includs,
|
List<DeviceUserBindEntity> includs,
|
||||||
List<SystemTalkAnswerConfigEntity> commands){
|
List<SystemTalkAnswerConfigEntity> commands){
|
||||||
action.setStatus(key);
|
SystemTalkAnswerConfigEntity entity = getSystemTalkWithKey(actions.getName(), keyGroup);
|
||||||
|
if(entity != null){
|
||||||
|
if(!entity.getAnswerType().equals(AskTypeEnum.COMMAND_N.getCode())){
|
||||||
|
systemTalkAnswerConfigEntities.add(entity);
|
||||||
|
actions.setA(1);//a = 1;
|
||||||
|
}else{
|
||||||
|
log.info("COMMAND_N自定义指令");
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
action.setStatus(key);
|
||||||
|
}
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -22,7 +22,11 @@ public class ActionTime {
|
|||||||
/**
|
/**
|
||||||
* 解析后的具体日期 yyyy-MM-dd HH:mm:ss
|
* 解析后的具体日期 yyyy-MM-dd HH:mm:ss
|
||||||
*/
|
*/
|
||||||
private String dateDetailTime;//
|
private String dateDetailTime;
|
||||||
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime detailTime;
|
||||||
|
|
||||||
public void setTime(String t){
|
public void setTime(String t){
|
||||||
LocalDateTime localDateTime;
|
LocalDateTime localDateTime;
|
||||||
@ -45,10 +49,10 @@ public class ActionTime {
|
|||||||
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
DateTimeFormatter df1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
DateTimeFormatter df1 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
localDateTime = DateEnum.getWithCode(t).getDateTime(localDateTime);
|
localDateTime = DateEnum.getWithCode(t).getDateTime(localDateTime);
|
||||||
|
detailTime = localDateTime;
|
||||||
dateTime = localDateTime.format(df);
|
dateTime = localDateTime.format(df);
|
||||||
dateDetailTime = localDateTime.format(df1);
|
dateDetailTime = localDateTime.format(df1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package com.qiuguo.iot.box.websocket.api.domain;
|
package com.qiuguo.iot.box.websocket.api.domain;
|
||||||
|
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.box.resp.ActionResp;
|
|
||||||
import com.qiuguo.iot.data.resp.third.MusicResp;
|
import com.qiuguo.iot.data.resp.third.MusicResp;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +1,23 @@
|
|||||||
package com.qiuguo.iot.box.websocket.api.domain.box.resp;
|
package com.qiuguo.iot.box.websocket.api.domain.box.resp;
|
||||||
|
|
||||||
import com.qiuguo.iot.data.resp.third.MusicResp;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
@Data
|
||||||
public class ActionResp {
|
public class ActionResp {
|
||||||
|
/**
|
||||||
|
* 闹钟类型0,一次闹钟 1 重复闹钟 7跳舞
|
||||||
|
*/
|
||||||
Integer type;
|
Integer type;
|
||||||
Date time;
|
/**
|
||||||
|
* 时间
|
||||||
|
*/
|
||||||
|
String time;
|
||||||
|
/**
|
||||||
|
* 声音地址
|
||||||
|
*/
|
||||||
String sound;
|
String sound;
|
||||||
|
/**
|
||||||
String image;//圖片地址
|
* 图片地址
|
||||||
String action;//動作内容 json
|
*/
|
||||||
|
String image;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package com.qiuguo.iot.box.websocket.api.domain.user;
|
package com.qiuguo.iot.box.websocket.api.domain.user;
|
||||||
|
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.BaseMessageResp;
|
import com.qiuguo.iot.box.websocket.api.domain.BaseMessageResp;
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.box.resp.ActionResp;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import com.qiuguo.iot.base.enums.*;
|
|||||||
import com.qiuguo.iot.base.utils.StringUtils;
|
import com.qiuguo.iot.base.utils.StringUtils;
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.BaseSession;
|
import com.qiuguo.iot.box.websocket.api.domain.BaseSession;
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.box.BoxSession;
|
import com.qiuguo.iot.box.websocket.api.domain.box.BoxSession;
|
||||||
|
import com.qiuguo.iot.box.websocket.api.domain.box.resp.ActionResp;
|
||||||
import com.qiuguo.iot.box.websocket.api.domain.box.resp.BoxMessageResp;
|
import com.qiuguo.iot.box.websocket.api.domain.box.resp.BoxMessageResp;
|
||||||
import com.qiuguo.iot.data.constants.YunxiRabbitConst;
|
import com.qiuguo.iot.data.constants.YunxiRabbitConst;
|
||||||
import com.qiuguo.iot.data.entity.device.DeviceUserBindEntity;
|
import com.qiuguo.iot.data.entity.device.DeviceUserBindEntity;
|
||||||
@ -41,6 +42,7 @@ import reactor.core.publisher.Mono;
|
|||||||
import reactor.core.scheduler.Schedulers;
|
import reactor.core.scheduler.Schedulers;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@ -158,7 +160,7 @@ public class BaseWebSocketProcess {
|
|||||||
talkRecord.setDeviceId(baseSession.getDeviceId());
|
talkRecord.setDeviceId(baseSession.getDeviceId());
|
||||||
deviceUserTalkRecordService.insertDeviceUserTalkRecord(talkRecord).subscribe();
|
deviceUserTalkRecordService.insertDeviceUserTalkRecord(talkRecord).subscribe();
|
||||||
}else{
|
}else{
|
||||||
sendMessage(action, baseSession, "很抱歉,我无法回答您的问题,请换一个问题。 目前没任何回复", AskTypeEnum.TTS.getCode());
|
sendMessage(action, baseSession, "很抱歉,我无法回答您的问题,请换一个问题。", AskTypeEnum.TTS.getCode());
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}).subscribeOn(Schedulers.boundedElastic()).subscribe();
|
}).subscribeOn(Schedulers.boundedElastic()).subscribe();
|
||||||
@ -386,6 +388,9 @@ public class BaseWebSocketProcess {
|
|||||||
|
|
||||||
}else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.QIU_GUO.getCode())){
|
}else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.QIU_GUO.getCode())){
|
||||||
sendMessage(action, baseSession, action.getSystemTalkAnswerConfigEntity().getAnswerValue(), AskTypeEnum.TTS.getCode());
|
sendMessage(action, baseSession, action.getSystemTalkAnswerConfigEntity().getAnswerValue(), AskTypeEnum.TTS.getCode());
|
||||||
|
}else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.TIME.getCode())){
|
||||||
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy年M月d日 H时m分 星期E");
|
||||||
|
sendMessage(action, baseSession, action.getTime().getDetailTime().format(df), AskTypeEnum.TTS.getCode());
|
||||||
}else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.U3D.getCode())){
|
}else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.U3D.getCode())){
|
||||||
systemTalkBindU3dService.selectSystemTalkBindU3dBySystemTalkId(action.getSystemTalkAnswerConfigEntity().getId())
|
systemTalkBindU3dService.selectSystemTalkBindU3dBySystemTalkId(action.getSystemTalkAnswerConfigEntity().getId())
|
||||||
.defaultIfEmpty(new SystemTalkBindU3dEntity())
|
.defaultIfEmpty(new SystemTalkBindU3dEntity())
|
||||||
@ -395,9 +400,22 @@ public class BaseWebSocketProcess {
|
|||||||
return systemTalkBindU3d;
|
return systemTalkBindU3d;
|
||||||
}
|
}
|
||||||
//数字人的id直接用用户id来代替
|
//数字人的id直接用用户id来代替
|
||||||
toU3DMq(action, systemTalkBindU3d, baseSession.getUserId());
|
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);
|
||||||
|
sendMessage(action, baseSession, resp);
|
||||||
|
}else{
|
||||||
|
//推送MQ换装
|
||||||
|
toU3DMq(action, systemTalkBindU3d, baseSession.getUserId());
|
||||||
|
}
|
||||||
|
|
||||||
return systemTalkBindU3d;
|
return systemTalkBindU3d;
|
||||||
});
|
}).subscribe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user