Commit 37d65431 authored by 郭武斌's avatar 郭武斌

*)修改相似警情同步时间

parent 3a2e7baa
...@@ -10,6 +10,8 @@ logging.config=classpath:logback-${spring.profiles.active}.xml ...@@ -10,6 +10,8 @@ logging.config=classpath:logback-${spring.profiles.active}.xml
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
#redis����ʧЧʱ�䵥λ�� #redis����ʧЧʱ�䵥λ��
redis.cache.failure.time=10800 redis.cache.failure.time=10800
#unit(h)
alertcall.es.synchrony.time=48
spring.datasource.type=com.zaxxer.hikari.HikariDataSource spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=10 spring.datasource.hikari.minimum-idle=10
......
...@@ -9,6 +9,7 @@ import javax.annotation.PostConstruct; ...@@ -9,6 +9,7 @@ import javax.annotation.PostConstruct;
import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHit; import org.springframework.data.elasticsearch.core.SearchHit;
...@@ -48,8 +49,10 @@ public class ESAlertCalledService { ...@@ -48,8 +49,10 @@ public class ESAlertCalledService {
@Autowired @Autowired
private AlertCalledServiceImpl alertCalledService; private AlertCalledServiceImpl alertCalledService;
@Value("${alertcall.es.synchrony.time}")
private Long time;
@PostConstruct @PostConstruct
public void init() throws Exception public void init() throws Exception
{ {
...@@ -68,7 +71,13 @@ public class ESAlertCalledService { ...@@ -68,7 +71,13 @@ public class ESAlertCalledService {
QueryWrapper<AlertCalled> wrapper = new QueryWrapper<>(); QueryWrapper<AlertCalled> wrapper = new QueryWrapper<>();
long currentTime = System.currentTimeMillis() ; long currentTime = System.currentTimeMillis() ;
currentTime = currentTime - 480*60*60*1000; if (ValidationUtil.isEmpty(time)) //默认为同步48小时
{
currentTime = currentTime - 48*60*60*1000;
}else
{
currentTime = currentTime - time*60*60*1000;
}
Date date=new Date(currentTime); Date date=new Date(currentTime);
wrapper.ge("call_time", date); wrapper.ge("call_time", date);
...@@ -256,7 +265,7 @@ public class ESAlertCalledService { ...@@ -256,7 +265,7 @@ public class ESAlertCalledService {
// 分页 // 分页
.withPageable(PageRequest.of(current, size)) .withPageable(PageRequest.of(current, size))
// 排序 // 排序
// .withSort(SortBuilders.fieldSort("callTime").order(SortOrder.DESC)) // .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
//过滤条件 //过滤条件
.withQuery(boolMust); .withQuery(boolMust);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment