Browse Source

危险行为数据分页

master
fangzhe 4 weeks ago
parent
commit
a8aa358d27
4 changed files with 28 additions and 20 deletions
  1. +3
    -1
      ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/manage/RadarManage.java
  2. +2
    -1
      ningda-yw-api/src/main/java/com/ningdatech/carapi/road/controller/RoadMonitorController.java
  3. +21
    -17
      ningda-yw-api/src/main/java/com/ningdatech/carapi/road/manage/RoadMonitorManage.java
  4. +2
    -1
      ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/req/RoadMonitorReq.java

+ 3
- 1
ningda-yw-api/src/main/java/com/ningdatech/carapi/radar/manage/RadarManage.java View File

@@ -186,7 +186,9 @@ public class RadarManage {
.eq(TrafficFlow::getRegion, region1)
.orderByDesc(TrafficFlow::getCreateOn)
.last("limit 1"));
vo.setRealTimeTrafficFlow(trafficFlow.getTrafficFlow());
if (Objects.nonNull(trafficFlow)){
vo.setRealTimeTrafficFlow(trafficFlow.getTrafficFlow());
}
return vo;
}



+ 2
- 1
ningda-yw-api/src/main/java/com/ningdatech/carapi/road/controller/RoadMonitorController.java View File

@@ -1,5 +1,6 @@
package com.ningdatech.carapi.road.controller;

import com.ningdatech.basic.model.PageVo;
import com.ningdatech.carapi.road.manage.RoadMonitorManage;
import com.ningdatech.carapi.road.model.req.RoadMonitorHandleReq;
import com.ningdatech.carapi.road.model.req.RoadMonitorReq;
@@ -44,7 +45,7 @@ public class RoadMonitorController {

@ApiOperation(value = "危险行为数据", notes = "危险行为数据")
@GetMapping("/get-road-danger-behavior-data")
public List<RoadDangerBehaviorVO> getRoadDangerBehaviorData(RoadMonitorReq req) {
public PageVo<RoadDangerBehaviorVO> getRoadDangerBehaviorData(RoadMonitorReq req) {
return roadMonitorManage.getRoadDangerBehaviorData(req);
}



+ 21
- 17
ningda-yw-api/src/main/java/com/ningdatech/carapi/road/manage/RoadMonitorManage.java View File

@@ -10,6 +10,8 @@ import java.util.stream.Collectors;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.carapi.radar.helper.RadarDataHelper;
import com.ningdatech.carapi.road.model.entity.ComprehensiveSituation;
import com.ningdatech.carapi.road.model.entity.TrafficFlow;
@@ -180,11 +182,11 @@ public class RoadMonitorManage {
}

private void setDefaultScores(ComprehensiveSituationVO vo) {
vo.setRoadScore(100);
vo.setCarScore(100);
vo.setDriverScore(100);
vo.setEnvironmentScore(100);
vo.setRoadSafetyIndex(100);
vo.setRoadScore(85);
vo.setCarScore(85);
vo.setDriverScore(85);
vo.setEnvironmentScore(85);
vo.setRoadSafetyIndex(85);
}

private void getDataVo(String dataKey, ComprehensiveSituationVO vo, Jedis jedis) {
@@ -390,21 +392,22 @@ public class RoadMonitorManage {
}
}

public List<RoadDangerBehaviorVO> getRoadDangerBehaviorData(RoadMonitorReq req) {
public PageVo<RoadDangerBehaviorVO> getRoadDangerBehaviorData(RoadMonitorReq req) {
List<String> regionList = req.getRegionList();
// 从列表中查询数据
List<RoadBehaviorAnalysis> list = roadBehaviorAnalysisService.list(Wrappers.lambdaQuery(RoadBehaviorAnalysis.class)
.in(RoadBehaviorAnalysis::getRegion, regionList)
.like(StringUtils.isNoneBlank(req.getBehavior()),RoadBehaviorAnalysis::getBehavior, req.getBehavior())
.eq(Objects.nonNull(req.getType()),RoadBehaviorAnalysis::getType, req.getType())
.ge(Objects.nonNull(req.getStartTime()), RoadBehaviorAnalysis::getBehaviorTime, req.getStartTime())
.le(Objects.nonNull(req.getEndTime()), RoadBehaviorAnalysis::getBehaviorTime, req.getEndTime())
.eq(Objects.nonNull(req.getIsWarn()),RoadBehaviorAnalysis::getIsWarn, req.getIsWarn())
.orderByDesc(RoadBehaviorAnalysis::getBehaviorTime));
if (CollUtil.isEmpty(list)){
return Collections.emptyList();
Page<RoadBehaviorAnalysis> pageResult = roadBehaviorAnalysisService.page(new Page<>(req.getPageNumber(), req.getPageSize()),
Wrappers.lambdaQuery(RoadBehaviorAnalysis.class)
.in(RoadBehaviorAnalysis::getRegion, regionList)
.like(StringUtils.isNoneBlank(req.getBehavior()), RoadBehaviorAnalysis::getBehavior, req.getBehavior())
.eq(Objects.nonNull(req.getType()), RoadBehaviorAnalysis::getType, req.getType())
.ge(Objects.nonNull(req.getStartTime()), RoadBehaviorAnalysis::getBehaviorTime, req.getStartTime())
.le(Objects.nonNull(req.getEndTime()), RoadBehaviorAnalysis::getBehaviorTime, req.getEndTime())
.eq(Objects.nonNull(req.getIsWarn()), RoadBehaviorAnalysis::getIsWarn, req.getIsWarn())
.orderByDesc(RoadBehaviorAnalysis::getBehaviorTime));
if (CollUtil.isEmpty(pageResult.getRecords())){
return PageVo.empty();
}
return list.stream().map(roadBehaviorAnalysis -> {
List<RoadDangerBehaviorVO> collect = pageResult.getRecords().stream().map(roadBehaviorAnalysis -> {
RoadDangerBehaviorVO vo = new RoadDangerBehaviorVO();
vo.setId(roadBehaviorAnalysis.getId());
vo.setRecord(roadBehaviorAnalysis.getBehavior());
@@ -418,6 +421,7 @@ public class RoadMonitorManage {
vo.setIsHandled(roadBehaviorAnalysis.getIsHandled());
return vo;
}).collect(Collectors.toList());
return PageVo.of(collect,pageResult.getTotal());
}

public void videoDownload(VideoDownloadReq req, HttpServletResponse response) {


+ 2
- 1
ningda-yw-api/src/main/java/com/ningdatech/carapi/road/model/req/RoadMonitorReq.java View File

@@ -3,6 +3,7 @@ package com.ningdatech.carapi.road.model.req;
import java.time.LocalDateTime;
import java.util.List;

import com.ningdatech.basic.model.PagePo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@@ -17,7 +18,7 @@ import javax.validation.constraints.NotEmpty;
* @since 2024/10/23 17:53
*/
@Data
public class RoadMonitorReq {
public class RoadMonitorReq extends PagePo {

@ApiModelProperty("区域 1 黄山隧道东阳去向、2 黄山隧道东阳来向、3 黄山隧道义乌去向、4 黄山隧道义乌来向、5 何里隧道兰溪方向、6 何里隧道义乌方向")
private String region;


Loading…
Cancel
Save