Commit 47c4e0b4 authored by duanruiming's avatar duanruiming

[add] 干线列表查询优化-行程时间

parent ccaceaa0
...@@ -17,6 +17,7 @@ import org.springframework.util.CollectionUtils; ...@@ -17,6 +17,7 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* @author duanruiming * @author duanruiming
...@@ -98,6 +99,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -98,6 +99,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
Map<String, Double> backDistanceMap = new TreeMap<>(); Map<String, Double> backDistanceMap = new TreeMap<>();
String decideSpeed = ""; String decideSpeed = "";
String backDecideSpeed = ""; String backDecideSpeed = "";
String travelTime = "";
String backtravelTime = "";
// 处理绿波时序图数据 // 处理绿波时序图数据
List<GreenBeltInfoVO.DirGreenDetail> dirGreenDetails = greenBeltInfoVO.getDirGreenDetails(); List<GreenBeltInfoVO.DirGreenDetail> dirGreenDetails = greenBeltInfoVO.getDirGreenDetails();
Double greenWidthTime = 0.0; Double greenWidthTime = 0.0;
...@@ -111,6 +114,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -111,6 +114,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
List<GreenBeltInfoVO.CrossGreenDetail> list = dirGreenDetail.getCrossGreenDetailList(); List<GreenBeltInfoVO.CrossGreenDetail> list = dirGreenDetail.getCrossGreenDetailList();
getaDouble(crossRedTimesMap, crossGreenStartMap, distanceMap, cycle, list); getaDouble(crossRedTimesMap, crossGreenStartMap, distanceMap, cycle, list);
decideSpeed = String.join("~", String.valueOf(dirGreenDetail.getMinSpeed()), String.valueOf(dirGreenDetail.getMaxSpeed())); decideSpeed = String.join("~", String.valueOf(dirGreenDetail.getMinSpeed()), String.valueOf(dirGreenDetail.getMaxSpeed()));
List<Double> travelTimeList = list.stream().map(GreenBeltInfoVO.CrossGreenDetail::getTravelTime).collect(Collectors.toList());
travelTime = mapper.writeValueAsString(travelTimeList);
} }
if (dirType == 0) { if (dirType == 0) {
backDecideSpeed = String.join("~", String.valueOf(dirGreenDetail.getMinSpeed()), String.valueOf(dirGreenDetail.getMaxSpeed())); backDecideSpeed = String.join("~", String.valueOf(dirGreenDetail.getMinSpeed()), String.valueOf(dirGreenDetail.getMaxSpeed()));
...@@ -118,7 +123,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -118,7 +123,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
List<GreenBeltInfoVO.CrossGreenDetail> list = dirGreenDetail.getCrossGreenDetailList(); List<GreenBeltInfoVO.CrossGreenDetail> list = dirGreenDetail.getCrossGreenDetailList();
Collections.reverse(list); Collections.reverse(list);
getaDouble(backCrossRedTimesMap, backCrossGreenStartMap, backDistanceMap, cycle, list); getaDouble(backCrossRedTimesMap, backCrossGreenStartMap, backDistanceMap, cycle, list);
List<Double> travelTimeList = list.stream().map(GreenBeltInfoVO.CrossGreenDetail::getTravelTime).collect(Collectors.toList());
backtravelTime = mapper.writeValueAsString(travelTimeList);
} }
} }
} }
...@@ -132,6 +138,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -132,6 +138,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
greenBeltChartVO.setDistanceMap(mapper.writeValueAsString(distanceMap)); greenBeltChartVO.setDistanceMap(mapper.writeValueAsString(distanceMap));
greenBeltChartVO.setDecideSpeed(decideSpeed.concat("km/h")); greenBeltChartVO.setDecideSpeed(decideSpeed.concat("km/h"));
greenBeltChartVO.setBackDecideSpeed(backDecideSpeed.concat("km/h")); greenBeltChartVO.setBackDecideSpeed(backDecideSpeed.concat("km/h"));
greenBeltChartVO.setTravelTime(travelTime);
greenBeltChartVO.setBackTravelTime(backtravelTime);
return greenBeltChartVO; return greenBeltChartVO;
} }
......
...@@ -43,6 +43,8 @@ public class GreenBeltChartVO { ...@@ -43,6 +43,8 @@ public class GreenBeltChartVO {
private Double BackGreenWidthTime; private Double BackGreenWidthTime;
private String decideSpeed; private String decideSpeed;
private String backDecideSpeed; private String backDecideSpeed;
private String travelTime;
private String backTravelTime;
@JsonCreator @JsonCreator
public GreenBeltChartVO(){ public GreenBeltChartVO(){
......
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