增加冒号时间的支持
This commit is contained in:
parent
179a0c090c
commit
4dd4ed0225
@ -29,6 +29,7 @@ public enum AskTypeEnum {
|
||||
QIU_GUO(300, "秋果专有名词"),
|
||||
USER_CONFIG(301, "根据用户编号回答不同"),
|
||||
IGNORE(400, "^^^"),//全部、所有、一切等忽略此
|
||||
EXCOMMAND(2000, "扩展指令"),//全部、所有、一切等忽略此
|
||||
;
|
||||
AskTypeEnum(Integer c, String n){
|
||||
code = c;
|
||||
|
||||
@ -209,6 +209,17 @@ public class ChineseDateTimeUtils {
|
||||
return new ReturnDate(setSeconds(c, "秒前", localDateTime, 1), ampm, type);
|
||||
}else if(c.contains("秒")){
|
||||
return new ReturnDate(setSecond(c, "秒", localDateTime), ampm, type);
|
||||
}else if(c.contains(":")){
|
||||
String[] p = c.split(":");
|
||||
int hour = Integer.parseInt(p[0]);
|
||||
int minute = Integer.parseInt(p[1]);
|
||||
int sec = 0;
|
||||
if(p.length > 2){
|
||||
sec = Integer.parseInt(p[2]);
|
||||
}
|
||||
localDateTime = localDateTime.withSecond(sec).withHour(hour).withMinute(minute);
|
||||
|
||||
return new ReturnDate(localDateTime, ampm, type);
|
||||
}else if(c.length() > 0){
|
||||
//最后一个数字转换
|
||||
Integer i = ChineseToAlaboUtils.getLong(c).intValue();
|
||||
|
||||
@ -37,6 +37,10 @@ public class SystemTalkAnswerConfigEntity extends GenericEntity<Long> {
|
||||
@Column(name = "user_id", nullable = false)
|
||||
private Long userId;
|
||||
|
||||
@Comment("父类ID,本表的ID。当时扩展指令时才有(answer_typeeeeee>1000)")
|
||||
@Column(name = "parent_id", nullable = false)
|
||||
private Long parentId;
|
||||
|
||||
@Comment("问题关键字")
|
||||
@Column(name = "ask_key", length = 100)
|
||||
private String askKey;
|
||||
@ -69,13 +73,13 @@ public class SystemTalkAnswerConfigEntity extends GenericEntity<Long> {
|
||||
@Column(name = "key_order", nullable = false)
|
||||
private Long keyOrder;
|
||||
|
||||
@Comment("回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 7:古诗、诗歌、诗 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 301:根据用户编号回答不同 400:全部,所有,一切忽略词")
|
||||
@Comment("回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 7:古诗、诗歌、诗(千问)20:退出聆听 99:千问回答100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 301:根据用户编号回答不同 400:全部,所有,一切忽略词 2000:需要扩展的指令 扩展后的指令需要除以该值得到answer_type值")
|
||||
@Column(name = "answer_type", nullable = false)
|
||||
private Integer answerType;
|
||||
|
||||
@Comment("音频时播放状态:0 开始播放 1 暂停 2 继续 3 停止 10无此资源")
|
||||
@Column(name = "play_type", nullable = false)
|
||||
private Integer playType;
|
||||
@Comment("动作状态:0 开始播放 1 暂停 2 继续 3 停止 10无此资源\n")
|
||||
@Column(name = "action_status", nullable = false)
|
||||
private Integer actionStatus;
|
||||
|
||||
@Comment("处理Bean名字,空使用qianWenActionCommand(动词后的量词、关键字等除外200,400)")
|
||||
@Column(name = "bean_name", nullable = false)
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package com.qiuguo.iot.data.model.system;
|
||||
|
||||
import com.qiuguo.iot.data.entity.system.SystemTalkAnswerConfigEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Data
|
||||
public class SystemTalkAnswerConfig {
|
||||
ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> exCommand;
|
||||
SystemTalkAnswerConfigEntity systemTalkAnswerConfig;
|
||||
}
|
||||
@ -33,6 +33,10 @@ public class SystemTalkAnswerConfigRequest implements java.io.Serializable {
|
||||
private Date modifyTimeEnd;
|
||||
//用户id
|
||||
private Long userId;
|
||||
/**
|
||||
* 父类ID,本表的ID。当时扩展指令时才有(answer_typeeeeee>1000)
|
||||
*/
|
||||
private Long parentId;
|
||||
//问题关键字
|
||||
private String askKey;
|
||||
//回答内容(传给box)
|
||||
@ -55,7 +59,7 @@ public class SystemTalkAnswerConfigRequest implements java.io.Serializable {
|
||||
private Long keyOrder;
|
||||
|
||||
/**
|
||||
* 回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 7:古诗、诗歌、诗 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 301:根据用户编号回答不同 400:全部,所有,一切忽略词
|
||||
* 回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 7:古诗、诗歌、诗(千问)20:退出聆听 99:千问回答100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 301:根据用户编号回答不同 400:全部,所有,一切忽略词 2000:需要扩展的指令 扩展后的指令需要除以该值得到answer_type值
|
||||
*/
|
||||
private Integer answerType;
|
||||
|
||||
@ -63,7 +67,7 @@ public class SystemTalkAnswerConfigRequest implements java.io.Serializable {
|
||||
* 音频时播放状态:0 开始播放 1 暂停 2 继续 3 停止 10无此资源
|
||||
*/
|
||||
|
||||
private Integer playType;
|
||||
private Integer actionStatus;
|
||||
|
||||
/**
|
||||
* 处理Bean名字
|
||||
|
||||
@ -13,6 +13,10 @@ public class SystemTalkAnswerConfigResp {
|
||||
private Long id;
|
||||
//用户id
|
||||
private Long userId;
|
||||
/**
|
||||
* 父类ID,本表的ID。当时扩展指令时才有(answer_typeeeeee>1000)
|
||||
*/
|
||||
private Long parentId;
|
||||
//问题关键字
|
||||
private String askKey;
|
||||
//回答内容(传给box)
|
||||
@ -33,7 +37,7 @@ public class SystemTalkAnswerConfigResp {
|
||||
private Long keyOrder;
|
||||
|
||||
/**
|
||||
* 回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 7:古诗、诗歌、诗 100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 301:根据用户编号回答不同 400:全部,所有,一切忽略词
|
||||
* 回答类型0:文本问答 1:iOT控制 2:天气 3:闹钟 4:U3D 5:音乐声音 6:询问时间 7:古诗、诗歌、诗(千问)20:退出聆听 99:千问回答100:固件升级 101:Box上线 200:动作后必须跟的名称词 300秋果专有名词 301:根据用户编号回答不同 400:全部,所有,一切忽略词 2000:需要扩展的指令 扩展后的指令需要除以该值得到answer_type值
|
||||
*/
|
||||
private Integer answerType;
|
||||
|
||||
@ -41,7 +45,7 @@ public class SystemTalkAnswerConfigResp {
|
||||
* 音频时播放状态:0 开始播放 1 暂停 2 继续 3 停止 10无此资源
|
||||
*/
|
||||
|
||||
private Integer playType;
|
||||
private Integer actionStatus;
|
||||
|
||||
/**
|
||||
* 处理Bean名字
|
||||
|
||||
@ -3,11 +3,9 @@ package com.qiuguo.iot.data.service.system;
|
||||
|
||||
import com.qiuguo.iot.base.enums.AskTypeEnum;
|
||||
import com.qiuguo.iot.base.utils.StringUtils;
|
||||
import com.qiuguo.iot.data.entity.device.DeviceAlarmClockMusicEntity;
|
||||
import com.qiuguo.iot.data.entity.system.SystemTalkAnswerConfigEntity;
|
||||
import com.qiuguo.iot.data.entity.user.UserHandlingDeviceEntity;
|
||||
import com.qiuguo.iot.data.model.system.SystemTalkAnswerConfig;
|
||||
import com.qiuguo.iot.data.request.system.SystemTalkAnswerConfigRequest;
|
||||
import com.qiuguo.iot.data.request.user.UserHandlingDeviceRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hswebframework.ezorm.core.param.Sort;
|
||||
import org.hswebframework.ezorm.rdb.mapping.ReactiveQuery;
|
||||
@ -17,10 +15,7 @@ import org.hswebframework.web.api.crud.entity.PagerResult;
|
||||
import org.hswebframework.web.api.crud.entity.QueryParamEntity;
|
||||
import org.hswebframework.web.crud.service.GenericReactiveCrudService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.core.scheduler.Scheduler;
|
||||
import reactor.core.scheduler.Schedulers;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@ -47,7 +42,7 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
/**
|
||||
* 内存中缓存这些数据自定义指令,正常这些数据不会很多
|
||||
*/
|
||||
private static ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> group = new ConcurrentHashMap<>();
|
||||
private static ConcurrentHashMap<String, SystemTalkAnswerConfig> group = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 内存中缓存这些数据自定义指令,正常这些数据不会很多
|
||||
@ -62,10 +57,31 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
groupCommand.clear();
|
||||
ReactiveQuery<SystemTalkAnswerConfigEntity> reactiveQuery = createQuery();
|
||||
reactiveQuery = reactiveQuery.and("is_delete", 0);
|
||||
|
||||
reactiveQuery = reactiveQuery.lte("answer_type", AskTypeEnum.EXCOMMAND.getCode());
|
||||
reactiveQuery.paging(0, MAX_COUT.intValue()).fetch().map(item ->{
|
||||
if(item.getAnswerType() < AskTypeEnum.UPDATE.getCode()) {
|
||||
group.put(item.getAskKey(), item);
|
||||
SystemTalkAnswerConfig systemTalkAnswerConfig = new SystemTalkAnswerConfig();
|
||||
systemTalkAnswerConfig.setSystemTalkAnswerConfig(item);
|
||||
group.put(item.getAskKey(), systemTalkAnswerConfig);
|
||||
}else if(item.getAnswerType().equals(AskTypeEnum.EXCOMMAND.getCode())) {
|
||||
//group.put(item.getAskKey(), item);
|
||||
SystemTalkAnswerConfig systemTalkAnswerConfig = new SystemTalkAnswerConfig();
|
||||
systemTalkAnswerConfig.setExCommand(new ConcurrentHashMap<>());
|
||||
systemTalkAnswerConfig.setSystemTalkAnswerConfig(item);
|
||||
group.put(item.getAskKey(), systemTalkAnswerConfig);
|
||||
ReactiveQuery<SystemTalkAnswerConfigEntity> reactiveQuery1 = createQuery();
|
||||
reactiveQuery1 = reactiveQuery1.and("is_delete", 0);
|
||||
reactiveQuery1 = reactiveQuery1.and("parent_id", item.getId());
|
||||
reactiveQuery1 = reactiveQuery1.gt("answer_type", AskTypeEnum.EXCOMMAND.getCode());
|
||||
reactiveQuery1.paging(0, MAX_COUT.intValue()).fetch().map(item1 ->{
|
||||
systemTalkAnswerConfig.getExCommand().put(item.getAskKey(), item1);
|
||||
return item1;
|
||||
}).doFinally(signalType -> {
|
||||
log.info("配置扩展最多读取{}条,实际读取了{}条扩展指令",
|
||||
MAX_COUT,
|
||||
systemTalkAnswerConfig.getExCommand().size());
|
||||
}).subscribe();
|
||||
|
||||
}else{
|
||||
groupCommand.add(item);
|
||||
}
|
||||
@ -98,6 +114,9 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
if(request.getUserId() != null){
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getUserId, request.getUserId());
|
||||
}
|
||||
if(request.getParentId() != null){
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getParentId, request.getParentId());
|
||||
}
|
||||
if(StringUtils.isNotEmpty(request.getAskKey())){
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getAskKey, request.getAskKey());
|
||||
}
|
||||
@ -126,8 +145,8 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getAnswerType, request.getAnswerType());
|
||||
}
|
||||
|
||||
if(request.getPlayType() != null){
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getPlayType, request.getPlayType());
|
||||
if(request.getActionStatus() != null){
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getActionStatus, request.getActionStatus());
|
||||
}
|
||||
if(StringUtils.isNotEmpty(request.getBeanName())){
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getBeanName, request.getBeanName());
|
||||
@ -170,6 +189,9 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
if(request.getUserId() != null){
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getUserId, request.getUserId());
|
||||
}
|
||||
if(request.getParentId() != null){
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getParentId, request.getParentId());
|
||||
}
|
||||
if(StringUtils.isNotEmpty(request.getAskKey())){
|
||||
reactiveQuery = reactiveQuery.$like$(SystemTalkAnswerConfigRequest::getAskKey, request.getAskKey());
|
||||
}
|
||||
@ -197,8 +219,8 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
if(request.getKeyOrder() != null){
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getKeyOrder, request.getKeyOrder());
|
||||
}
|
||||
if(request.getPlayType() != null){
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getPlayType, request.getPlayType());
|
||||
if(request.getActionStatus() != null){
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getActionStatus, request.getActionStatus());
|
||||
}
|
||||
if(StringUtils.isNotEmpty(request.getBeanName())){
|
||||
reactiveQuery = reactiveQuery.and(SystemTalkAnswerConfigRequest::getBeanName, request.getBeanName());
|
||||
@ -250,6 +272,9 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
if(entity.getUserId() != null){
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getUserId, entity.getUserId());
|
||||
}
|
||||
if(entity.getParentId() != null){
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getParentId, entity.getParentId());
|
||||
}
|
||||
if(StringUtils.isNotEmpty(entity.getAskKey())){
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getAskKey, entity.getAskKey());
|
||||
}
|
||||
@ -277,8 +302,8 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
if(entity.getAnswerType() != null){
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getAnswerType, entity.getAnswerType());
|
||||
}
|
||||
if(entity.getPlayType() != null){
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getPlayType, entity.getPlayType());
|
||||
if(entity.getActionStatus() != null){
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getActionStatus, entity.getActionStatus());
|
||||
}
|
||||
if(StringUtils.isNotEmpty(entity.getBeanName())){
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getBeanName, entity.getBeanName());
|
||||
@ -293,6 +318,7 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
.set(SystemTalkAnswerConfigEntity::getModifyTime, new Date());
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getIsDelete, entity.getIsDelete());
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getUserId, entity.getUserId());
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getParentId, entity.getParentId());
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getAskKey, entity.getAskKey());
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getAnswerValue, entity.getAnswerValue());
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getAnswerAction, entity.getAnswerAction());
|
||||
@ -302,7 +328,7 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getAnswerBackImg, entity.getAnswerBackImg());
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getKeyOrder, entity.getKeyOrder());
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getAnswerType, entity.getAnswerType());
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getPlayType, entity.getPlayType());
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getActionStatus, entity.getActionStatus());
|
||||
update = update.set(SystemTalkAnswerConfigEntity::getBeanName, entity.getBeanName());
|
||||
return update.where(SystemTalkAnswerConfigEntity::getId, entity.getId()).and("is_delete", 0).execute();
|
||||
}
|
||||
@ -320,12 +346,12 @@ public class SystemTalkAnswerConfigService extends GenericReactiveCrudService<Sy
|
||||
|
||||
public SystemTalkAnswerConfigEntity getSystemTalkWithKey(String key) {
|
||||
if(group.containsKey(key)){
|
||||
return group.get(key);
|
||||
return group.get(key).getSystemTalkAnswerConfig();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> getSystemTalkWithKeyGroup() {
|
||||
public ConcurrentHashMap<String, SystemTalkAnswerConfig> getSystemTalkWithKeyGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import com.qiuguo.iot.base.enums.AskTypeEnum;
|
||||
import com.qiuguo.iot.base.utils.StringUtils;
|
||||
import com.qiuguo.iot.data.entity.device.DeviceUserBindEntity;
|
||||
import com.qiuguo.iot.data.entity.system.SystemTalkAnswerConfigEntity;
|
||||
import com.qiuguo.iot.data.model.system.SystemTalkAnswerConfig;
|
||||
import com.qiuguo.iot.third.nlp.action.Action;
|
||||
import com.qiuguo.iot.third.nlp.action.ActionTime;
|
||||
import com.qiuguo.iot.third.nlp.action.Actions;
|
||||
@ -24,7 +25,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
|
||||
v(0, "动词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -32,9 +33,10 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
List<DeviceUserBindEntity> includs,
|
||||
List<SystemTalkAnswerConfigEntity> commands){
|
||||
action.setAction(key);
|
||||
SystemTalkAnswerConfigEntity entity = getSystemTalkWithKey(action.getAction(), keyGroup);
|
||||
SystemTalkAnswerConfigEntity entity = getSystemTalkWithKey(action.getAction(), keyGroup, action.getNoTimeAsk());
|
||||
if(entity != null){
|
||||
systemTalkAnswerConfigEntities.add(entity);
|
||||
|
||||
}
|
||||
actions.setA(1);
|
||||
return action;
|
||||
@ -42,7 +44,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
/*vd(0, "副动词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -54,7 +56,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
vn(0, "名动词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -69,7 +71,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
|
||||
ng(1, "名语素"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -81,7 +83,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
nr(2, "人名"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -93,7 +95,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},//LAC PER
|
||||
PER(2, "人名"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -105,7 +107,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
ns(3, "地名"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -117,7 +119,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},*/
|
||||
nt(4, "机构团体"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -130,7 +132,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
ORG(4, "机构团体"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -142,7 +144,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
LOC(4, "机构团体"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -154,7 +156,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
nz(5, "其他专名"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -166,7 +168,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
n(6, "名词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -174,7 +176,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
List<DeviceUserBindEntity> includs,
|
||||
List<SystemTalkAnswerConfigEntity> commands){
|
||||
//匹配到关键词就不能作为名词加入,未匹配到的,分割前的都加入名词
|
||||
SystemTalkAnswerConfigEntity entity = getSystemTalkWithKey(key, keyGroup);
|
||||
SystemTalkAnswerConfigEntity entity = getSystemTalkWithKey(key, keyGroup, action.getNoTimeAsk());
|
||||
if(entity != null){
|
||||
if(!entity.getAnswerType().equals(AskTypeEnum.COMMAND_N.getCode())){
|
||||
systemTalkAnswerConfigEntities.add(entity);
|
||||
@ -182,7 +184,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
//已记录的加进去
|
||||
if(StringUtils.isNotEmpty(actions.getName())){
|
||||
//
|
||||
entity = getSystemTalkWithKey(actions.getName(), keyGroup);
|
||||
entity = getSystemTalkWithKey(actions.getName(), keyGroup, action.getNoTimeAsk());
|
||||
if(entity != null){
|
||||
systemTalkAnswerConfigEntities.add(entity);
|
||||
actions.setA(1);
|
||||
@ -218,7 +220,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
q(7, "量词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -231,7 +233,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
|
||||
/*b(8, "区别词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -243,7 +245,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},*/
|
||||
c(9, "连接词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -251,7 +253,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
List<DeviceUserBindEntity> includs,
|
||||
List<SystemTalkAnswerConfigEntity> commands){
|
||||
if(StringUtils.isNotEmpty(actions.getName())){
|
||||
SystemTalkAnswerConfigEntity entity = getSystemTalkWithKey(actions.getName(), keyGroup);
|
||||
SystemTalkAnswerConfigEntity entity = getSystemTalkWithKey(actions.getName(), keyGroup, action.getNoTimeAsk());
|
||||
if(entity != null){
|
||||
if(!entity.getAnswerType().equals(AskTypeEnum.COMMAND_N.getCode())){
|
||||
systemTalkAnswerConfigEntities.add(entity);
|
||||
@ -285,7 +287,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
/*dg(10, "副语素"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -297,7 +299,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
d(10, "副词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -309,7 +311,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
e(11, "叹词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -321,7 +323,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
f(12, "方位词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -333,7 +335,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
g(13, "语素"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -345,7 +347,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
h(14, "前街成分"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -357,7 +359,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},//LAC t
|
||||
i(15, "成语"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -369,7 +371,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},//LAC vn
|
||||
j(16, "简称略语"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -381,7 +383,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
k(17, "后接成分"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -393,7 +395,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
l(18, "习惯用语"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -405,7 +407,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},*/
|
||||
m(19, "数词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -416,7 +418,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
//上个是时间词,可能后面数字也是时间词
|
||||
return t.getAction(keyGroup, key, actions, action, systemTalkAnswerConfigEntities, includs, commands);
|
||||
}else{
|
||||
SystemTalkAnswerConfigEntity entity = getSystemTalkWithKey(key, keyGroup);
|
||||
SystemTalkAnswerConfigEntity entity = getSystemTalkWithKey(key, keyGroup, action.getNoTimeAsk());
|
||||
if(entity != null){
|
||||
if(!entity.getAnswerType().equals(AskTypeEnum.COMMAND_N.getCode())){
|
||||
systemTalkAnswerConfigEntities.add(entity);
|
||||
@ -435,7 +437,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
/*o(20, "拟声词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -447,7 +449,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},*/
|
||||
p(21, "介词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -460,7 +462,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
|
||||
/*r(22, "代词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -472,7 +474,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
s(23, "触动词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -484,7 +486,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
tg(24, "时语素"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -496,7 +498,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},*/
|
||||
t(25, "时间词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -523,7 +525,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},//LAC TIME
|
||||
TIME(25, "时间词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -535,7 +537,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},//LAC TIME
|
||||
u(26, "助词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -547,7 +549,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
/*vg(27, "动语素"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -560,7 +562,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
|
||||
a(28, "形容词:包含 ad ag an"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -572,7 +574,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
/*ag(28, "形玉素"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -584,7 +586,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
ad(28, "副形词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -596,7 +598,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
an(28, "名形词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -608,7 +610,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},*/
|
||||
w(29, "标点符号"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -620,7 +622,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
/*x(30, "非语素词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -632,7 +634,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
y(31, "语气词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -644,7 +646,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},//LAC xc
|
||||
xc(31, "语气词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -656,7 +658,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},//LAC xc
|
||||
z(32, "状态词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -668,7 +670,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
un(33, "未知词"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -680,7 +682,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
zd(99, "自定义"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -693,7 +695,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
|
||||
qg(100, "在查找字符串时用来临时替换用户命名的设备,目前最多同时支持20个,见LAC字典>1<"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -730,7 +732,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
qj(101, "在查找字符串时用来临时替换系统自定义动词后面词,目前最多同时支持20个,见LAC字典>1<"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -773,7 +775,7 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
},
|
||||
DEFAULT(1000, "默认"){
|
||||
@Override
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
public Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
@ -835,9 +837,22 @@ public enum ActionPartSpeechEnum implements IChinesePartSpeech{
|
||||
}
|
||||
|
||||
private static SystemTalkAnswerConfigEntity getSystemTalkWithKey(String key,
|
||||
ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup){
|
||||
ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String ask){
|
||||
if(keyGroup.containsKey(key)){
|
||||
return keyGroup.get(key);
|
||||
SystemTalkAnswerConfig entity = keyGroup.get(key);
|
||||
if(entity.getExCommand() == null){
|
||||
return entity.getSystemTalkAnswerConfig();
|
||||
}else{
|
||||
//找到扩展指令
|
||||
for (String key1 :entity.getExCommand().keySet()){
|
||||
if(ask.contains(key1)){
|
||||
return entity.getExCommand().get(key1);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
//return keyGroup.get(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.qiuguo.iot.third.enums;
|
||||
|
||||
import com.qiuguo.iot.data.entity.device.DeviceUserBindEntity;
|
||||
import com.qiuguo.iot.data.entity.system.SystemTalkAnswerConfigEntity;
|
||||
import com.qiuguo.iot.data.model.system.SystemTalkAnswerConfig;
|
||||
import com.qiuguo.iot.third.nlp.action.Action;
|
||||
import com.qiuguo.iot.third.nlp.action.Actions;
|
||||
|
||||
@ -9,7 +10,7 @@ import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public interface IChinesePartSpeech {
|
||||
Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfigEntity> keyGroup,
|
||||
Action getAction(ConcurrentHashMap<String, SystemTalkAnswerConfig> keyGroup,
|
||||
String key,
|
||||
Actions actions,
|
||||
Action action,
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package com.qiuguo.iot.box.websocket.api.command;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.qiuguo.iot.base.enums.AlarmRepeatEnum;
|
||||
import com.qiuguo.iot.base.enums.AskTypeEnum;
|
||||
import com.qiuguo.iot.base.enums.PlayEnum;
|
||||
import com.qiuguo.iot.base.enums.YesNo;
|
||||
import com.qiuguo.iot.base.utils.StringUtils;
|
||||
import com.qiuguo.iot.box.websocket.api.domain.BaseSession;
|
||||
@ -24,7 +24,6 @@ import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -125,88 +124,123 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
|
||||
.selectDeviceAlarmClockRecordByRequest(request)
|
||||
.defaultIfEmpty(new DeviceAlarmClockRecordEntity())
|
||||
.flatMap(alarmClock ->{
|
||||
if(alarmClock.getId() == null){
|
||||
if(action.getSystemTalkAnswerConfigEntity().getActionStatus().equals(PlayEnum.START.getCode())){
|
||||
return addAlarm(action, baseSession, alarmClock, request, rDay, actionTime);
|
||||
}else{
|
||||
//删除闹钟
|
||||
return addAlarm(action, baseSession, alarmClock, request, rDay, actionTime);
|
||||
}
|
||||
|
||||
//需要新建
|
||||
alarmClock.setTimes(request.getTimes());
|
||||
alarmClock.setUserId(baseSession.getUserId());
|
||||
alarmClock.setDeviceId(baseSession.getDeviceId());
|
||||
alarmClock.setRepeatDay(rDay);
|
||||
alarmClock.setActionType(request.getActionType());
|
||||
alarmClock.setAlarmType(request.getAlarmType());
|
||||
if(!AskTypeEnum.TTS.getCode().equals(request.getActionType())){
|
||||
alarmClock.setAction(action.getNoTimeAsk());
|
||||
}
|
||||
alarmClock.setTime(
|
||||
Date.from(actionTime.getDetailTime().getLocalDateTime().atZone(ZoneId.systemDefault()).toInstant())
|
||||
);
|
||||
alarmClock.setRepeat(request.getRepeat());
|
||||
if(!alarmClock.getRepeat().equals(AlarmRepeatEnum.ONE.getCode())){
|
||||
alarmClock.setTitle("循环闹钟");
|
||||
}else{
|
||||
alarmClock.setTitle("一次性提醒");
|
||||
}
|
||||
log.info("新增闹钟:{}", alarmClock);
|
||||
});
|
||||
}
|
||||
|
||||
if(StringUtils.isNotEmpty(action.getNoTimeAsk())){
|
||||
//提示文案
|
||||
alarmClock.setReadText(action.getNoTimeAsk());
|
||||
alarmClock.setSoundType(YesNo.NO.getCode());
|
||||
alarmClock.setSoundName("文本提示");
|
||||
private Mono<Boolean> delAlarm(Action action,
|
||||
BaseSession baseSession,
|
||||
DeviceAlarmClockRecordEntity alarmClock,
|
||||
DeviceAlarmClockRecordRequest request,
|
||||
Integer rDay,
|
||||
ActionTime actionTime) {
|
||||
if (alarmClock.getId() == null) {
|
||||
log.info("要删除的闹钟不存在");
|
||||
return baseWebSocketService.sendMessage(action,
|
||||
baseSession ,
|
||||
action.getSystemTalkAnswerConfigEntity().getAnswerValueFaild(),
|
||||
AskTypeEnum.ALARM_CLOCK.getCode()).flatMap(m -> {
|
||||
return Mono.empty();
|
||||
});
|
||||
}else{
|
||||
//
|
||||
return Mono.just(false);
|
||||
}
|
||||
}
|
||||
|
||||
private Mono<Boolean> addAlarm(Action action,
|
||||
BaseSession baseSession,
|
||||
DeviceAlarmClockRecordEntity alarmClock,
|
||||
DeviceAlarmClockRecordRequest request,
|
||||
Integer rDay,
|
||||
ActionTime actionTime){
|
||||
if(alarmClock.getId() == null){
|
||||
|
||||
//需要新建
|
||||
alarmClock.setTimes(request.getTimes());
|
||||
alarmClock.setUserId(baseSession.getUserId());
|
||||
alarmClock.setDeviceId(baseSession.getDeviceId());
|
||||
alarmClock.setRepeatDay(rDay);
|
||||
alarmClock.setActionType(request.getActionType());
|
||||
alarmClock.setAlarmType(request.getAlarmType());
|
||||
if(!AskTypeEnum.TTS.getCode().equals(request.getActionType())){
|
||||
alarmClock.setAction(action.getNoTimeAsk());
|
||||
}
|
||||
alarmClock.setTime(
|
||||
Date.from(actionTime.getDetailTime().getLocalDateTime().atZone(ZoneId.systemDefault()).toInstant())
|
||||
);
|
||||
alarmClock.setRepeat(request.getRepeat());
|
||||
if(!alarmClock.getRepeat().equals(AlarmRepeatEnum.ONE.getCode())){
|
||||
alarmClock.setTitle("循环闹钟");
|
||||
}else{
|
||||
alarmClock.setTitle("一次性提醒");
|
||||
}
|
||||
log.info("新增闹钟:{}", alarmClock);
|
||||
|
||||
if(StringUtils.isNotEmpty(action.getNoTimeAsk())){
|
||||
//提示文案
|
||||
alarmClock.setReadText(action.getNoTimeAsk());
|
||||
alarmClock.setSoundType(YesNo.NO.getCode());
|
||||
alarmClock.setSoundName("文本提示");
|
||||
return addAlarmClockMessage(
|
||||
action,
|
||||
baseSession,
|
||||
alarmClock,
|
||||
request);
|
||||
}else{
|
||||
//随机音乐
|
||||
alarmClock.setSoundType(YesNo.YES.getCode());
|
||||
return deviceAlarmClockMusicService.selectDeviceAlarmClockMusicByRand().flatMap(
|
||||
music -> {
|
||||
alarmClock.setSoundName(music.getName());
|
||||
alarmClock.setSound(music.getUrl());
|
||||
return addAlarmClockMessage(
|
||||
action,
|
||||
baseSession,
|
||||
alarmClock,
|
||||
request);
|
||||
}else{
|
||||
//随机音乐
|
||||
alarmClock.setSoundType(YesNo.YES.getCode());
|
||||
return deviceAlarmClockMusicService.selectDeviceAlarmClockMusicByRand().flatMap(
|
||||
music -> {
|
||||
alarmClock.setSoundName(music.getName());
|
||||
alarmClock.setSound(music.getUrl());
|
||||
return addAlarmClockMessage(
|
||||
action,
|
||||
baseSession,
|
||||
alarmClock,
|
||||
request);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}else{
|
||||
//更新闹钟
|
||||
Boolean isUpdate = false;
|
||||
if(StringUtils.isNotEmpty(alarmClock.getReadText()) &&
|
||||
StringUtils.isNotEmpty(action.getNoTimeAsk()) &&
|
||||
!alarmClock.getReadText().contains(action.getNoTimeAsk())){
|
||||
alarmClock.setReadText(alarmClock.getReadText() + "," + action.getNoTimeAsk());
|
||||
log.info("修改提醒文案:{}", alarmClock);
|
||||
isUpdate = true;
|
||||
}
|
||||
if(!alarmClock.getRepeat().equals(AlarmRepeatEnum.ONE.getCode())){
|
||||
if((alarmClock.getRepeatDay().intValue() & rDay.intValue()) != rDay.intValue()) {
|
||||
alarmClock.setRepeatDay(alarmClock.getRepeatDay() | rDay);
|
||||
log.info("修改闹钟日期:{}", alarmClock);
|
||||
isUpdate = true;
|
||||
}
|
||||
}
|
||||
if(isUpdate){
|
||||
return deviceAlarmClockRecordService.updateDeviceAlarmClockRecordById(alarmClock).flatMap(i -> {
|
||||
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()).flatMap(m -> {
|
||||
return Mono.empty();
|
||||
});
|
||||
}else{
|
||||
//更新闹钟
|
||||
Boolean isUpdate = false;
|
||||
if(StringUtils.isNotEmpty(alarmClock.getReadText()) &&
|
||||
StringUtils.isNotEmpty(action.getNoTimeAsk()) &&
|
||||
!alarmClock.getReadText().contains(action.getNoTimeAsk())){
|
||||
alarmClock.setReadText(alarmClock.getReadText() + "," + action.getNoTimeAsk());
|
||||
log.info("修改提醒文案:{}", alarmClock);
|
||||
isUpdate = true;
|
||||
}
|
||||
if(!alarmClock.getRepeat().equals(AlarmRepeatEnum.ONE.getCode())){
|
||||
if((alarmClock.getRepeatDay().intValue() & rDay.intValue()) != rDay.intValue()) {
|
||||
alarmClock.setRepeatDay(alarmClock.getRepeatDay() | rDay);
|
||||
log.info("修改闹钟日期:{}", alarmClock);
|
||||
isUpdate = true;
|
||||
}
|
||||
}
|
||||
if(isUpdate){
|
||||
return deviceAlarmClockRecordService.updateDeviceAlarmClockRecordById(alarmClock).flatMap(i -> {
|
||||
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()).flatMap(m -> {
|
||||
return Mono.empty();
|
||||
});
|
||||
}
|
||||
|
||||
private Mono<Boolean> addAlarmClockMessage(Action action,
|
||||
|
||||
@ -8,7 +8,6 @@ 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.resp.BoxMessageResp;
|
||||
import com.qiuguo.iot.box.websocket.api.domain.user.UserSession;
|
||||
import com.qiuguo.iot.data.entity.device.DeviceUserTalkRecordEntity;
|
||||
import com.qiuguo.iot.data.resp.third.MusicResp;
|
||||
import com.qiuguo.iot.third.nlp.action.Action;
|
||||
import com.qiuguo.iot.third.resp.SongInfoResponse;
|
||||
@ -39,7 +38,7 @@ public class MusicActionCommand extends ActionCommand implements IActionCommand
|
||||
log.info("定期打开音乐播放");
|
||||
return alarmClockActionCommand.process(action, baseSession);
|
||||
}
|
||||
if(action.getSystemTalkAnswerConfigEntity().getPlayType().equals(PlayEnum.START.getCode())){
|
||||
if(action.getSystemTalkAnswerConfigEntity().getActionStatus().equals(PlayEnum.START.getCode())){
|
||||
return musicService.searchMusic(search, 1).defaultIfEmpty(new ArrayList<>()).flatMap(resultSongs -> {
|
||||
//BoxMessageResp resp = new BoxMessageResp();
|
||||
MusicResp musicResp = new MusicResp();
|
||||
@ -63,7 +62,7 @@ public class MusicActionCommand extends ActionCommand implements IActionCommand
|
||||
});
|
||||
}else if(baseSession.getMusic() != null){
|
||||
//做相应的动作
|
||||
baseSession.getMusic().setPlay(action.getSystemTalkAnswerConfigEntity().getPlayType());
|
||||
baseSession.getMusic().setPlay(action.getSystemTalkAnswerConfigEntity().getActionStatus());
|
||||
resp.setMusic(baseSession.getMusic());
|
||||
resp.setText(action.getSystemTalkAnswerConfigEntity().getAnswerValue().replace("#name#", baseSession.getMusic().getName()));
|
||||
resp.setType(action.getSystemTalkAnswerConfigEntity().getAnswerType());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user