|
@@ -13,6 +13,7 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Component
|
|
|
public class QueryLogServiceImpl implements QueryLogService {
|
|
@@ -28,7 +29,7 @@ public class QueryLogServiceImpl implements QueryLogService {
|
|
|
private static long cacheTime = 0;
|
|
|
|
|
|
@Override
|
|
|
- public PageInfo<EsQueryLogVo> getQueryGroupList(Integer page, Integer rows, String queryText){
|
|
|
+ public PageInfo<EsQueryLogVo> getQueryGroupList(Integer page, Integer rows, String queryText) {
|
|
|
PageHelper.startPage(page, rows);
|
|
|
|
|
|
List<EsQueryLogVo> dataList = esQueryLogCQuery.getQueryGroupList(queryText);
|
|
@@ -38,23 +39,23 @@ public class QueryLogServiceImpl implements QueryLogService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<EsQueryLogVo> getHotspotList(Integer maxRows){
|
|
|
+ public List<EsQueryLogVo> getHotspotList(Integer maxRows) {
|
|
|
return getQueryGroupList(1, maxRows, null).getList();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<EsQueryLogVo> getQueryList(String queryText){
|
|
|
+ public List<EsQueryLogVo> getQueryList(String queryText) {
|
|
|
synchronized (lockObject) {
|
|
|
//用户输入查询时,从本地缓存加载数据
|
|
|
long timeSpan = (new Date()).getTime() - cacheTime;
|
|
|
if (timeSpan > 30 * 1000 || queryTextCache == null) {
|
|
|
- queryTextCache = getQueryGroupList(0,10000, null).getList();
|
|
|
+ queryTextCache = getQueryGroupList(0, 10000, null).getList();
|
|
|
cacheTime = (new Date()).getTime();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
List<EsQueryLogVo> rtnList = queryTextCache.stream()
|
|
|
- .filter(log-> log.getQueryText().contains(queryText)).toList();
|
|
|
+ .filter(log -> log.getQueryText().contains(queryText)).toList();
|
|
|
return rtnList;
|
|
|
}
|
|
|
|
|
@@ -67,10 +68,11 @@ public class QueryLogServiceImpl implements QueryLogService {
|
|
|
|
|
|
return esQueryLogMapper.insert(log);
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
- public List<EsRelationLog> getRelationLogList(String well_common_name){
|
|
|
- EsRelationLogExample example=new EsRelationLogExample();
|
|
|
+ public List<EsRelationLog> getRelationLogList(String well_common_name) {
|
|
|
+ EsRelationLogExample example = new EsRelationLogExample();
|
|
|
example.or().andWell_common_nameEqualTo(well_common_name);
|
|
|
- return esRelationLogMapper.selectByExample(example);
|
|
|
+ return esRelationLogMapper.selectByExample(example).stream().skip(10).collect(Collectors.toList());
|
|
|
}
|
|
|
}
|