播放音乐
This commit is contained in:
parent
e542f711e6
commit
d1aa9a6b54
@ -0,0 +1,24 @@
|
|||||||
|
package com.qiuguo.iot.base.enums;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 是否
|
||||||
|
* 作者:吴林
|
||||||
|
* */
|
||||||
|
// 播放音乐相关
|
||||||
|
public enum PlayEnum {
|
||||||
|
START(0),//开始
|
||||||
|
PASUE(1),//暂停
|
||||||
|
GO(2),//继续
|
||||||
|
STOP(3),//停止
|
||||||
|
|
||||||
|
NONE(10),//无此资源
|
||||||
|
;
|
||||||
|
PlayEnum(Integer c){
|
||||||
|
code = c;
|
||||||
|
}
|
||||||
|
private Integer code;
|
||||||
|
public Integer getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.qiuguo.iot.data.resp.third;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MusicResp {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 播放状态
|
||||||
|
* 0 开始播放 1 暂停 2 继续 3 停止 10无此资源
|
||||||
|
*/
|
||||||
|
Integer play;
|
||||||
|
/**
|
||||||
|
* 歌唱者
|
||||||
|
*/
|
||||||
|
String singer;
|
||||||
|
/**
|
||||||
|
* 音频文件
|
||||||
|
*/
|
||||||
|
String url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 歌词
|
||||||
|
*/
|
||||||
|
String lyric;
|
||||||
|
/**
|
||||||
|
* 歌名
|
||||||
|
*/
|
||||||
|
String name;
|
||||||
|
}
|
||||||
@ -18,8 +18,12 @@ public class Action {
|
|||||||
|
|
||||||
private ActionTime time;//具体时间
|
private ActionTime time;//具体时间
|
||||||
private List<String> lbs;//一些城市地狱名词
|
private List<String> lbs;//一些城市地狱名词
|
||||||
|
/**
|
||||||
|
* 人名
|
||||||
|
*/
|
||||||
|
private String pName;
|
||||||
|
|
||||||
/***
|
/**
|
||||||
* 原始记录话语
|
* 原始记录话语
|
||||||
*/
|
*/
|
||||||
private String ask;//原话
|
private String ask;//原话
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.qiuguo.iot.third.service;
|
|||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.qiuguo.iot.base.utils.WebClientUtils;
|
||||||
import com.qiuguo.iot.third.nlp.INlp;
|
import com.qiuguo.iot.third.nlp.INlp;
|
||||||
import com.qiuguo.iot.third.nlp.Nlp;
|
import com.qiuguo.iot.third.nlp.Nlp;
|
||||||
import com.qiuguo.iot.third.nlp.NlpKey;
|
import com.qiuguo.iot.third.nlp.NlpKey;
|
||||||
@ -32,23 +33,19 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;
|
|||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class LacNlpService implements INlp {
|
public class LacNlpService implements INlp {
|
||||||
private static WebClient webClient = WebClient.builder()
|
|
||||||
.defaultHeader(HttpHeaders.CONTENT_TYPE, APPLICATION_JSON_VALUE).build();
|
|
||||||
//免得注入没有相关配置报错
|
//免得注入没有相关配置报错
|
||||||
// @Value("${lac.url}")
|
// @Value("${lac.url}")
|
||||||
// private String url;
|
// private String url;
|
||||||
|
|
||||||
private Mono<JSONObject> getNlpFromLac(LacRequest request){
|
private Mono<JSONObject> getNlpFromLac(LacRequest request){
|
||||||
|
return WebClientUtils.post(SpringUtil.getProperty("lac.url") + "/predict/lac", (JSONObject) JSONObject.toJSON(request)).map(
|
||||||
return webClient.post().uri(SpringUtil.getProperty("lac.url") + "/predict/lac").bodyValue(JSONObject.toJSON(request))
|
jsonObject -> {
|
||||||
.retrieve()
|
if (!Objects.equals(jsonObject.getInteger("status"), 0)) {
|
||||||
.bodyToMono(JSONObject.class).doOnNext(res -> {
|
throw new RuntimeException(jsonObject.getString("info"));
|
||||||
if (!Objects.equals(res.getInteger("status"), 0)) {
|
|
||||||
throw new RuntimeException(res.getString("info"));
|
|
||||||
}
|
}
|
||||||
//log.info("", res);
|
return jsonObject;
|
||||||
//log.info("res{}", res.toString());
|
}
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -34,6 +34,13 @@ import static org.springframework.util.MimeTypeUtils.APPLICATION_JSON_VALUE;
|
|||||||
public class MusicService {
|
public class MusicService {
|
||||||
|
|
||||||
// 网易云音乐
|
// 网易云音乐
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param keyword 关键字
|
||||||
|
* @param type 1:歌名 100 歌手
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public Mono<List<SongInfoResponse.ResultSong>> searchMusic(String keyword, Integer type) {
|
public Mono<List<SongInfoResponse.ResultSong>> searchMusic(String keyword, Integer type) {
|
||||||
if (ObjectUtils.isEmpty(type)) {
|
if (ObjectUtils.isEmpty(type)) {
|
||||||
type = 1;
|
type = 1;
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
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 java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class ActionResp {
|
public class ActionResp {
|
||||||
@ -9,4 +11,5 @@ public class ActionResp {
|
|||||||
|
|
||||||
String image;//圖片地址
|
String image;//圖片地址
|
||||||
String action;//動作内容 json
|
String action;//動作内容 json
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
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 lombok.Data;
|
||||||
import org.springframework.web.reactive.socket.WebSocketMessage;
|
import org.springframework.web.reactive.socket.WebSocketMessage;
|
||||||
import org.springframework.web.reactive.socket.WebSocketSession;
|
import org.springframework.web.reactive.socket.WebSocketSession;
|
||||||
@ -13,4 +14,6 @@ public class BoxMessageResp {
|
|||||||
|
|
||||||
//其他動作
|
//其他動作
|
||||||
ActionResp action;
|
ActionResp action;
|
||||||
|
|
||||||
|
MusicResp music;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.qiuguo.iot.box.websocket.api.handler;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.qiuguo.iot.base.enums.AskTypeEnum;
|
import com.qiuguo.iot.base.enums.AskTypeEnum;
|
||||||
|
import com.qiuguo.iot.base.enums.PlayEnum;
|
||||||
import com.qiuguo.iot.base.enums.RespCodeEnum;
|
import com.qiuguo.iot.base.enums.RespCodeEnum;
|
||||||
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;
|
||||||
@ -14,6 +15,7 @@ import com.qiuguo.iot.data.entity.system.SystemTalkBindDeviceEntity;
|
|||||||
import com.qiuguo.iot.data.request.device.DeviceUserBindRequest;
|
import com.qiuguo.iot.data.request.device.DeviceUserBindRequest;
|
||||||
import com.qiuguo.iot.data.request.system.SystemTalkBindDeviceRequest;
|
import com.qiuguo.iot.data.request.system.SystemTalkBindDeviceRequest;
|
||||||
import com.qiuguo.iot.data.request.third.ThirdWeatherInfoRequest;
|
import com.qiuguo.iot.data.request.third.ThirdWeatherInfoRequest;
|
||||||
|
import com.qiuguo.iot.data.resp.third.MusicResp;
|
||||||
import com.qiuguo.iot.data.resp.third.weather.TianqiapiItemResp;
|
import com.qiuguo.iot.data.resp.third.weather.TianqiapiItemResp;
|
||||||
import com.qiuguo.iot.data.service.device.DeviceUserBindService;
|
import com.qiuguo.iot.data.service.device.DeviceUserBindService;
|
||||||
import com.qiuguo.iot.data.service.device.DeviceUserTalkRecordService;
|
import com.qiuguo.iot.data.service.device.DeviceUserTalkRecordService;
|
||||||
@ -22,6 +24,7 @@ import com.qiuguo.iot.data.service.system.SystemTalkBindDeviceService;
|
|||||||
import com.qiuguo.iot.third.nlp.action.Action;
|
import com.qiuguo.iot.third.nlp.action.Action;
|
||||||
import com.qiuguo.iot.third.nlp.action.Actions;
|
import com.qiuguo.iot.third.nlp.action.Actions;
|
||||||
import com.qiuguo.iot.third.query.TuyaQuery;
|
import com.qiuguo.iot.third.query.TuyaQuery;
|
||||||
|
import com.qiuguo.iot.third.service.MusicService;
|
||||||
import com.qiuguo.iot.third.service.NlpService;
|
import com.qiuguo.iot.third.service.NlpService;
|
||||||
import com.qiuguo.iot.third.service.TuyaDeviceService;
|
import com.qiuguo.iot.third.service.TuyaDeviceService;
|
||||||
import com.qiuguo.iot.third.service.WeatherService;
|
import com.qiuguo.iot.third.service.WeatherService;
|
||||||
@ -34,6 +37,7 @@ import reactor.core.publisher.Flux;
|
|||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -59,6 +63,9 @@ public class BaseWebSocketProcess {
|
|||||||
@Autowired
|
@Autowired
|
||||||
protected DeviceUserTalkRecordService deviceUserTalkRecordService;
|
protected DeviceUserTalkRecordService deviceUserTalkRecordService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected MusicService musicService;
|
||||||
|
|
||||||
|
|
||||||
protected static ConcurrentHashMap<Long, BaseSession> userGroup = new ConcurrentHashMap<>();
|
protected static ConcurrentHashMap<Long, BaseSession> userGroup = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@ -68,16 +75,16 @@ public class BaseWebSocketProcess {
|
|||||||
protected static String apiToken = "api-token";
|
protected static String apiToken = "api-token";
|
||||||
|
|
||||||
protected void processAction(Actions actions, Long userId, BaseSession baseSession) {
|
protected void processAction(Actions actions, Long userId, BaseSession baseSession) {
|
||||||
//目前只处理第一条动作
|
for (Action action : actions.getActions()
|
||||||
Action action = actions.getActions().get(0);
|
) {
|
||||||
|
|
||||||
|
|
||||||
log.info("匹配到自定义指令{}", action.getSystemTalkAnswerConfigEntity());
|
log.info("匹配到自定义指令{}", action.getSystemTalkAnswerConfigEntity());
|
||||||
if(action.getSystemTalkAnswerConfigEntity() == null){
|
if(action.getSystemTalkAnswerConfigEntity() == null){
|
||||||
log.info("调用千问");
|
log.info("调用千问");
|
||||||
sendMessage(action, baseSession, 0, "暂时无法理解,我还在努力学习中");
|
BoxMessageResp resp = new BoxMessageResp();
|
||||||
}
|
resp.setType(0);
|
||||||
else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.IOT.getCode())){
|
resp.setText("暂时无法理解,我还在努力学习中");
|
||||||
|
sendMessage(action, baseSession, resp);
|
||||||
|
}else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.IOT.getCode())){
|
||||||
|
|
||||||
if(action.getName().size() > 0){
|
if(action.getName().size() > 0){
|
||||||
String deviceName = action.getName().get(0);
|
String deviceName = action.getName().get(0);
|
||||||
@ -92,10 +99,16 @@ public class BaseWebSocketProcess {
|
|||||||
.map(binds ->{
|
.map(binds ->{
|
||||||
if(binds.getTotal() == 0){
|
if(binds.getTotal() == 0){
|
||||||
//返回告诉没有备
|
//返回告诉没有备
|
||||||
sendMessage(action, baseSession, action.getSystemTalkAnswerConfigEntity().getAnswerType(), "未找到相关设备,无法操做!");
|
BoxMessageResp resp = new BoxMessageResp();
|
||||||
|
resp.setType(action.getSystemTalkAnswerConfigEntity().getAnswerType());
|
||||||
|
resp.setText("未找到相关设备,无法操做!");
|
||||||
|
sendMessage(action, baseSession, resp);
|
||||||
}else if(binds.getTotal() > 1){
|
}else if(binds.getTotal() > 1){
|
||||||
//返回告诉有多个设备,请详细说明具体说明设备
|
//返回告诉有多个设备,请详细说明具体说明设备
|
||||||
sendMessage(action, baseSession, action.getSystemTalkAnswerConfigEntity().getAnswerType(), "您有多个相同设备,请明确说明");
|
BoxMessageResp resp = new BoxMessageResp();
|
||||||
|
resp.setType(action.getSystemTalkAnswerConfigEntity().getAnswerType());
|
||||||
|
resp.setText("您有多个相同设备,请明确说明");
|
||||||
|
sendMessage(action, baseSession, resp);
|
||||||
}else{
|
}else{
|
||||||
//查询是否有相关指令绑定
|
//查询是否有相关指令绑定
|
||||||
DeviceUserBindEntity deviceUserBindEntity = binds.getData().get(0);
|
DeviceUserBindEntity deviceUserBindEntity = binds.getData().get(0);
|
||||||
@ -107,7 +120,10 @@ public class BaseWebSocketProcess {
|
|||||||
.map(systemTalkBindDeviceEntity -> {
|
.map(systemTalkBindDeviceEntity -> {
|
||||||
if(systemTalkBindDeviceEntity.getId() == null){
|
if(systemTalkBindDeviceEntity.getId() == null){
|
||||||
//通知不支持的指令
|
//通知不支持的指令
|
||||||
sendMessage(action, baseSession, action.getSystemTalkAnswerConfigEntity().getAnswerType(), deviceName + "不支持" + action.getAction() + "指令!");
|
BoxMessageResp resp = new BoxMessageResp();
|
||||||
|
resp.setType(action.getSystemTalkAnswerConfigEntity().getAnswerType());
|
||||||
|
resp.setText(deviceName + "不支持" + action.getAction() + "指令!");
|
||||||
|
sendMessage(action, baseSession, resp);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
//调用涂鸦
|
//调用涂鸦
|
||||||
@ -130,7 +146,10 @@ public class BaseWebSocketProcess {
|
|||||||
msg = action.getSystemTalkAnswerConfigEntity().getAnswerValueFaild().replaceAll("#name#", deviceName);
|
msg = action.getSystemTalkAnswerConfigEntity().getAnswerValueFaild().replaceAll("#name#", deviceName);
|
||||||
log.info("执行指令失败");
|
log.info("执行指令失败");
|
||||||
}
|
}
|
||||||
sendMessage(action, baseSession, action.getSystemTalkAnswerConfigEntity().getAnswerType(), msg);
|
BoxMessageResp resp = new BoxMessageResp();
|
||||||
|
resp.setType(action.getSystemTalkAnswerConfigEntity().getAnswerType());
|
||||||
|
resp.setText(msg);
|
||||||
|
sendMessage(action, baseSession, resp);
|
||||||
|
|
||||||
return isOk;
|
return isOk;
|
||||||
}).subscribe();
|
}).subscribe();
|
||||||
@ -142,7 +161,10 @@ public class BaseWebSocketProcess {
|
|||||||
return Mono.empty();
|
return Mono.empty();
|
||||||
}).subscribe();
|
}).subscribe();
|
||||||
}else{
|
}else{
|
||||||
sendMessage(action, baseSession, action.getSystemTalkAnswerConfigEntity().getAnswerType(), "未找到对应的设备");
|
BoxMessageResp resp = new BoxMessageResp();
|
||||||
|
resp.setType(action.getSystemTalkAnswerConfigEntity().getAnswerType());
|
||||||
|
resp.setText("未找到对应的设备");
|
||||||
|
sendMessage(action, baseSession, resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.WEATHER.getCode())){
|
}else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.WEATHER.getCode())){
|
||||||
@ -186,76 +208,49 @@ public class BaseWebSocketProcess {
|
|||||||
|
|
||||||
log.info("执行指令失败");
|
log.info("执行指令失败");
|
||||||
}
|
}
|
||||||
sendMessage(action, baseSession, action.getSystemTalkAnswerConfigEntity().getAnswerType(), msg);
|
BoxMessageResp resp = new BoxMessageResp();
|
||||||
|
resp.setType(action.getSystemTalkAnswerConfigEntity().getAnswerType());
|
||||||
|
resp.setText(msg);
|
||||||
|
sendMessage(action, baseSession, resp);
|
||||||
return t;
|
return t;
|
||||||
}).subscribe();
|
}).subscribe();
|
||||||
|
}else if(action.getSystemTalkAnswerConfigEntity().getAnswerType().equals(AskTypeEnum.MUSIC.getCode())){
|
||||||
|
|
||||||
|
String search = action.getAsk().replaceAll(action.getAction(), "").replaceAll("的", "");
|
||||||
|
if(StringUtils.isNotEmpty(action.getPName())){
|
||||||
|
search = search.replaceAll(action.getPName(), "");
|
||||||
}
|
}
|
||||||
|
musicService.searchMusic(search, 1).defaultIfEmpty(new ArrayList<>()).map(resultSongs -> {
|
||||||
}
|
|
||||||
|
|
||||||
/*protected Mono<Void> sessionProcess(WebSocketSession session, Long userId, String ip, int type) {
|
|
||||||
Mono<Void> input = session.receive().map(webSocketMessage ->{
|
|
||||||
//MDC.put(LogMdcConfiguration.PRINT_LOG_ID, getBoxSessionWithSn().getLogId());
|
|
||||||
String text = webSocketMessage.getPayloadAsText();
|
|
||||||
log.info("收到消息:{}", text);
|
|
||||||
UserTalkMessage userTalkMessage = JSONObject.parseObject(text, UserTalkMessage.class);
|
|
||||||
nlpService.getActionWithLacSingle(userTalkMessage.getMessage()).defaultIfEmpty(new Actions()).map(actions -> {
|
|
||||||
BaseSession baseSession = null;
|
|
||||||
if(type == 0){
|
|
||||||
|
|
||||||
baseSession = getUserSessionWithUserId(userTalkMessage.getUserId());
|
|
||||||
}else{
|
|
||||||
baseSession = getUserSessionWithUserId(userTalkMessage.getUserId());
|
|
||||||
}
|
|
||||||
|
|
||||||
//处理
|
|
||||||
if(actions.getActions() == null || actions.getActions().size() == 0){
|
|
||||||
//调用千问回答
|
|
||||||
log.info("未匹配到自定义命令,调用千问");
|
|
||||||
}else if(baseSession == null){
|
|
||||||
log.info("未匹配到用户session,可能传错用户id");
|
|
||||||
session.close().subscribe();
|
|
||||||
}else{
|
|
||||||
processAction(actions, userId, baseSession);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Mono.empty();
|
|
||||||
}).subscribe();
|
|
||||||
log.info("收到用户userId:{},消息:{}", userTalkMessage.getUserId(), userTalkMessage.getMessage());
|
|
||||||
//MDC.remove(LogMdcConfiguration.PRINT_LOG_ID);
|
|
||||||
return Mono.empty();
|
|
||||||
}).then();
|
|
||||||
BaseSession userSession = new BaseSession();
|
|
||||||
userSession.setUserId(userId);
|
|
||||||
userSession.setSession(session);
|
|
||||||
userSession.setCustomerIP(ip);
|
|
||||||
userSession.setLogId(MDC.get(LogMdcConfiguration.PRINT_LOG_ID));
|
|
||||||
userGroup.put(userId, userSession);
|
|
||||||
Mono<Void> output = session.send(Flux.create(sink -> userSession.setSink(sink))).then();
|
|
||||||
|
|
||||||
// Mono.zip() 会将多个 Mono 合并为一个新的 Mono,任何一个 Mono 产生 error 或 complete 都会导致合并后的 Mono
|
|
||||||
// 也随之产生 error 或 complete,此时其它的 Mono 则会被执行取消操作。
|
|
||||||
|
|
||||||
return Mono.zip(input, output).doFinally(signalType -> {
|
|
||||||
// MDC.put(LogMdcConfiguration.PRINT_LOG_ID, requestId);
|
|
||||||
userGroup.remove(userSession.getUserId());//断链后及时移除
|
|
||||||
log.info("断开连接SN:{}", userSession.getUserId());
|
|
||||||
// MDC.remove(LogMdcConfiguration.PRINT_LOG_ID);
|
|
||||||
}).then();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private void sendMessage(Action action, BaseSession baseSession, Integer type, String message){
|
|
||||||
BoxMessageResp resp = new BoxMessageResp();
|
BoxMessageResp resp = new BoxMessageResp();
|
||||||
resp.setType(type);
|
MusicResp musicResp = new MusicResp();
|
||||||
resp.setText(message);
|
if(resultSongs.size() > 0){
|
||||||
|
//
|
||||||
|
musicResp.setPlay(PlayEnum.START.getCode());
|
||||||
|
resp.setText("");
|
||||||
|
}else{
|
||||||
|
musicResp.setPlay(PlayEnum.NONE.getCode());
|
||||||
|
resp.setText("未找到相关资源");
|
||||||
|
}
|
||||||
|
resp.setMusic(musicResp);
|
||||||
|
resp.setType(action.getSystemTalkAnswerConfigEntity().getAnswerType());
|
||||||
|
|
||||||
|
sendMessage(action, baseSession, resp);
|
||||||
|
return resultSongs;
|
||||||
|
}).subscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendMessage(Action action, BaseSession baseSession, BoxMessageResp resp){
|
||||||
|
|
||||||
DeviceUserTalkRecordEntity talkRecord = new DeviceUserTalkRecordEntity();
|
DeviceUserTalkRecordEntity talkRecord = new DeviceUserTalkRecordEntity();
|
||||||
talkRecord.setAskType(type);
|
talkRecord.setAskType(resp.getType());
|
||||||
talkRecord.setAskValue(action.getAsk());
|
talkRecord.setAskValue(action.getAsk());
|
||||||
talkRecord.setAskKey(action.getAction());
|
talkRecord.setAskKey(action.getAction());
|
||||||
talkRecord.setAnswerValue(message);
|
talkRecord.setAnswerValue(resp.getText());
|
||||||
talkRecord.setUserId(baseSession.getUserId());
|
talkRecord.setUserId(baseSession.getUserId());
|
||||||
talkRecord.setDeviceId(baseSession.getDeviceId());
|
talkRecord.setDeviceId(baseSession.getDeviceId());
|
||||||
if(type.equals(AskTypeEnum.MUSIC.getCode())) {
|
if(resp.getType().equals(AskTypeEnum.MUSIC.getCode())) {
|
||||||
if(this instanceof CustomerWebSocketHandler) {
|
if(this instanceof CustomerWebSocketHandler) {
|
||||||
log.info("推送Box播放音乐");
|
log.info("推送Box播放音乐");
|
||||||
BaseSession boxSession = getBoxSessionWithSn(baseSession.getSn());
|
BaseSession boxSession = getBoxSessionWithSn(baseSession.getSn());
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user