Commit 8bf5ad86 authored by zhouleilei's avatar zhouleilei

Merge remote-tracking branch 'origin/master'

parents f0c4b077 2ca7a1cc
...@@ -130,8 +130,7 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService { ...@@ -130,8 +130,7 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
vo.setStartTime(controlTime); vo.setStartTime(controlTime);
String crossGreenDetail = entity.getCrossGreenDetail(); String crossGreenDetail = entity.getCrossGreenDetail();
Integer cycle = entity.getCycle(); Integer cycle = entity.getCycle();
List<GreenBeltInfoVO.CrossGreenDetail> crossGreenDetails = mapper.readValue(crossGreenDetail, new TypeReference<List<GreenBeltInfoVO.CrossGreenDetail>>() { List<GreenBeltInfoVO.CrossGreenDetail> crossGreenDetails = mapper.readValue(crossGreenDetail, new TypeReference<List<GreenBeltInfoVO.CrossGreenDetail>>() {});
});
if (!CollectionUtils.isEmpty(crossGreenDetails)) { if (!CollectionUtils.isEmpty(crossGreenDetails)) {
List<GreenBeltInfoVO.CrossGreenDetail> keyCrossDetail = crossGreenDetails.stream().filter(details -> StringUtils.equalsIgnoreCase(keyCross, details.getCrossId())).collect(Collectors.toList()); List<GreenBeltInfoVO.CrossGreenDetail> keyCrossDetail = crossGreenDetails.stream().filter(details -> StringUtils.equalsIgnoreCase(keyCross, details.getCrossId())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(keyCrossDetail)) { if (!CollectionUtils.isEmpty(keyCrossDetail)) {
...@@ -159,7 +158,7 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService { ...@@ -159,7 +158,7 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
Integer flow = crossDataHistPO.getFlow(); Integer flow = crossDataHistPO.getFlow();
GreenBeltKeyCrossFlowTimeVO resultVO = new GreenBeltKeyCrossFlowTimeVO(); GreenBeltKeyCrossFlowTimeVO resultVO = new GreenBeltKeyCrossFlowTimeVO();
resultVO.setStartTime(minuteDate); resultVO.setStartTime(minuteDate);
resultVO.setFlow(0); resultVO.setFlow(flow);
resultVO.setGreenTimeRatio(0.0); resultVO.setGreenTimeRatio(0.0);
resultVO.setCrossId(tempCrossId); resultVO.setCrossId(tempCrossId);
resultVO.setDirName("未执行"); resultVO.setDirName("未执行");
...@@ -290,6 +289,7 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService { ...@@ -290,6 +289,7 @@ public class GreenBeltServiceImpl implements GreenBeltInfoService {
detail.setCrossId(crossDirDataHistPO.getCrossId()); detail.setCrossId(crossDirDataHistPO.getCrossId());
detail.setFlow(crossDirDataHistPO.getFlow()); detail.setFlow(crossDirDataHistPO.getFlow());
detail.setStopTimes(crossDirDataHistPO.getStopTimes()); detail.setStopTimes(crossDirDataHistPO.getStopTimes());
detail.setSpeed(crossDirDataHistPO.getSpeed());
detailList.add(detail); detailList.add(detail);
} }
} }
......
...@@ -14,9 +14,10 @@ import net.wanji.common.framework.rest.JsonViewObject; ...@@ -14,9 +14,10 @@ import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.JacksonUtils; import net.wanji.common.utils.tool.JacksonUtils;
import net.wanji.databus.dao.entity.GreenwaveInfoPO; import net.wanji.databus.dao.entity.GreenwaveInfoPO;
import net.wanji.databus.dao.mapper.BaseCrossInfoMapper; import net.wanji.databus.dao.mapper.BaseCrossInfoMapper;
import net.wanji.databus.dao.mapper.CrossDataRealtimeMapper;
import net.wanji.databus.dao.mapper.GreenwaveInfoMapper; import net.wanji.databus.dao.mapper.GreenwaveInfoMapper;
import net.wanji.databus.po.BaseCrossInfoPO; import net.wanji.databus.po.BaseCrossInfoPO;
import net.wanji.databus.po.TBaseCrossInfo; import net.wanji.databus.vo.AbnormalCrossListVO;
import net.wanji.opt.cache.BaseCrossInfoCache; import net.wanji.opt.cache.BaseCrossInfoCache;
import net.wanji.opt.cache.GreenWaveInfoCache; import net.wanji.opt.cache.GreenWaveInfoCache;
import net.wanji.opt.common.enums.StrategyControlEnum; import net.wanji.opt.common.enums.StrategyControlEnum;
...@@ -73,6 +74,8 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -73,6 +74,8 @@ public class StrategyControlServiceImpl implements StrategyControlService {
private StrategyCrossResultMapper strategyCrossResultMapper; private StrategyCrossResultMapper strategyCrossResultMapper;
@Resource @Resource
private BaseCrossInfoCache baseCrossInfoCache; private BaseCrossInfoCache baseCrossInfoCache;
@Resource
private CrossDataRealtimeMapper crossDataRealtimeMapper;
@Override @Override
...@@ -255,25 +258,21 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -255,25 +258,21 @@ public class StrategyControlServiceImpl implements StrategyControlService {
Map<String, StrategyControlDataEntity> map = runList.stream().collect(Collectors.toMap(StrategyControlDataEntity::getBizId, entity -> entity)); Map<String, StrategyControlDataEntity> map = runList.stream().collect(Collectors.toMap(StrategyControlDataEntity::getBizId, entity -> entity));
// 路口 // 路口
if (Objects.equals(0, type)) { if (Objects.equals(0, type)) {
LambdaQueryWrapper<TBaseCrossInfo> queryWrapper = new LambdaQueryWrapper<>(); List<AbnormalCrossListVO> abnormalCrossListVOS = crossDataRealtimeMapper.selectAbnormalCross(null, null, null);
queryWrapper.eq(TBaseCrossInfo::getIsSignal, 1); if (!CollectionUtils.isEmpty(abnormalCrossListVOS)) {
List<TBaseCrossInfo> baseCrossInfoPOS = baseCrossInfoMapper.selectList(queryWrapper); for (AbnormalCrossListVO baseCrossInfoPO : abnormalCrossListVOS) {
if (!CollectionUtils.isEmpty(baseCrossInfoPOS)) {
for (TBaseCrossInfo baseCrossInfoPO : baseCrossInfoPOS) {
StrategyControlDataEntity strategyControlDataEntity = new StrategyControlDataEntity(); StrategyControlDataEntity strategyControlDataEntity = new StrategyControlDataEntity();
String crossId = baseCrossInfoPO.getId(); String crossId = baseCrossInfoPO.getId();
strategyControlDataEntity.setBizType(0); strategyControlDataEntity.setBizType(0);
strategyControlDataEntity.setBizId(baseCrossInfoPO.getId()); strategyControlDataEntity.setBizId(crossId);
// 转化成 0 畅通 1失衡 2拥堵 3溢出 4死锁 5空放 6干线拥堵 7干线缓行 8干线畅通 // 转化成 0 畅通 1失衡 2拥堵 3溢出 4死锁 5空放 6干线拥堵 7干线缓行 8干线畅通
strategyControlDataEntity.setStrategy(0); Integer status = baseCrossInfoPO.getRealtimeStatus();
strategyControlDataEntity.setOptMethod("均衡调控"); strategyControlDataEntity.setStrategy(status);
strategyControlDataEntity.setOptMethod(Objects.equals(1, status) ? "均衡调控" : "效率提升");
strategyControlDataEntity.setTime(null); strategyControlDataEntity.setTime(null);
strategyControlDataEntity.setStatus(0); strategyControlDataEntity.setStatus(status);
if (map.containsKey(crossId)) {
strategyControlDataEntity = map.get(crossId);
}
strategyControlDataEntity.setCrossName(baseCrossInfoPO.getName()); strategyControlDataEntity.setCrossName(baseCrossInfoPO.getName());
String location = baseCrossInfoPO.getLocation(); String location = baseCrossInfoPO.getLocationStr();
location = location.replace("POINT(", "").replace(" ", ",").replace(")", ""); location = location.replace("POINT(", "").replace(" ", ",").replace(")", "");
strategyControlDataEntity.setWkt(location); strategyControlDataEntity.setWkt(location);
results.add(strategyControlDataEntity); results.add(strategyControlDataEntity);
......
...@@ -103,12 +103,12 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -103,12 +103,12 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
@Override @Override
public List<GreenBeltStopTimesQueueLengthVO> greenBeltStopTimeQueueLength(Integer greenId) { public List<GreenBeltStopTimesQueueLengthVO> greenBeltStopTimeQueueLength(Integer greenId) {
long currentTimeMillis = System.currentTimeMillis();
LambdaQueryWrapper<GreenwaveHistPO> queryWrapper = new LambdaQueryWrapper(); LambdaQueryWrapper<GreenwaveHistPO> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(GreenwaveHistPO::getGreenId, greenId); queryWrapper.eq(GreenwaveHistPO::getGreenId, greenId);
// 查询两个小时之前的 LocalDate currentDate = LocalDate.now();
Integer startTime = (int) (currentTimeMillis / 1000) - 3600 * 2; LocalTime startTime = LocalTime.MIDNIGHT;
queryWrapper.ge(GreenwaveHistPO::getStartTime, new Date(startTime * 1000L)); LocalDateTime startOfDay = LocalDateTime.of(currentDate, startTime);
queryWrapper.ge(GreenwaveHistPO::getStartTime, startOfDay);
List<GreenwaveHistPO> greenwaveHistPOS = greenwaveHistMapper.selectList(queryWrapper); List<GreenwaveHistPO> greenwaveHistPOS = greenwaveHistMapper.selectList(queryWrapper);
List<GreenBeltStopTimesQueueLengthVO> results = new ArrayList<>(); List<GreenBeltStopTimesQueueLengthVO> results = new ArrayList<>();
if (!CollectionUtils.isEmpty(greenwaveHistPOS)) { if (!CollectionUtils.isEmpty(greenwaveHistPOS)) {
...@@ -120,6 +120,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -120,6 +120,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
vo.setStopTimes(greenwaveHistPO.getStopTimes()); vo.setStopTimes(greenwaveHistPO.getStopTimes());
vo.setCordQueueRatio(Objects.isNull(greenwaveHistPO.getCordQueueRatio()) ? 0.0 : greenwaveHistPO.getCordQueueRatio() * 100); vo.setCordQueueRatio(Objects.isNull(greenwaveHistPO.getCordQueueRatio()) ? 0.0 : greenwaveHistPO.getCordQueueRatio() * 100);
vo.setTravelTime(greenwaveHistPO.getTrvalTime()); vo.setTravelTime(greenwaveHistPO.getTrvalTime());
vo.setSpeed(greenwaveHistPO.getSpeed());
vo.setRoadDirection(GreenBeltDirEnum.getDesc(greenwaveHistPO.getRoadDirection()));
results.add(vo); results.add(vo);
} }
} }
...@@ -214,6 +216,7 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -214,6 +216,7 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
LinkedList<Double> backCrossGreenStartList = new LinkedList<>(); LinkedList<Double> backCrossGreenStartList = new LinkedList<>();
Map<String, Double> distanceMap = new LinkedHashMap<>(); Map<String, Double> distanceMap = new LinkedHashMap<>();
Map<String, Double> backDistanceMap = new TreeMap<>(); Map<String, Double> backDistanceMap = new TreeMap<>();
String decideSpeed = ""; String decideSpeed = "";
String backDecideSpeed = ""; String backDecideSpeed = "";
String crossSpeed = ""; String crossSpeed = "";
...@@ -221,6 +224,9 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -221,6 +224,9 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
String travelTime = ""; String travelTime = "";
String backtravelTime = ""; String backtravelTime = "";
String offset = ""; String offset = "";
String distanceStr = "";
String backDistanceStr = "";
// 处理绿波时序图数据 // 处理绿波时序图数据
List<GreenBeltInfoVO.DirGreenDetail> dirGreenDetails = greenBeltInfoVO.getDirGreenDetails(); List<GreenBeltInfoVO.DirGreenDetail> dirGreenDetails = greenBeltInfoVO.getDirGreenDetails();
Double greenWidthTime = 0.0; Double greenWidthTime = 0.0;
...@@ -246,6 +252,9 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -246,6 +252,9 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
crossSpeed = mapper.writeValueAsString(integerList); crossSpeed = mapper.writeValueAsString(integerList);
List<Double> offsetList = list.stream().map(GreenBeltInfoVO.CrossGreenDetail::getOffset).collect(Collectors.toList()); List<Double> offsetList = list.stream().map(GreenBeltInfoVO.CrossGreenDetail::getOffset).collect(Collectors.toList());
offset = mapper.writeValueAsString(offsetList); offset = mapper.writeValueAsString(offsetList);
List<Double> distance = list.stream().filter(vo -> vo.getDistance() > 0).map(GreenBeltInfoVO.CrossGreenDetail::getDistance).collect(Collectors.toList());
distanceStr = mapper.writeValueAsString(distance);
} }
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()));
...@@ -263,6 +272,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -263,6 +272,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
} }
} }
backCrossSpeed = mapper.writeValueAsString(integerList); backCrossSpeed = mapper.writeValueAsString(integerList);
List<Double> distance = list.stream().filter(vo -> vo.getDistance() > 0).map(GreenBeltInfoVO.CrossGreenDetail::getDistance).collect(Collectors.toList());
backDistanceStr = mapper.writeValueAsString(distance);
} }
} }
} }
...@@ -285,6 +296,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService { ...@@ -285,6 +296,8 @@ public class StrategyGreenBeltServiceImpl implements StrategyGreenBeltService {
greenBeltChartVO.setCrossGreenStartList(strArray(crossGreenStartList)); greenBeltChartVO.setCrossGreenStartList(strArray(crossGreenStartList));
Collections.reverse(backCrossGreenStartList); Collections.reverse(backCrossGreenStartList);
greenBeltChartVO.setBackCrossGreenStartList(strArray(backCrossGreenStartList)); greenBeltChartVO.setBackCrossGreenStartList(strArray(backCrossGreenStartList));
greenBeltChartVO.setDistance(distanceStr);
greenBeltChartVO.setBackDistance(backDistanceStr);
return greenBeltChartVO; return greenBeltChartVO;
} }
......
...@@ -37,28 +37,28 @@ public class CrossMonitorTask { ...@@ -37,28 +37,28 @@ public class CrossMonitorTask {
* 路口实时监测 * 路口实时监测
* *
*/ */
@Scheduled(fixedRate = 1 * 60 * 1000) //@Scheduled(fixedRate = 1 * 60 * 1000)
public void realtimeMonitor() { //public void realtimeMonitor() {
log.info("路口实时监测任务..."); // log.info("路口实时监测任务...");
// 获取路口实时监测数据 // 获取路口实时监测数据
List<CrossDataRealtimePO> crossDataRealtimePOList = listCrossDataRealtime(); //List<CrossDataRealtimePO> crossDataRealtimePOList = listCrossDataRealtime();
log.info("路口实时数据:{}条", crossDataRealtimePOList.size()); //log.info("路口实时数据:{}条", crossDataRealtimePOList.size());
// 测试时无数据暂时注释 // 测试时无数据暂时注释
// if(crossDataRealtimePOList.isEmpty()) { // if(crossDataRealtimePOList.isEmpty()) {
// return ; // return ;
// } // }
// 获取所有信控路口异常数据(失衡/拥堵/溢出/死锁) // 获取所有信控路口异常数据(失衡/拥堵/溢出/死锁)
List<CrossDataRealtimePO> abnormalCrossList = listAbnormalCross(crossDataRealtimePOList); //List<CrossDataRealtimePO> abnormalCrossList = listAbnormalCross(crossDataRealtimePOList);
log.info("加载异常路口:{}条", abnormalCrossList.size()); //log.info("加载异常路口:{}条", abnormalCrossList.size());
// if(abnormalCrossList.isEmpty()) { // if(abnormalCrossList.isEmpty()) {
// return ; // return ;
// } // }
// 调用路口实时优化 // 调用路口实时优化
crossOptimizeService.realtimeOptimize(abnormalCrossList, crossDataRealtimePOList); //crossOptimizeService.realtimeOptimize(abnormalCrossList, crossDataRealtimePOList);
} //}
/** /**
* 获取异常路口数据 * 获取异常路口数据
......
...@@ -43,6 +43,8 @@ public class GreenBeltChartVO { ...@@ -43,6 +43,8 @@ public class GreenBeltChartVO {
private String offset; private String offset;
private String crossGreenStartList; private String crossGreenStartList;
private String backCrossGreenStartList; private String backCrossGreenStartList;
private String distance;
private String backDistance;
@JsonCreator @JsonCreator
public GreenBeltChartVO(){ public GreenBeltChartVO(){
......
...@@ -37,5 +37,8 @@ public class GreenBeltFlowStopTimeVO { ...@@ -37,5 +37,8 @@ public class GreenBeltFlowStopTimeVO {
@ApiModelProperty("行程时间") @ApiModelProperty("行程时间")
@JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class) @JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class)
private Double travelTime; private Double travelTime;
@ApiModelProperty("速度")
@JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class)
private Double speed;
} }
} }
...@@ -33,4 +33,7 @@ public class GreenBeltStopTimesQueueLengthVO { ...@@ -33,4 +33,7 @@ public class GreenBeltStopTimesQueueLengthVO {
private Double cordQueueRatio; private Double cordQueueRatio;
@ApiModelProperty("行程时间") @ApiModelProperty("行程时间")
private Integer travelTime; private Integer travelTime;
@ApiModelProperty("速度")
@JsonSerialize(using = Double2TwoDecimalPlacesSerializer.class)
private Double speed;
} }
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