Commit aaf81011 authored by duanruiming's avatar duanruiming

[add] 绿波干线运行监测优化返回数据

parent 7a4969cd
...@@ -538,18 +538,30 @@ public class TrendServiceImpl implements TrendService { ...@@ -538,18 +538,30 @@ public class TrendServiceImpl implements TrendService {
List<GreenwaveRunMonitorVO> res = new ArrayList<>(); List<GreenwaveRunMonitorVO> res = new ArrayList<>();
Date date = new Date(); Date date = new Date();
List<GreenwaveHistPOExt> extList = greenwaveHistoryMapper.selectRunMonitorV2(greenwaveIdBO.getGreenwaveId(), date); List<GreenwaveHistPOExt> extList = greenwaveHistoryMapper.selectRunMonitorV2(greenwaveIdBO.getGreenwaveId(), date);
for (GreenwaveHistPOExt greenwaveHistPOExt : extList) { if (!CollectionUtils.isEmpty(extList)) {
GreenwaveRunMonitorVO greenWaveRunMonitorVO = new GreenwaveRunMonitorVO(); Map<String, List<GreenwaveHistPOExt>> listMap = extList.stream().collect(Collectors.groupingBy(GreenwaveHistPOExt::getRoadDirection));
for (Map.Entry<String, List<GreenwaveHistPOExt>> entry : listMap.entrySet()) {
String roadDirection = entry.getKey();
List<GreenwaveHistPOExt> value = entry.getValue();
GreenwaveRunMonitorVO vo = new GreenwaveRunMonitorVO();
vo.setRoadDirection(roadDirection);
List<GreenwaveRunMonitorVO.Detail> details = new ArrayList<>(value.size());
for (GreenwaveHistPOExt greenwaveHistPOExt : value) {
GreenwaveRunMonitorVO.Detail detail = new GreenwaveRunMonitorVO.Detail();
String hour = greenwaveHistPOExt.getHour(); String hour = greenwaveHistPOExt.getHour();
greenWaveRunMonitorVO.setHour(hour); detail.setHour(hour);
greenWaveRunMonitorVO.setAvgSpeed(greenwaveHistPOExt.getAvgSpeed()); detail.setAvgSpeed(greenwaveHistPOExt.getAvgSpeed());
Double congestionIndex = greenwaveHistPOExt.getCongestionIndex(); Double congestionIndex = greenwaveHistPOExt.getCongestionIndex();
greenWaveRunMonitorVO.setCongestionIndex(congestionIndex); detail.setCongestionIndex(congestionIndex);
Double trvalTime = greenwaveHistPOExt.getTrvalTime(); Double trvalTime = greenwaveHistPOExt.getTrvalTime();
greenWaveRunMonitorVO.setTravelTime(trvalTime.intValue()); detail.setTravelTime(trvalTime.intValue());
greenWaveRunMonitorVO.setRoadDirection(greenwaveHistPOExt.getRoadDirection()); details.add(detail);
res.add(greenWaveRunMonitorVO);
} }
vo.setDetailList(details);
res.add(vo);
}
}
return res; return res;
} }
......
...@@ -924,8 +924,13 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -924,8 +924,13 @@ public class StrategyControlServiceImpl implements StrategyControlService {
List<StrategyControlDataVO> dataList = new ArrayList<>(); List<StrategyControlDataVO> dataList = new ArrayList<>();
for (StrategyPlanDTO strategyPlanDTO : resultList) { for (StrategyPlanDTO strategyPlanDTO : resultList) {
StrategyControlDataVO dataVO = new StrategyControlDataVO(); StrategyControlDataVO dataVO = new StrategyControlDataVO();
dataVO.setBizId(strategyPlanDTO.getCrossId()); String bizId = strategyPlanDTO.getCrossId();
dataVO.setBizId(bizId);
if (bizId.length() == 1) {
dataVO.setBizType(1);
} else {
dataVO.setBizType(0); dataVO.setBizType(0);
}
dataVO.setStrategy(strategyPlanDTO.getStrategy()); dataVO.setStrategy(strategyPlanDTO.getStrategy());
dataVO.setScheduleStart(strategyPlanDTO.getStartTime()); dataVO.setScheduleStart(strategyPlanDTO.getStartTime());
dataVO.setScheduleEnd(strategyPlanDTO.getEndTime()); dataVO.setScheduleEnd(strategyPlanDTO.getEndTime());
......
package net.wanji.opt.vo; package net.wanji.opt.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@Data @Data
@ApiModel(value = "GreenwaveRunMonitorVO", description = "子区信息-运行监测返回值") @ApiModel(value = "GreenwaveRunMonitorVO", description = "子区信息-运行监测返回值")
public class GreenwaveRunMonitorVO { public class GreenwaveRunMonitorVO {
@ApiModelProperty(value = "绿波方向")
private String roadDirection;
private List<Detail> detailList;
@Data
public static class Detail {
@ApiModelProperty(value = "时间") @ApiModelProperty(value = "时间")
private String hour; private String hour;
@ApiModelProperty(value = "平均速度") @ApiModelProperty(value = "平均速度")
...@@ -16,7 +25,7 @@ public class GreenwaveRunMonitorVO { ...@@ -16,7 +25,7 @@ public class GreenwaveRunMonitorVO {
@ApiModelProperty(value = "拥堵指数") @ApiModelProperty(value = "拥堵指数")
private Double congestionIndex; private Double congestionIndex;
@ApiModelProperty(value = "行程时间") @ApiModelProperty(value = "行程时间")
@JsonProperty("trvalTime")
private Integer travelTime; private Integer travelTime;
@ApiModelProperty(value = "绿波方向") }
private String roadDirection;
} }
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
when road_direction='e2w' then '东向西' when road_direction='e2w' then '东向西'
when road_direction='w2e' then '西向东' when road_direction='w2e' then '西向东'
end ) roadDirection, end ) roadDirection,
DATE_FORMAT(start_time, '%Y-%m-%d %H:%i:00') AS hour, DATE_FORMAT(start_time, '%H:%i') AS hour,
speed AS avg_speed, speed AS avg_speed,
traffic_index AS congestion_index, traffic_index AS congestion_index,
trval_time AS trval_time trval_time AS trval_time
......
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