Commit 943921c3 by fz

1.时间触发条件值也统一转为json获取

1 parent 5f4730c6
......@@ -24,10 +24,4 @@ public class MqConfig {
* 符合场景时间规则的数据发送 topic
*/
private String sceneTopic;
/**
* 预加载的时间范围
*/
private String timeFuture;
}
......@@ -24,7 +24,7 @@ public class TimerTriggerAllJob implements SimpleJob {
@Override
public void execute(ShardingContext shardingContext) {
log.info("Jobname==="+shardingContext.getJobName());
//log.info("Jobname==="+shardingContext.getJobName());
//定时每10秒执行
sceneComponent.execute(Condition.ALL_MATCH.getCode());
}
......
......@@ -22,7 +22,7 @@ public class TimerTriggerAnyJob implements SimpleJob {
@Override
public void execute(ShardingContext shardingContext) {
log.info("Jobname===" + shardingContext.getJobName());
//log.info("Jobname===" + shardingContext.getJobName());
//定时每10秒执行
sceneComponent.execute(Condition.ANY_MATCH.getCode());
}
......
......@@ -20,4 +20,6 @@ public class ScenseParamValue {
private String remoteId;
//推送消息
private String msg;
//推送消息
private String date;
}
......@@ -199,12 +199,20 @@ public class SceneService {
return false;
}
//开始时间
ScenseParamValue paramTimeValue = null;
try {
paramTimeValue = JSON.parseObject(value, ScenseParamValue.class);
} catch (Exception e) {
log.info("JSON解析异常:ScenseParamValue===="+e.getMessage()+"===conditionId:"+condition.getId()+"===conditionType:"+conditionType);
return false;
}
//参数一,触发时间
String time = paramTimeValue.getDate();
//当前时间
String begintTimeStr = DateUtils.getDate(new Date(rangeBegintTime), "HH:mm");
//开始时间+预处理时间范围(可在配置中心修改)
long rangeEndTime = rangeBegintTime + Long.parseLong(config.getTimeFuture());
String endTimeStr = DateUtils.getDate(new Date(rangeEndTime), "HH:mm");
boolean flag = value.equals(begintTimeStr) || value.equals(endTimeStr);
boolean flag = time.equals(begintTimeStr) ;
return flag;
}
return false;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!