Commit 0cc4d1c7 authored by duanruiming's avatar duanruiming

[update] 微观大数据平台-事件查询

parent 68ddffcc
...@@ -37,7 +37,7 @@ public class LaneSnapshotDataQueryService implements LaneSnapshotService { ...@@ -37,7 +37,7 @@ public class LaneSnapshotDataQueryService implements LaneSnapshotService {
@Override @Override
public List<CrossLaneSnapshotDataDTO> queryByCrossIdAndTimeSpan( public List<CrossLaneSnapshotDataDTO> queryByCrossIdAndTimeSpan(
String crossId, int startTimeStamp, int endTimeStamp, int pageNum, String laneId) String crossId, int startTimeStamp, int endTimeStamp, int pageNum, String laneId, boolean overFlow)
throws Exception { throws Exception {
List<CrossLaneSnapshotDataDTO> result = new ArrayList<>(); List<CrossLaneSnapshotDataDTO> result = new ArrayList<>();
...@@ -50,10 +50,20 @@ public class LaneSnapshotDataQueryService implements LaneSnapshotService { ...@@ -50,10 +50,20 @@ public class LaneSnapshotDataQueryService implements LaneSnapshotService {
.gte(startTimeStamp) .gte(startTimeStamp)
.lte(endTimeStamp); .lte(endTimeStamp);
BoolQueryBuilder boolQuery = QueryBuilders.boolQuery() BoolQueryBuilder boolQuery = QueryBuilders.boolQuery()
.must(matchQuery) .must(matchQuery)
.must(rangeQuery); .must(rangeQuery);
// 是否是溢出事件
MatchQueryBuilder overFlowQuery = null;
if (overFlow) {
overFlowQuery = QueryBuilders.matchQuery("overflow", true);
boolQuery.must(overFlowQuery);
}
// 车道号筛选
String[] split = null; String[] split = null;
if (StringUtils.isNotBlank(laneId)) { if (StringUtils.isNotBlank(laneId)) {
split = laneId.split(","); split = laneId.split(",");
......
...@@ -11,7 +11,8 @@ import java.util.List; ...@@ -11,7 +11,8 @@ import java.util.List;
*/ */
public interface LaneSnapshotService { public interface LaneSnapshotService {
List<CrossLaneSnapshotDataDTO> queryByCrossIdAndTimeSpan(String crossId, int startTimeStamp, List<CrossLaneSnapshotDataDTO> queryByCrossIdAndTimeSpan(String crossId, int startTimeStamp,
int endTimeStamp, int pageNum, String laneId) throws Exception; int endTimeStamp, int pageNum,
String laneId, boolean overFlow) throws Exception;
int queryCountsByCrossIdAndTimeSpan(String crossId, int startTimeStamp, int endTimeStamp) throws Exception; int queryCountsByCrossIdAndTimeSpan(String crossId, int startTimeStamp, int endTimeStamp) throws Exception;
} }
...@@ -1326,7 +1326,7 @@ public class TrendServiceImpl implements TrendService { ...@@ -1326,7 +1326,7 @@ public class TrendServiceImpl implements TrendService {
// 查询秒级数据 // 查询秒级数据
List<CrossLaneSnapshotDataDTO> dtoList = List<CrossLaneSnapshotDataDTO> dtoList =
laneSnapshotDataQueryService.queryByCrossIdAndTimeSpan(crossId, realTimeStartTimeStamp, laneSnapshotDataQueryService.queryByCrossIdAndTimeSpan(crossId, realTimeStartTimeStamp,
endTimeStamp, 0, null); endTimeStamp, 0, null, false);
tableQueryVO.setRealTimeData(buildRealTimeList(dtoList)); tableQueryVO.setRealTimeData(buildRealTimeList(dtoList));
// 查询周期数据 // 查询周期数据
...@@ -1949,9 +1949,11 @@ public class TrendServiceImpl implements TrendService { ...@@ -1949,9 +1949,11 @@ public class TrendServiceImpl implements TrendService {
int end = (int) (laneSnapshotIndexVO.getEnd().getTime() / 1000); int end = (int) (laneSnapshotIndexVO.getEnd().getTime() / 1000);
int pageNum = laneSnapshotIndexVO.getPageNum(); int pageNum = laneSnapshotIndexVO.getPageNum();
String laneId = laneSnapshotIndexVO.getLaneId(); String laneId = laneSnapshotIndexVO.getLaneId();
boolean overFlow = laneSnapshotIndexVO.isOverFlow();
// 查询秒级数据 // 查询秒级数据
List<CrossLaneSnapshotDataDTO> dtoList = List<CrossLaneSnapshotDataDTO> dtoList =
laneSnapshotDataQueryService.queryByCrossIdAndTimeSpan(crossId, start, end, pageNum, laneId); laneSnapshotDataQueryService.queryByCrossIdAndTimeSpan(crossId, start, end, pageNum, laneId, overFlow);
List<TableQueryVO.RealTimeDataElement> result = buildRealTimeList(dtoList); List<TableQueryVO.RealTimeDataElement> result = buildRealTimeList(dtoList);
List<TableQueryVO.RealTimeDataElement> sorts = new ArrayList<>(); List<TableQueryVO.RealTimeDataElement> sorts = new ArrayList<>();
if (!CollectionUtils.isEmpty(result)) { if (!CollectionUtils.isEmpty(result)) {
...@@ -2007,8 +2009,9 @@ public class TrendServiceImpl implements TrendService { ...@@ -2007,8 +2009,9 @@ public class TrendServiceImpl implements TrendService {
results.add(holoEventInfoPO); results.add(holoEventInfoPO);
} }
} }
} else {
results = holoEventInfoPOS;
} }
results = holoEventInfoPOS;
return results; return results;
} catch (Exception e) { } catch (Exception e) {
log.error("全息事件查询异常:", e); log.error("全息事件查询异常:", e);
...@@ -2181,7 +2184,7 @@ public class TrendServiceImpl implements TrendService { ...@@ -2181,7 +2184,7 @@ public class TrendServiceImpl implements TrendService {
String laneId = laneSnapshotIndexVO.getLaneId(); String laneId = laneSnapshotIndexVO.getLaneId();
// 查询秒级数据 // 查询秒级数据
List<CrossLaneSnapshotDataDTO> dtoList = List<CrossLaneSnapshotDataDTO> dtoList =
laneSnapshotDataQueryService.queryByCrossIdAndTimeSpan(crossId, start, end, -1, laneId); laneSnapshotDataQueryService.queryByCrossIdAndTimeSpan(crossId, start, end, -1, laneId, false);
List<TableQueryVO.RealTimeDataElement> result = buildRealTimeList(dtoList); List<TableQueryVO.RealTimeDataElement> result = buildRealTimeList(dtoList);
List<TableQueryVO.RealTimeDataElement> dataList = new ArrayList<>(); List<TableQueryVO.RealTimeDataElement> dataList = new ArrayList<>();
if (!CollectionUtils.isEmpty(result)) { if (!CollectionUtils.isEmpty(result)) {
......
...@@ -27,4 +27,6 @@ public class LaneSnapshotIndexVO extends PageNumVO { ...@@ -27,4 +27,6 @@ public class LaneSnapshotIndexVO extends PageNumVO {
@NotNull(message = "结束时间不能为空") @NotNull(message = "结束时间不能为空")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date end; private Date end;
@ApiModelProperty(value = "溢出数据")
private boolean overFlow;
} }
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