兼容android闹钟接口,修改后端逻辑
This commit is contained in:
parent
4dd4ed0225
commit
a1636ea9dd
@ -5,7 +5,7 @@ package com.qiuguo.iot.base.enums;
|
|||||||
* 作者:吴林
|
* 作者:吴林
|
||||||
* */
|
* */
|
||||||
// 播放音乐相关
|
// 播放音乐相关
|
||||||
public enum PlayEnum {
|
public enum ActionStatusEnum {
|
||||||
START(0),//开始
|
START(0),//开始
|
||||||
PASUE(1),//暂停
|
PASUE(1),//暂停
|
||||||
GO(2),//继续
|
GO(2),//继续
|
||||||
@ -13,7 +13,7 @@ public enum PlayEnum {
|
|||||||
|
|
||||||
NONE(10),//无此资源
|
NONE(10),//无此资源
|
||||||
;
|
;
|
||||||
PlayEnum(Integer c){
|
ActionStatusEnum(Integer c){
|
||||||
code = c;
|
code = c;
|
||||||
}
|
}
|
||||||
private Integer code;
|
private Integer code;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.qiuguo.iot.third.nlp.entity;
|
package com.qiuguo.iot.data.model.system;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -2,9 +2,11 @@ package com.qiuguo.iot.data.service.system;
|
|||||||
|
|
||||||
|
|
||||||
import com.qiuguo.iot.base.enums.AskTypeEnum;
|
import com.qiuguo.iot.base.enums.AskTypeEnum;
|
||||||
|
import com.qiuguo.iot.base.enums.KeyTypeEnum;
|
||||||
import com.qiuguo.iot.base.utils.StringUtils;
|
import com.qiuguo.iot.base.utils.StringUtils;
|
||||||
import com.qiuguo.iot.data.entity.system.SystemTalkAnswerConfigEntity;
|
import com.qiuguo.iot.data.entity.system.SystemTalkAnswerConfigEntity;
|
||||||
import com.qiuguo.iot.data.model.system.SystemTalkAnswerConfig;
|
import com.qiuguo.iot.data.model.system.SystemTalkAnswerConfig;
|
||||||
|
import com.qiuguo.iot.data.model.system.SystemTalkKeyAndDeviceName;
|
||||||
import com.qiuguo.iot.data.request.system.SystemTalkAnswerConfigRequest;
|
import com.qiuguo.iot.data.request.system.SystemTalkAnswerConfigRequest;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.hswebframework.ezorm.core.param.Sort;
|
import org.hswebframework.ezorm.core.param.Sort;
|
||||||
@ -49,6 +51,8 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
|||||||
*/
|
*/
|
||||||
private static List<SystemTalkAnswerConfigEntity> groupCommand = new ArrayList<>();
|
private static List<SystemTalkAnswerConfigEntity> groupCommand = new ArrayList<>();
|
||||||
|
|
||||||
|
private List<SystemTalkKeyAndDeviceName> commandList = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initGroup() {
|
public void initGroup() {
|
||||||
@ -74,15 +78,28 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
|||||||
reactiveQuery1 = reactiveQuery1.and("parent_id", item.getId());
|
reactiveQuery1 = reactiveQuery1.and("parent_id", item.getId());
|
||||||
reactiveQuery1 = reactiveQuery1.gt("answer_type", AskTypeEnum.EXCOMMAND.getCode());
|
reactiveQuery1 = reactiveQuery1.gt("answer_type", AskTypeEnum.EXCOMMAND.getCode());
|
||||||
reactiveQuery1.paging(0, MAX_COUT.intValue()).fetch().map(item1 ->{
|
reactiveQuery1.paging(0, MAX_COUT.intValue()).fetch().map(item1 ->{
|
||||||
systemTalkAnswerConfig.getExCommand().put(item.getAskKey(), item1);
|
item1.setAnswerType(item1.getAnswerType() % systemTalkAnswerConfig.getSystemTalkAnswerConfig().getAnswerType());
|
||||||
|
systemTalkAnswerConfig.getExCommand().put(item1.getAskKey(), item1);
|
||||||
return item1;
|
return item1;
|
||||||
}).doFinally(signalType -> {
|
}).doFinally(signalType -> {
|
||||||
log.info("配置扩展最多读取{}条,实际读取了{}条扩展指令",
|
log.info("配置扩展最多读取{}条,实际读取了:{},id:{}的{}条扩展指令",
|
||||||
MAX_COUT,
|
MAX_COUT,
|
||||||
|
systemTalkAnswerConfig.getSystemTalkAnswerConfig().getAskKey(),
|
||||||
|
systemTalkAnswerConfig.getSystemTalkAnswerConfig().getId(),
|
||||||
systemTalkAnswerConfig.getExCommand().size());
|
systemTalkAnswerConfig.getExCommand().size());
|
||||||
}).subscribe();
|
}).subscribe();
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
SystemTalkKeyAndDeviceName systemTalkKeyAndDeviceName = new SystemTalkKeyAndDeviceName();
|
||||||
|
systemTalkKeyAndDeviceName.setKey(item.getAskKey());
|
||||||
|
if(item.getAnswerType().equals(KeyTypeEnum.SYSTEM_COMMAND.getCode())) {
|
||||||
|
systemTalkKeyAndDeviceName.setType(KeyTypeEnum.SYSTEM_COMMAND.getCode());
|
||||||
|
}else{
|
||||||
|
//只要内容中含有改词的都直接使用系统配置回答,而不会调用千问
|
||||||
|
systemTalkKeyAndDeviceName.setType(KeyTypeEnum.QIUGUO_NAME.getCode());
|
||||||
|
}
|
||||||
|
systemTalkKeyAndDeviceName.setIndex(commandList.size());
|
||||||
|
commandList.add(systemTalkKeyAndDeviceName);
|
||||||
groupCommand.add(item);
|
groupCommand.add(item);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
@ -91,6 +108,10 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
|||||||
MAX_COUT,
|
MAX_COUT,
|
||||||
group.size(),
|
group.size(),
|
||||||
groupCommand.size());
|
groupCommand.size());
|
||||||
|
|
||||||
|
commandList.sort((a, b) ->{
|
||||||
|
return b.getKey().length() - a.getKey().length();
|
||||||
|
});
|
||||||
}).subscribeOn(Schedulers.single()).subscribe();
|
}).subscribeOn(Schedulers.single()).subscribe();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -355,10 +376,14 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
|||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SystemTalkAnswerConfigEntity> getCommandList() {
|
public List<SystemTalkAnswerConfigEntity> getCommandGroupList() {
|
||||||
return groupCommand;
|
return groupCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SystemTalkKeyAndDeviceName> getCommandList() {
|
||||||
|
return commandList;
|
||||||
|
}
|
||||||
|
|
||||||
public Mono<SystemTalkAnswerConfigEntity> selectSystemTalkAnswerConfigByRand() {
|
public Mono<SystemTalkAnswerConfigEntity> selectSystemTalkAnswerConfigByRand() {
|
||||||
ReactiveQuery<SystemTalkAnswerConfigEntity> reactiveQuery = createQuery();
|
ReactiveQuery<SystemTalkAnswerConfigEntity> reactiveQuery = createQuery();
|
||||||
reactiveQuery = reactiveQuery.and("is_delete", 0);
|
reactiveQuery = reactiveQuery.and("is_delete", 0);
|
||||||
|
|||||||
@ -416,6 +416,9 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
|||||||
List<SystemTalkAnswerConfigEntity> commands){
|
List<SystemTalkAnswerConfigEntity> commands){
|
||||||
if(TIME.getCode().equals(actions.getLastCode())){
|
if(TIME.getCode().equals(actions.getLastCode())){
|
||||||
//上个是时间词,可能后面数字也是时间词
|
//上个是时间词,可能后面数字也是时间词
|
||||||
|
|
||||||
|
actions.setLastCode(ActionPartSpeechEnum.t.getCode());
|
||||||
|
//actions.setLastKey();
|
||||||
return t.getAction(keyGroup, key, actions, action, systemTalkAnswerConfigEntities, includs, commands);
|
return t.getAction(keyGroup, key, actions, action, systemTalkAnswerConfigEntities, includs, commands);
|
||||||
}else{
|
}else{
|
||||||
SystemTalkAnswerConfigEntity entity = getSystemTalkWithKey(key, keyGroup, action.getNoTimeAsk());
|
SystemTalkAnswerConfigEntity entity = getSystemTalkWithKey(key, keyGroup, action.getNoTimeAsk());
|
||||||
@ -518,8 +521,11 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
|||||||
}else{
|
}else{
|
||||||
action.getTime().setTime(key, false);
|
action.getTime().setTime(key, false);
|
||||||
}
|
}
|
||||||
action.setNoTimeAsk(action.getNoTimeAsk().substring(action.getNoTimeAsk().indexOf(key) + key.length()));
|
int index = action.getNoTimeAsk().indexOf(key);
|
||||||
action.setNoTimeAsk(action.getNoTimeAsk().replaceAll(key, ""));
|
String v = action.getNoTimeAsk().substring(0, index);
|
||||||
|
v += action.getNoTimeAsk().substring(index + key.length());
|
||||||
|
//action.setNoTimeAsk(action.getNoTimeAsk().substring(action.getNoTimeAsk().indexOf(key) + key.length()));
|
||||||
|
action.setNoTimeAsk(v);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
},//LAC TIME
|
},//LAC TIME
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.qiuguo.iot.third.nlp.action;
|
package com.qiuguo.iot.third.nlp.action;
|
||||||
|
|
||||||
|
import com.qiuguo.iot.base.utils.StringUtils;
|
||||||
import com.qiuguo.iot.data.entity.device.DeviceUserBindEntity;
|
import com.qiuguo.iot.data.entity.device.DeviceUserBindEntity;
|
||||||
import com.qiuguo.iot.data.entity.system.SystemTalkAnswerConfigEntity;
|
import com.qiuguo.iot.data.entity.system.SystemTalkAnswerConfigEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -40,6 +41,10 @@ public class Action {
|
|||||||
* 替换时间词后的文案
|
* 替换时间词后的文案
|
||||||
*/
|
*/
|
||||||
private String noTimeAsk;
|
private String noTimeAsk;
|
||||||
|
/**
|
||||||
|
* 替换时间词、动作及动作名词后的文案
|
||||||
|
*/
|
||||||
|
private String noTimeVNAsk;
|
||||||
/**
|
/**
|
||||||
* 具体时间
|
* 具体时间
|
||||||
*/
|
*/
|
||||||
@ -65,4 +70,20 @@ public class Action {
|
|||||||
* 语言
|
* 语言
|
||||||
*/
|
*/
|
||||||
private Integer language;
|
private Integer language;
|
||||||
|
|
||||||
|
public void setNoTimeVNAsk(String v){
|
||||||
|
if(StringUtils.isNotEmpty(v)){
|
||||||
|
if(StringUtils.isNotEmpty(action)){
|
||||||
|
v = v.replace(action, "");
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotEmpty(name)){
|
||||||
|
v = v.replace(name, "");
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotEmpty(actionCommand)){
|
||||||
|
v = v.replace(actionCommand, "");
|
||||||
|
}
|
||||||
|
noTimeVNAsk = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import com.qiuguo.iot.data.service.system.SystemTalkAnswerConfigService;
|
|||||||
import com.qiuguo.iot.third.nlp.NlpKey;
|
import com.qiuguo.iot.third.nlp.NlpKey;
|
||||||
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.nlp.entity.SystemTalkKeyAndDeviceName;
|
import com.qiuguo.iot.data.model.system.SystemTalkKeyAndDeviceName;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||||
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
||||||
@ -41,6 +41,9 @@ public class NlpService {
|
|||||||
*/
|
*/
|
||||||
private static Integer MAX_COUT = 2000;
|
private static Integer MAX_COUT = 2000;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Mono<Actions> getActionWithLacSingle(Long userId, String text, String type){
|
public Mono<Actions> getActionWithLacSingle(Long userId, String text, String type){
|
||||||
if(userId == null) {
|
if(userId == null) {
|
||||||
userId = 0L;
|
userId = 0L;
|
||||||
@ -59,21 +62,7 @@ public class NlpService {
|
|||||||
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(SystemTalkAnswerConfigEntity entity : systemTalkAnswerConfigService.getCommandList()){
|
|
||||||
SystemTalkKeyAndDeviceName systemTalkKeyAndDeviceName = new SystemTalkKeyAndDeviceName();
|
|
||||||
systemTalkKeyAndDeviceName.setKey(entity.getAskKey());
|
|
||||||
if(entity.getAnswerType().equals(KeyTypeEnum.SYSTEM_COMMAND.getCode())) {
|
|
||||||
systemTalkKeyAndDeviceName.setType(KeyTypeEnum.SYSTEM_COMMAND.getCode());
|
|
||||||
}else{
|
|
||||||
//只要内容中含有改词的都直接使用系统配置回答,而不会调用千问
|
|
||||||
systemTalkKeyAndDeviceName.setType(KeyTypeEnum.QIUGUO_NAME.getCode());
|
|
||||||
}
|
|
||||||
systemTalkKeyAndDeviceName.setIndex(i++);
|
|
||||||
systemTalkKeyAndDeviceNameList.add(systemTalkKeyAndDeviceName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
i = 0;
|
|
||||||
for(DeviceUserBindEntity entity : deviceUserBindEntityPagerResult.getData()){
|
for(DeviceUserBindEntity entity : deviceUserBindEntityPagerResult.getData()){
|
||||||
SystemTalkKeyAndDeviceName systemTalkKeyAndDeviceName = new SystemTalkKeyAndDeviceName();
|
SystemTalkKeyAndDeviceName systemTalkKeyAndDeviceName = new SystemTalkKeyAndDeviceName();
|
||||||
systemTalkKeyAndDeviceName.setKey(entity.getBindName());
|
systemTalkKeyAndDeviceName.setKey(entity.getBindName());
|
||||||
@ -82,6 +71,7 @@ public class NlpService {
|
|||||||
systemTalkKeyAndDeviceNameList.add(systemTalkKeyAndDeviceName);
|
systemTalkKeyAndDeviceNameList.add(systemTalkKeyAndDeviceName);
|
||||||
}
|
}
|
||||||
//字符由长到短排序
|
//字符由长到短排序
|
||||||
|
systemTalkKeyAndDeviceNameList.addAll(systemTalkAnswerConfigService.getCommandList());
|
||||||
systemTalkKeyAndDeviceNameList.sort((a, b) ->{
|
systemTalkKeyAndDeviceNameList.sort((a, b) ->{
|
||||||
return b.getKey().length() - a.getKey().length();
|
return b.getKey().length() - a.getKey().length();
|
||||||
});
|
});
|
||||||
@ -101,7 +91,7 @@ public class NlpService {
|
|||||||
}else{// if(sysTalkKeyAndDeviceName.getType().equals(KeyTypeEnum.SYSTEM_COMMAND.getCode())){
|
}else{// if(sysTalkKeyAndDeviceName.getType().equals(KeyTypeEnum.SYSTEM_COMMAND.getCode())){
|
||||||
//是系统自定义动词后的名称
|
//是系统自定义动词后的名称
|
||||||
pText = pText.replace(sysTalkKeyAndDeviceName.getKey(), "#" + (j++) + "#");
|
pText = pText.replace(sysTalkKeyAndDeviceName.getKey(), "#" + (j++) + "#");
|
||||||
systemIncluds.add(systemTalkAnswerConfigService.getCommandList().get(sysTalkKeyAndDeviceName.getIndex()));
|
systemIncluds.add(systemTalkAnswerConfigService.getCommandGroupList().get(sysTalkKeyAndDeviceName.getIndex()));
|
||||||
isFinding = true;
|
isFinding = true;
|
||||||
}/*else{
|
}/*else{
|
||||||
//秋果专有名称
|
//秋果专有名称
|
||||||
@ -120,7 +110,7 @@ public class NlpService {
|
|||||||
if(pinyinArray.indexOf(sysTalkKeyAndDeviceName.getKey()) >= 0){
|
if(pinyinArray.indexOf(sysTalkKeyAndDeviceName.getKey()) >= 0){
|
||||||
if(sysTalkKeyAndDeviceName.getType().equals(KeyTypeEnum.QIUGUO_NAME.getCode())){
|
if(sysTalkKeyAndDeviceName.getType().equals(KeyTypeEnum.QIUGUO_NAME.getCode())){
|
||||||
pinyinArray = pinyinArray.replace(sysTalkKeyAndDeviceName.getKey(), "#" + (j++) + "#");
|
pinyinArray = pinyinArray.replace(sysTalkKeyAndDeviceName.getKey(), "#" + (j++) + "#");
|
||||||
systemIncluds.add(systemTalkAnswerConfigService.getCommandList().get(sysTalkKeyAndDeviceName.getIndex()));
|
systemIncluds.add(systemTalkAnswerConfigService.getCommandGroupList().get(sysTalkKeyAndDeviceName.getIndex()));
|
||||||
return getActions(pinyinArray, text, includs, systemIncluds, type, isEng);
|
return getActions(pinyinArray, text, includs, systemIncluds, type, isEng);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -169,7 +159,8 @@ public class NlpService {
|
|||||||
includs,
|
includs,
|
||||||
commands);
|
commands);
|
||||||
if(!key.getType().equals(ActionPartSpeechEnum.u.getCode()) &&
|
if(!key.getType().equals(ActionPartSpeechEnum.u.getCode()) &&
|
||||||
!key.getType().equals(ActionPartSpeechEnum.w.getCode())){//组词忽略记录
|
!key.getType().equals(ActionPartSpeechEnum.w.getCode()) &&
|
||||||
|
!key.getType().equals(ActionPartSpeechEnum.m.getCode())){//组词忽略记录
|
||||||
actions.setLastCode(actionPartSpeechEnum.getCode());
|
actions.setLastCode(actionPartSpeechEnum.getCode());
|
||||||
actions.setLastKey(key.getKey());
|
actions.setLastKey(key.getKey());
|
||||||
}
|
}
|
||||||
@ -177,6 +168,8 @@ public class NlpService {
|
|||||||
if(actions.getA() + actions.getB() == 2){
|
if(actions.getA() + actions.getB() == 2){
|
||||||
actions.setA(0);
|
actions.setA(0);
|
||||||
actions.setB(0);
|
actions.setB(0);
|
||||||
|
action.setNoTimeVNAsk(action.getNoTimeAsk());
|
||||||
|
|
||||||
if(systemTalkAnswerConfigEntities.size() > 0){
|
if(systemTalkAnswerConfigEntities.size() > 0){
|
||||||
//指令按照优先级排序
|
//指令按照优先级排序
|
||||||
systemTalkAnswerConfigEntities.sort(Comparator.comparing(SystemTalkAnswerConfigEntity::getKeyOrder));
|
systemTalkAnswerConfigEntities.sort(Comparator.comparing(SystemTalkAnswerConfigEntity::getKeyOrder));
|
||||||
@ -244,6 +237,7 @@ public class NlpService {
|
|||||||
action.setAction(action.getSystemTalkAnswerConfigEntity() == null ? null : action.getSystemTalkAnswerConfigEntity().getAskKey());
|
action.setAction(action.getSystemTalkAnswerConfigEntity() == null ? null : action.getSystemTalkAnswerConfigEntity().getAskKey());
|
||||||
action.setDeviceUserBindEntity(actions.getLastDeviceUserBindEntity());
|
action.setDeviceUserBindEntity(actions.getLastDeviceUserBindEntity());
|
||||||
}
|
}
|
||||||
|
action.setNoTimeVNAsk(action.getNoTimeAsk());
|
||||||
if(actions.getA() + actions.getB() > 0){
|
if(actions.getA() + actions.getB() > 0){
|
||||||
actions.getActions().add(action);
|
actions.getActions().add(action);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,9 +2,10 @@ package com.qiuguo.iot.box.websocket.api.command;
|
|||||||
|
|
||||||
import com.qiuguo.iot.base.enums.AlarmRepeatEnum;
|
import com.qiuguo.iot.base.enums.AlarmRepeatEnum;
|
||||||
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.ActionStatusEnum;
|
||||||
import com.qiuguo.iot.base.enums.YesNo;
|
import com.qiuguo.iot.base.enums.YesNo;
|
||||||
import com.qiuguo.iot.base.utils.StringUtils;
|
import com.qiuguo.iot.base.utils.StringUtils;
|
||||||
|
import com.qiuguo.iot.box.websocket.api.config.properties.SomeProperties;
|
||||||
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.resp.ActionResp;
|
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;
|
||||||
@ -12,9 +13,10 @@ import com.qiuguo.iot.data.entity.device.DeviceAlarmClockRecordEntity;
|
|||||||
import com.qiuguo.iot.data.request.device.DeviceAlarmClockRecordRequest;
|
import com.qiuguo.iot.data.request.device.DeviceAlarmClockRecordRequest;
|
||||||
import com.qiuguo.iot.data.service.device.DeviceAlarmClockMusicService;
|
import com.qiuguo.iot.data.service.device.DeviceAlarmClockMusicService;
|
||||||
import com.qiuguo.iot.data.service.device.DeviceAlarmClockRecordService;
|
import com.qiuguo.iot.data.service.device.DeviceAlarmClockRecordService;
|
||||||
import com.qiuguo.iot.data.service.system.SystemTalkAnswerConfigService;
|
|
||||||
import com.qiuguo.iot.third.nlp.action.Action;
|
import com.qiuguo.iot.third.nlp.action.Action;
|
||||||
import com.qiuguo.iot.third.nlp.action.ActionTime;
|
import com.qiuguo.iot.third.nlp.action.ActionTime;
|
||||||
|
import com.qiuguo.iot.third.nlp.action.Actions;
|
||||||
|
import com.qiuguo.iot.third.service.NlpService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
@ -39,11 +41,20 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
|
|||||||
DeviceAlarmClockMusicService deviceAlarmClockMusicService;
|
DeviceAlarmClockMusicService deviceAlarmClockMusicService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
SystemTalkAnswerConfigService systemTalkAnswerConfigService;
|
NlpService nlpService;
|
||||||
|
/**
|
||||||
|
* 调用LAC类型
|
||||||
|
*/
|
||||||
|
@Resource
|
||||||
|
private SomeProperties lacProperties;
|
||||||
/**
|
/**
|
||||||
* 超过这个时间的提醒才有效
|
* 超过这个时间的提醒才有效
|
||||||
*/
|
*/
|
||||||
private static Long morTime = 50000L;
|
private static Long morTime = 50000L;
|
||||||
|
/**
|
||||||
|
* action readText多个操作的分隔符
|
||||||
|
*/
|
||||||
|
private static String SPLIT = ",";
|
||||||
|
|
||||||
|
|
||||||
public Mono<Boolean> process(Action action, BaseSession baseSession) {
|
public Mono<Boolean> process(Action action, BaseSession baseSession) {
|
||||||
@ -95,9 +106,7 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
|
|||||||
return baseWebSocketService.sendMessage(action,
|
return baseWebSocketService.sendMessage(action,
|
||||||
baseSession ,
|
baseSession ,
|
||||||
"只能设置1分钟后的闹钟!",
|
"只能设置1分钟后的闹钟!",
|
||||||
AskTypeEnum.EXIT.getCode()).flatMap(m -> {
|
AskTypeEnum.EXIT.getCode());
|
||||||
return Mono.empty();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,11 +133,42 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
|
|||||||
.selectDeviceAlarmClockRecordByRequest(request)
|
.selectDeviceAlarmClockRecordByRequest(request)
|
||||||
.defaultIfEmpty(new DeviceAlarmClockRecordEntity())
|
.defaultIfEmpty(new DeviceAlarmClockRecordEntity())
|
||||||
.flatMap(alarmClock ->{
|
.flatMap(alarmClock ->{
|
||||||
if(action.getSystemTalkAnswerConfigEntity().getActionStatus().equals(PlayEnum.START.getCode())){
|
if(action.getSystemTalkAnswerConfigEntity().getActionStatus() == null ||
|
||||||
|
action.getSystemTalkAnswerConfigEntity().getActionStatus().equals(ActionStatusEnum.START.getCode())){
|
||||||
|
|
||||||
|
if (StringUtils.isNotEmpty(action.getNoTimeVNAsk())) {
|
||||||
|
|
||||||
|
return nlpService.getActionWithLacSingle(
|
||||||
|
0L,
|
||||||
|
action.getNoTimeVNAsk(),
|
||||||
|
lacProperties.getType()
|
||||||
|
).defaultIfEmpty(new Actions()).flatMap(actions -> {
|
||||||
|
if (actions.getActions() != null && actions.getActions().size() > 0) {
|
||||||
|
//目前只支持取消
|
||||||
|
Action action1 = actions.getActions().get(0);
|
||||||
|
if(action1.getSystemTalkAnswerConfigEntity() != null &&
|
||||||
|
!action1.getSystemTalkAnswerConfigEntity().getAnswerType().equals(action.getSystemTalkAnswerConfigEntity().getAnswerType())){
|
||||||
|
if (action1.getSystemTalkAnswerConfigEntity().getActionStatus() != null &&
|
||||||
|
action1.getSystemTalkAnswerConfigEntity().getActionStatus().equals(ActionStatusEnum.STOP.getCode())) {
|
||||||
|
action.setNoTimeAsk(action.getNoTimeAsk().replace(action1.getAction(), ""));
|
||||||
|
action.setNoTimeVNAsk(action1.getNoTimeVNAsk().replace(action1.getAction(), ""));
|
||||||
|
return delAlarm(action, baseSession, alarmClock, request, rDay, actionTime);
|
||||||
|
}
|
||||||
|
log.info("不支持的操作{}", alarmClock);
|
||||||
|
return baseWebSocketService.sendMessage(action,
|
||||||
|
baseSession,
|
||||||
|
"不支持该操作",
|
||||||
|
AskTypeEnum.ALARM_CLOCK.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return addAlarm(action, baseSession, alarmClock, request, rDay, actionTime);
|
||||||
|
});
|
||||||
|
}
|
||||||
return addAlarm(action, baseSession, alarmClock, request, rDay, actionTime);
|
return addAlarm(action, baseSession, alarmClock, request, rDay, actionTime);
|
||||||
}else{
|
}else{
|
||||||
//删除闹钟
|
//删除闹钟
|
||||||
return addAlarm(action, baseSession, alarmClock, request, rDay, actionTime);
|
return delAlarm(action, baseSession, alarmClock, request, rDay, actionTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -145,15 +185,68 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
|
|||||||
return baseWebSocketService.sendMessage(action,
|
return baseWebSocketService.sendMessage(action,
|
||||||
baseSession ,
|
baseSession ,
|
||||||
action.getSystemTalkAnswerConfigEntity().getAnswerValueFaild(),
|
action.getSystemTalkAnswerConfigEntity().getAnswerValueFaild(),
|
||||||
AskTypeEnum.ALARM_CLOCK.getCode()).flatMap(m -> {
|
AskTypeEnum.ALARM_CLOCK.getCode());
|
||||||
return Mono.empty();
|
|
||||||
});
|
|
||||||
}else{
|
}else{
|
||||||
//
|
//
|
||||||
return Mono.just(false);
|
if(alarmClock.getRepeat().equals(AlarmRepeatEnum.ONE.getCode())){
|
||||||
|
//一次性提醒的
|
||||||
|
return deleteAlarm(action, baseSession, alarmClock, request, actionTime);
|
||||||
|
}else{
|
||||||
|
if((alarmClock.getRepeatDay().intValue() & rDay.intValue()) != rDay.intValue()) {
|
||||||
|
alarmClock.setRepeatDay(alarmClock.getRepeatDay() | rDay);
|
||||||
|
log.info("要删除的闹钟没有该日期:{}", alarmClock);
|
||||||
|
return baseWebSocketService.sendMessage(action,
|
||||||
|
baseSession ,
|
||||||
|
action.getSystemTalkAnswerConfigEntity().getAnswerValueFaild(),
|
||||||
|
AskTypeEnum.ALARM_CLOCK.getCode());
|
||||||
|
}else{
|
||||||
|
rDay = (alarmClock.getRepeatDay().intValue() ^ rDay.intValue());
|
||||||
|
if(rDay.intValue() == 0){
|
||||||
|
//删除闹钟
|
||||||
|
//先判断是否去掉文案
|
||||||
|
return deleteAlarm(action, baseSession, alarmClock, request, actionTime);
|
||||||
|
}else{
|
||||||
|
//更新闹钟
|
||||||
|
alarmClock.setRepeatDay(rDay);
|
||||||
|
return updateAlarmClock(action, baseSession, alarmClock, request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Mono<Boolean> deleteAlarm(Action action,
|
||||||
|
BaseSession baseSession,
|
||||||
|
DeviceAlarmClockRecordEntity alarmClock,
|
||||||
|
DeviceAlarmClockRecordRequest request,
|
||||||
|
ActionTime actionTime){
|
||||||
|
//先判断是否去掉文案
|
||||||
|
if(StringUtils.isNotEmpty(alarmClock.getReadText())){
|
||||||
|
if(alarmClock.getReadText().contains(action.getNoTimeAsk())){
|
||||||
|
alarmClock.setReadText(alarmClock.getReadText().replace(action.getNoTimeAsk(), ""));
|
||||||
|
if(StringUtils.isNotEmpty(alarmClock.getReadText())){
|
||||||
|
//去除头尾的,
|
||||||
|
if(alarmClock.getReadText().startsWith(SPLIT)){
|
||||||
|
alarmClock.setReadText(alarmClock.getReadText().substring(SPLIT.length()));
|
||||||
|
}else if(alarmClock.getReadText().endsWith(SPLIT)){
|
||||||
|
alarmClock.setReadText(alarmClock.getReadText().substring(0, alarmClock.getReadText().length() - SPLIT.length()));
|
||||||
|
}
|
||||||
|
|
||||||
|
alarmClock.setAction(alarmClock.getReadText());
|
||||||
|
//更新闹钟
|
||||||
|
//会有问题,有多个物联网操作。会导致最后取消改闹钟下的物联网操作,而不是某天的
|
||||||
|
return updateAlarmClock(action, baseSession, alarmClock, request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return deviceAlarmClockRecordService.deleteDeviceAlarmClockRecordById(alarmClock.getId()).flatMap(i -> {
|
||||||
|
Long deleteId = alarmClock.getId();
|
||||||
|
alarmClock.setId(null);
|
||||||
|
return sendAlarmClockMessage(action, baseSession, alarmClock, null, deleteId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private Mono<Boolean> addAlarm(Action action,
|
private Mono<Boolean> addAlarm(Action action,
|
||||||
BaseSession baseSession,
|
BaseSession baseSession,
|
||||||
DeviceAlarmClockRecordEntity alarmClock,
|
DeviceAlarmClockRecordEntity alarmClock,
|
||||||
@ -192,7 +285,8 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
|
|||||||
action,
|
action,
|
||||||
baseSession,
|
baseSession,
|
||||||
alarmClock,
|
alarmClock,
|
||||||
request);
|
request,
|
||||||
|
null);
|
||||||
}else{
|
}else{
|
||||||
//随机音乐
|
//随机音乐
|
||||||
alarmClock.setSoundType(YesNo.YES.getCode());
|
alarmClock.setSoundType(YesNo.YES.getCode());
|
||||||
@ -204,7 +298,8 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
|
|||||||
action,
|
action,
|
||||||
baseSession,
|
baseSession,
|
||||||
alarmClock,
|
alarmClock,
|
||||||
request);
|
request,
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -215,7 +310,8 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
|
|||||||
if(StringUtils.isNotEmpty(alarmClock.getReadText()) &&
|
if(StringUtils.isNotEmpty(alarmClock.getReadText()) &&
|
||||||
StringUtils.isNotEmpty(action.getNoTimeAsk()) &&
|
StringUtils.isNotEmpty(action.getNoTimeAsk()) &&
|
||||||
!alarmClock.getReadText().contains(action.getNoTimeAsk())){
|
!alarmClock.getReadText().contains(action.getNoTimeAsk())){
|
||||||
alarmClock.setReadText(alarmClock.getReadText() + "," + action.getNoTimeAsk());
|
alarmClock.setReadText(alarmClock.getReadText() + SPLIT + action.getNoTimeAsk());
|
||||||
|
alarmClock.setAction(alarmClock.getReadText());
|
||||||
log.info("修改提醒文案:{}", alarmClock);
|
log.info("修改提醒文案:{}", alarmClock);
|
||||||
isUpdate = true;
|
isUpdate = true;
|
||||||
}
|
}
|
||||||
@ -227,31 +323,41 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isUpdate){
|
if(isUpdate){
|
||||||
return deviceAlarmClockRecordService.updateDeviceAlarmClockRecordById(alarmClock).flatMap(i -> {
|
return updateAlarmClock(action, baseSession, alarmClock, request);
|
||||||
action.getSystemTalkAnswerConfigEntity().setAnswerValue("修改闹钟," + action.getSystemTalkAnswerConfigEntity().getAnswerValue());
|
|
||||||
return sendAlarmClockMessage(action, baseSession, alarmClock, request.getRepeat());
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
log.info("不修改:{},添加的天数{}", alarmClock, rDay);
|
||||||
|
return baseWebSocketService.sendMessage(action,
|
||||||
|
baseSession ,
|
||||||
|
action.getSystemTalkAnswerConfigEntity().getAnswerValueFaild(),
|
||||||
|
AskTypeEnum.ALARM_CLOCK.getCode());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
log.info("不修改:{},添加的天数{}", alarmClock, rDay);
|
|
||||||
return baseWebSocketService.sendMessage(action,
|
}
|
||||||
baseSession ,
|
|
||||||
action.getSystemTalkAnswerConfigEntity().getAnswerValueFaild(),
|
private Mono<Boolean> updateAlarmClock(Action action,
|
||||||
AskTypeEnum.ALARM_CLOCK.getCode()).flatMap(m -> {
|
BaseSession baseSession,
|
||||||
return Mono.empty();
|
DeviceAlarmClockRecordEntity alarmClock,
|
||||||
|
DeviceAlarmClockRecordRequest request){
|
||||||
|
return deviceAlarmClockRecordService.deleteDeviceAlarmClockRecordById(alarmClock.getId()).flatMap(i -> {
|
||||||
|
action.getSystemTalkAnswerConfigEntity().setAnswerValue("修改闹钟," + action.getSystemTalkAnswerConfigEntity().getAnswerValue());
|
||||||
|
Long deleteId = alarmClock.getId();
|
||||||
|
alarmClock.setId(null);
|
||||||
|
return addAlarmClockMessage(action, baseSession, alarmClock, request, deleteId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mono<Boolean> addAlarmClockMessage(Action action,
|
private Mono<Boolean> addAlarmClockMessage(Action action,
|
||||||
BaseSession baseSession,
|
BaseSession baseSession,
|
||||||
DeviceAlarmClockRecordEntity alarmClock,
|
DeviceAlarmClockRecordEntity alarmClock,
|
||||||
DeviceAlarmClockRecordRequest request){
|
DeviceAlarmClockRecordRequest request,
|
||||||
|
Long deleteId){
|
||||||
|
|
||||||
return deviceAlarmClockRecordService.insert(alarmClock).flatMap(i -> {
|
return deviceAlarmClockRecordService.insert(alarmClock).flatMap(i -> {
|
||||||
return deviceAlarmClockRecordService.selectDeviceAlarmClockRecordByRequest(request).flatMap(
|
return deviceAlarmClockRecordService.selectDeviceAlarmClockRecordByRequest(request).flatMap(
|
||||||
alarm -> {
|
alarm -> {
|
||||||
return sendAlarmClockMessage(action, baseSession, alarm, request.getRepeat());
|
return sendAlarmClockMessage(action, baseSession, alarm, request.getRepeat(), deleteId);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -262,49 +368,56 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
|
|||||||
private Mono<Boolean> sendAlarmClockMessage(Action action,
|
private Mono<Boolean> sendAlarmClockMessage(Action action,
|
||||||
BaseSession baseSession,
|
BaseSession baseSession,
|
||||||
DeviceAlarmClockRecordEntity alarm,
|
DeviceAlarmClockRecordEntity alarm,
|
||||||
Integer repeat){
|
Integer repeat,
|
||||||
|
Long deleteId){
|
||||||
List<Integer> dayOfWeek = null;
|
List<Integer> dayOfWeek = null;
|
||||||
String msg = action.getSystemTalkAnswerConfigEntity().getAnswerValue();
|
String msg = action.getSystemTalkAnswerConfigEntity().getAnswerValue();
|
||||||
if(!repeat.equals(AlarmRepeatEnum.ONE.getCode())){
|
if(repeat != null){
|
||||||
if(alarm.getRepeatDay().intValue() == 0x7f){
|
if(!repeat.equals(AlarmRepeatEnum.ONE.getCode())){
|
||||||
msg.replace("#day#", "每天");
|
if(alarm.getRepeatDay().intValue() == 0x7f){
|
||||||
dayOfWeek = new ArrayList<Integer>(){
|
msg.replace("#day#", "每天");
|
||||||
{
|
dayOfWeek = new ArrayList<Integer>(){
|
||||||
add(1);
|
{
|
||||||
add(2);
|
add(1);
|
||||||
add(3);
|
add(2);
|
||||||
add(4);
|
add(3);
|
||||||
add(5);
|
add(4);
|
||||||
add(6);
|
add(5);
|
||||||
add(7);
|
add(6);
|
||||||
}
|
add(7);
|
||||||
};
|
}
|
||||||
}else{
|
};
|
||||||
dayOfWeek = new ArrayList<Integer>();
|
}else{
|
||||||
int o = 0x01;
|
dayOfWeek = new ArrayList<Integer>();
|
||||||
int day = alarm.getRepeatDay().intValue();
|
int o = 0x01;
|
||||||
String v = "";
|
int day = alarm.getRepeatDay().intValue();
|
||||||
for(int i = 0; i < 7; i++){
|
String v = "";
|
||||||
if((day & o) == o){
|
for(int i = 0; i < 7; i++){
|
||||||
v += "周" + (i + 1);
|
if((day & o) == o){
|
||||||
|
v += "周" + (i + 1);
|
||||||
|
|
||||||
|
dayOfWeek.add(i + 1);
|
||||||
|
}
|
||||||
|
|
||||||
o <<= 1;
|
o <<= 1;
|
||||||
dayOfWeek.add(i + 1);
|
|
||||||
}
|
}
|
||||||
|
msg = msg.replace("#day#", v);
|
||||||
|
SimpleDateFormat df = new SimpleDateFormat("H点m分");
|
||||||
|
msg = msg.replace("#time#", df.format(alarm.getTime()));
|
||||||
}
|
}
|
||||||
msg = msg.replace("#day#", v);
|
}else{
|
||||||
SimpleDateFormat df = new SimpleDateFormat("H点m分");
|
msg = msg.replace("#time#", "");
|
||||||
msg = msg.replace("#time#", df.format(alarm.getTime()));
|
SimpleDateFormat df = new SimpleDateFormat("yyyy年M月d日H点m分");
|
||||||
|
msg = msg.replace("#day#", df.format(alarm.getTime()));
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
msg = msg.replace("#time#", "");
|
|
||||||
SimpleDateFormat df = new SimpleDateFormat("yyyy年M月d日H点m分");
|
|
||||||
msg = msg.replace("#day#", df.format(alarm.getTime()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BoxMessageResp resp = new BoxMessageResp();
|
BoxMessageResp resp = new BoxMessageResp();
|
||||||
ActionResp actionResp = new ActionResp();
|
ActionResp actionResp = new ActionResp();
|
||||||
actionResp.setId(alarm.getId());
|
actionResp.setId(alarm.getId());
|
||||||
|
actionResp.setDeleteId(deleteId);
|
||||||
actionResp.setTime(alarm.getTime());
|
actionResp.setTime(alarm.getTime());
|
||||||
SimpleDateFormat df = new SimpleDateFormat("H:m");
|
SimpleDateFormat df = new SimpleDateFormat("H:m");
|
||||||
String v = df.format(alarm.getTime());
|
String v = df.format(alarm.getTime());
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package com.qiuguo.iot.box.websocket.api.command;
|
package com.qiuguo.iot.box.websocket.api.command;
|
||||||
|
|
||||||
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.ActionStatusEnum;
|
||||||
import com.qiuguo.iot.base.utils.StringUtils;
|
import com.qiuguo.iot.base.utils.StringUtils;
|
||||||
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.BaseSession;
|
import com.qiuguo.iot.box.websocket.api.domain.BaseSession;
|
||||||
@ -38,21 +38,21 @@ public class MusicActionCommand extends ActionCommand implements IActionCommand
|
|||||||
log.info("定期打开音乐播放");
|
log.info("定期打开音乐播放");
|
||||||
return alarmClockActionCommand.process(action, baseSession);
|
return alarmClockActionCommand.process(action, baseSession);
|
||||||
}
|
}
|
||||||
if(action.getSystemTalkAnswerConfigEntity().getActionStatus().equals(PlayEnum.START.getCode())){
|
if(action.getSystemTalkAnswerConfigEntity().getActionStatus().equals(ActionStatusEnum.START.getCode())){
|
||||||
return musicService.searchMusic(search, 1).defaultIfEmpty(new ArrayList<>()).flatMap(resultSongs -> {
|
return musicService.searchMusic(search, 1).defaultIfEmpty(new ArrayList<>()).flatMap(resultSongs -> {
|
||||||
//BoxMessageResp resp = new BoxMessageResp();
|
//BoxMessageResp resp = new BoxMessageResp();
|
||||||
MusicResp musicResp = new MusicResp();
|
MusicResp musicResp = new MusicResp();
|
||||||
if(resultSongs.size() > 0){
|
if(resultSongs.size() > 0){
|
||||||
//
|
//
|
||||||
SongInfoResponse.ResultSong song = resultSongs.get(0);
|
SongInfoResponse.ResultSong song = resultSongs.get(0);
|
||||||
musicResp.setPlay(PlayEnum.START.getCode());
|
musicResp.setPlay(ActionStatusEnum.START.getCode());
|
||||||
musicResp.setName(song.getName());
|
musicResp.setName(song.getName());
|
||||||
musicResp.setUrl(song.getUrl());
|
musicResp.setUrl(song.getUrl());
|
||||||
musicResp.setSinger(song.getArtistName());
|
musicResp.setSinger(song.getArtistName());
|
||||||
resp.setText("现在为您播放" + song.getName() +
|
resp.setText("现在为您播放" + song.getName() +
|
||||||
(StringUtils.isNotEmpty(song.getArtistName()) ? ("来自" + song.getArtistName()) : ""));
|
(StringUtils.isNotEmpty(song.getArtistName()) ? ("来自" + song.getArtistName()) : ""));
|
||||||
}else{
|
}else{
|
||||||
musicResp.setPlay(PlayEnum.NONE.getCode());
|
musicResp.setPlay(ActionStatusEnum.NONE.getCode());
|
||||||
resp.setText("未找到相关资源");
|
resp.setText("未找到相关资源");
|
||||||
}
|
}
|
||||||
resp.setMusic(musicResp);
|
resp.setMusic(musicResp);
|
||||||
@ -82,7 +82,7 @@ public class MusicActionCommand extends ActionCommand implements IActionCommand
|
|||||||
if(boxSession != null){
|
if(boxSession != null){
|
||||||
baseWebSocketService.sendMsg(boxSession, resp);
|
baseWebSocketService.sendMsg(boxSession, resp);
|
||||||
//记录音乐状态
|
//记录音乐状态
|
||||||
if(resp.getMusic().getPlay().equals(PlayEnum.STOP.getCode())){
|
if(resp.getMusic().getPlay().equals(ActionStatusEnum.STOP.getCode())){
|
||||||
//去掉内存中音乐同步对象
|
//去掉内存中音乐同步对象
|
||||||
boxSession.setMusic(null);
|
boxSession.setMusic(null);
|
||||||
baseSession.setMusic(null);
|
baseSession.setMusic(null);
|
||||||
@ -104,7 +104,7 @@ public class MusicActionCommand extends ActionCommand implements IActionCommand
|
|||||||
//记录音乐状态
|
//记录音乐状态
|
||||||
//去掉内存中音乐同步对象
|
//去掉内存中音乐同步对象
|
||||||
if(userSession != null){
|
if(userSession != null){
|
||||||
if(resp.getMusic().getPlay().equals(PlayEnum.STOP.getCode())){
|
if(resp.getMusic().getPlay().equals(ActionStatusEnum.STOP.getCode())){
|
||||||
baseSession.setMusic(null);
|
baseSession.setMusic(null);
|
||||||
userSession.setMusic(null);
|
userSession.setMusic(null);
|
||||||
}else{
|
}else{
|
||||||
@ -113,7 +113,7 @@ public class MusicActionCommand extends ActionCommand implements IActionCommand
|
|||||||
}
|
}
|
||||||
//如果在线推送用户端
|
//如果在线推送用户端
|
||||||
}else{
|
}else{
|
||||||
if(resp.getMusic().getPlay().equals(PlayEnum.STOP.getCode())){
|
if(resp.getMusic().getPlay().equals(ActionStatusEnum.STOP.getCode())){
|
||||||
baseSession.setMusic(null);
|
baseSession.setMusic(null);
|
||||||
}else{
|
}else{
|
||||||
baseSession.setMusic(resp.getMusic());
|
baseSession.setMusic(resp.getMusic());
|
||||||
|
|||||||
@ -18,6 +18,11 @@ public class ActionResp {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Long id;
|
Long id;
|
||||||
|
/**
|
||||||
|
* 删除客户端对应ID,闹钟id
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Long deleteId;
|
||||||
/**
|
/**
|
||||||
* 小时
|
* 小时
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user