Commit 330d24ca authored by duanruiming's avatar duanruiming

[update] 车道快照查询500条分页

parent c42b13fa
...@@ -38,7 +38,7 @@ public class LaneSnapshotDataQueryService implements LaneSnapshotService { ...@@ -38,7 +38,7 @@ public class LaneSnapshotDataQueryService implements LaneSnapshotService {
@Override @Override
public List<CrossLaneSnapshotDataDTO> queryByCrossIdAndTimeSpan( public List<CrossLaneSnapshotDataDTO> queryByCrossIdAndTimeSpan(
String crossId, int startTimeStamp, int endTimeStamp) String crossId, int startTimeStamp, int endTimeStamp, int pageNum)
throws Exception { throws Exception {
List<CrossLaneSnapshotDataDTO> result = new ArrayList<>(); List<CrossLaneSnapshotDataDTO> result = new ArrayList<>();
...@@ -58,8 +58,8 @@ public class LaneSnapshotDataQueryService implements LaneSnapshotService { ...@@ -58,8 +58,8 @@ public class LaneSnapshotDataQueryService implements LaneSnapshotService {
searchSourceBuilder searchSourceBuilder
.query(boolQuery) .query(boolQuery)
//.from(0) .from(pageNum)
.size(500); .size((pageNum + 1) * 500);
searchRequest.source(searchSourceBuilder); searchRequest.source(searchSourceBuilder);
SearchResponse response = client.search(searchRequest, RequestOptions.DEFAULT); SearchResponse response = client.search(searchRequest, RequestOptions.DEFAULT);
......
...@@ -10,7 +10,7 @@ import java.util.List; ...@@ -10,7 +10,7 @@ import java.util.List;
* @date 2023/10/26 14:12 * @date 2023/10/26 14:12
*/ */
public interface LaneSnapshotService { public interface LaneSnapshotService {
List<CrossLaneSnapshotDataDTO> queryByCrossIdAndTimeSpan(String crossId, int startTimeStamp, int endTimeStamp) throws Exception; List<CrossLaneSnapshotDataDTO> queryByCrossIdAndTimeSpan(String crossId, int startTimeStamp, int endTimeStamp, int pageNum) throws Exception;
int queryCountsByCrossIdAndTimeSpan(String crossId, int startTimeStamp, int endTimeStamp) throws Exception; int queryCountsByCrossIdAndTimeSpan(String crossId, int startTimeStamp, int endTimeStamp) throws Exception;
} }
...@@ -1319,7 +1319,7 @@ public class TrendServiceImpl implements TrendService { ...@@ -1319,7 +1319,7 @@ public class TrendServiceImpl implements TrendService {
// 查询秒级数据 // 查询秒级数据
List<CrossLaneSnapshotDataDTO> dtoList = List<CrossLaneSnapshotDataDTO> dtoList =
laneSnapshotDataQueryService.queryByCrossIdAndTimeSpan(crossId, realTimeStartTimeStamp, endTimeStamp); laneSnapshotDataQueryService.queryByCrossIdAndTimeSpan(crossId, realTimeStartTimeStamp, endTimeStamp, 0);
tableQueryVO.setRealTimeData(buildRealTimeList(dtoList)); tableQueryVO.setRealTimeData(buildRealTimeList(dtoList));
// 查询周期数据 // 查询周期数据
...@@ -1982,9 +1982,10 @@ public class TrendServiceImpl implements TrendService { ...@@ -1982,9 +1982,10 @@ public class TrendServiceImpl implements TrendService {
String crossId = crossIdDateTimeVO.getCrossId(); String crossId = crossIdDateTimeVO.getCrossId();
int start = (int) (crossIdDateTimeVO.getStart().getTime() / 1000); int start = (int) (crossIdDateTimeVO.getStart().getTime() / 1000);
int end = (int) (crossIdDateTimeVO.getEnd().getTime() / 1000); int end = (int) (crossIdDateTimeVO.getEnd().getTime() / 1000);
int pageNum = crossIdDateTimeVO.getPageNum();
// 查询秒级数据 // 查询秒级数据
List<CrossLaneSnapshotDataDTO> dtoList = List<CrossLaneSnapshotDataDTO> dtoList =
laneSnapshotDataQueryService.queryByCrossIdAndTimeSpan(crossId, start, end); laneSnapshotDataQueryService.queryByCrossIdAndTimeSpan(crossId, start, end, pageNum);
return buildRealTimeList(dtoList); return buildRealTimeList(dtoList);
} }
......
...@@ -17,7 +17,7 @@ import java.util.Date; ...@@ -17,7 +17,7 @@ import java.util.Date;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@ApiModel(value = "CommonCrossIdDateTimeVO") @ApiModel(value = "CommonCrossIdDateTimeVO")
public class CommonCrossIdDateTimeVO { public class CommonCrossIdDateTimeVO extends PageNumVO{
@ApiModelProperty(value = "路口ID") @ApiModelProperty(value = "路口ID")
@NotBlank(message = "路口编号不能为空") @NotBlank(message = "路口编号不能为空")
private String crossId; private String crossId;
......
package net.wanji.opt.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author duanruiming
* @date 2024/05/22 10:24
*/
@Data
public class PageNumVO {
@ApiModelProperty(value = "当前页码")
private int pageNum;
}
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