优化闹钟播报

This commit is contained in:
wulin 2023-11-18 16:07:47 +08:00
parent 3557fa9a31
commit 206c638c29
5 changed files with 14 additions and 6 deletions

View File

@ -91,9 +91,7 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
//大于1分钟
request = new DeviceAlarmClockRecordRequest();
Date date = Date.from(actionTime.getDetailTime().getLocalDateTime().atZone(ZoneId.systemDefault()).toInstant());
request.setTimes(
date.getTime() / 1000
);
request.setTimes(date.getTime() / 1000 - date.getSeconds());
request.setUserId(baseSession.getUserId());
request.setDeviceId(baseSession.getDeviceId());
request.setRepeat(AlarmRepeatEnum.ONE.getCode());
@ -122,7 +120,7 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
}else{
request.setAlarmType(YesNo.YES.getCode());
request.setActionType(action.getSystemTalkAnswerConfigEntity().getAnswerType());
action.getSystemTalkAnswerConfigEntity().setAnswerValueFaild("已有相关提醒");
}
Integer rDay = day;
@ -223,6 +221,7 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
DeviceAlarmClockRecordRequest request,
ActionTime actionTime,
IActionSendMessage actionSendMessage){
action.getSystemTalkAnswerConfigEntity().setAnswerValueFaild("无相关提醒");
//先判断是否去掉文案
if(StringUtils.isNotEmpty(alarmClock.getReadText())){
if(alarmClock.getReadText().contains(action.getNoTimeAsk())){
@ -256,6 +255,7 @@ public class AlarmClockActionCommand extends ActionCommand implements IActionCom
Integer rDay,
ActionTime actionTime,
IActionSendMessage actionSendMessage){
action.getSystemTalkAnswerConfigEntity().setAnswerValueFaild("已有相关提醒");
if(alarmClock.getId() == null){
//需要新建

View File

@ -54,7 +54,7 @@ public class WeatherActionCommand extends ActionCommand implements IActionComma
return sendMessage(action, baseSession, "该城市不支持天气查询", action.getSystemTalkAnswerConfigEntity().getAnswerType(), actionSendMessage);
//return Mono.empty();
}
if(!action.getSystemTalkAnswerConfigEntity().getActionStatus().equals(ActionStatusEnum.START.getCode())){
if(!action.getSystemTalkAnswerConfigEntity().getActionStatus().equals(ActionStatusEnum.GO.getCode())){
//定时查询天气
log.info("定期查询天气");
return alarmClockActionCommand.process(action, baseSession, actionSendMessage);

View File

@ -84,6 +84,8 @@ public class DeviceController {
session.setNickName(userTalkRequst.getNickName());
session.setRoleId(DeviceCodeEnum.BOX.getName());
session.setRequestId(userTalkRequst.getTimeTemp());
//当不不使用城市时默认使用杭州查询
session.setCustomerIP("115.205.2.137");
BaseMessageResp baseMessageResp = new BaseMessageResp();
return ActionCommand.processAction(actions, session, new IActionSendMessage() {
@Override

View File

@ -23,6 +23,7 @@ import javax.annotation.PreDestroy;
@Slf4j
public class LogMdcConfiguration {
public static String PRINT_LOG_ID = Log4Constans.PRINT_LOG_ID;
private int errHashcode;
@PostConstruct
public void contextOperatorHook() {
Hooks.onEachOperator(PRINT_LOG_ID, Operators.lift((r, c) ->{
@ -52,7 +53,10 @@ public class LogMdcConfiguration {
@Override
public void onError(Throwable throwable) {
log.info("异常{}", throwable);
if(errHashcode != throwable.hashCode()){
errHashcode = throwable.hashCode();
log.info("异常{}", throwable);
}
coreSubscriber.onError(throwable);
MDC.remove(PRINT_LOG_ID);

View File

@ -40,6 +40,8 @@ spring:
port: 32030
password: 123456
timeout: 5000
tianqiapi:
url: https://v0.yiketianqi.com/api?unescape=1&version=v91&appid=23293151&appsecret=Lj6ZMcqn&ext=life
Ali:
qianwen: 'sk-8d64677afaf6404cb83ce1910b5b2558'
accesskeId: 'LTAI5t7d1iZb18SvGQhtDnyN'