Commit f8665050 authored by wangyecheng's avatar wangyecheng

Merge remote-tracking branch 'origin/master'

parents 4780005e bed7eba0
...@@ -18,5 +18,10 @@ import net.wanji.common.framework.mapper.BaseInterfaceMapper; ...@@ -18,5 +18,10 @@ import net.wanji.common.framework.mapper.BaseInterfaceMapper;
public interface EventInfoMapper extends BaseInterfaceMapper<EventInfo> { public interface EventInfoMapper extends BaseInterfaceMapper<EventInfo> {
List<Map<String,Object>> getListByStartAndEnd(Map<String, Object> map); List<Map<String,Object>> getListByStartAndEnd(Map<String, Object> map);
/**
* 路口缓行事件计算
*/
void insertCrossSlowRunEventData(@Param("startTime")String startTime,@Param("endTime")String endTime);
} }
...@@ -116,5 +116,15 @@ public interface AnalysisProblemCrossDayMapper extends BaseMapper<AnalysisProble ...@@ -116,5 +116,15 @@ public interface AnalysisProblemCrossDayMapper extends BaseMapper<AnalysisProble
List<GreenwaveCrossResultDTO> getTrunkLineCrossProblemByDay(); List<GreenwaveCrossResultDTO> getTrunkLineCrossProblemByDay();
void insertAnalysisCrossDayData(List<GreenwaveCrossResultDTO> greenwaveCrossResultList); void insertAnalysisCrossDayData(List<GreenwaveCrossResultDTO> greenwaveCrossResultList);
/**
* 绿波干线小时粒度拥堵数据
*/
void insertGreenCrossHourData(@Param("startTime")String startTime,@Param("endTime")String endTime);
/**
* 路口缓行数据天统计
*/
void insertAnalysisCrossSlowRunDay(@Param("dt") Integer dt);
} }
...@@ -19,4 +19,10 @@ public interface EventInfoService extends BaseDubboInterface<EventInfo> { ...@@ -19,4 +19,10 @@ public interface EventInfoService extends BaseDubboInterface<EventInfo> {
List<Map<String,Object>> getListByStartAndEnd(Map<String, Object> map); List<Map<String,Object>> getListByStartAndEnd(Map<String, Object> map);
/**
* 路口缓行事件计算
* @param startTime
* @param endTime
*/
void insertCrossSlowRunEventData(String startTime, String endTime);
} }
...@@ -41,16 +41,27 @@ public class EventInfoServiceImpl extends BaseDubboInterfaceImpl<EventInfo> impl ...@@ -41,16 +41,27 @@ public class EventInfoServiceImpl extends BaseDubboInterfaceImpl<EventInfo> impl
return this.eventInfoMapper; return this.eventInfoMapper;
} }
public List<Map<String,Object>> getListByStartAndEnd(Map<String, Object> map){ public List<Map<String, Object>> getListByStartAndEnd(Map<String, Object> map) {
List<Map<String,Object>> list = this.eventInfoMapper.getListByStartAndEnd(map); List<Map<String, Object>> list = this.eventInfoMapper.getListByStartAndEnd(map);
for (Map<String,Object> data : list) { for (Map<String, Object> data : list) {
String dir = Tools.getMapValue("dir",data); String dir = Tools.getMapValue("dir", data);
if (Objects.nonNull(dir) && dir.length()>2){ if (Objects.nonNull(dir) && dir.length() > 2) {
String dirName = CommonUtils.getEventHappenDirName(dir); String dirName = CommonUtils.getEventHappenDirName(dir);
data.put("dirName",dirName); data.put("dirName", dirName);
} }
} }
return list; return list;
} }
@Override
public void insertCrossSlowRunEventData(String startTime, String endTime) {
long st = System.currentTimeMillis();
eventInfoMapper.insertCrossSlowRunEventData(startTime, endTime);
long et = System.currentTimeMillis();
log.info("路口缓行事件计算耗时:{}ms,时间:{} {}",et-st,startTime,endTime);
}
} }
...@@ -76,4 +76,11 @@ public interface AnalysisProblemCrossDayService extends IService<AnalysisProblem ...@@ -76,4 +76,11 @@ public interface AnalysisProblemCrossDayService extends IService<AnalysisProblem
CrossOptAnalysisVO getCrossOptAnalysis(String crossID, String startTime,String endTime); CrossOptAnalysisVO getCrossOptAnalysis(String crossID, String startTime,String endTime);
void insertAnalysisProblemCrossDay(); void insertAnalysisProblemCrossDay();
public void insertGreenCrossHourData(String startTime, String endTime);
/**
* 路口缓行数据天统计
*/
void insertAnalysisCrossSlowRunDay(Integer dt);
} }
...@@ -13,6 +13,7 @@ import net.wanji.opt.synthesis.pojo.CrossOptAnalysisEntity; ...@@ -13,6 +13,7 @@ import net.wanji.opt.synthesis.pojo.CrossOptAnalysisEntity;
import net.wanji.opt.vo2.CrossOptAnalysisVO; import net.wanji.opt.vo2.CrossOptAnalysisVO;
import net.wanji.opt.vo2.GreenwaveCrossResult; import net.wanji.opt.vo2.GreenwaveCrossResult;
import net.wanji.opt.vo2.GreenwaveCrossResultDTO; import net.wanji.opt.vo2.GreenwaveCrossResultDTO;
import org.apache.ibatis.annotations.Param;
import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.Geometry;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -219,4 +220,17 @@ public class AnalysisProblemCrossDayServiceImpl extends ServiceImpl<AnalysisProb ...@@ -219,4 +220,17 @@ public class AnalysisProblemCrossDayServiceImpl extends ServiceImpl<AnalysisProb
analysisProblemCrossDayMapper.insertAnalysisCrossDayData(greenwaveCrossResultList); analysisProblemCrossDayMapper.insertAnalysisCrossDayData(greenwaveCrossResultList);
} }
@Override
public void insertGreenCrossHourData(String startTime, String endTime) {
analysisProblemCrossDayMapper.insertGreenCrossHourData(startTime,endTime);
}
@Override
public void insertAnalysisCrossSlowRunDay(Integer dt) {
analysisProblemCrossDayMapper.insertAnalysisCrossSlowRunDay(dt);
}
} }
package net.wanji.opt.task; package net.wanji.opt.task;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.opt.servicev2.evaluation.EventInfoService;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisGreenCongestionPeriodService; import net.wanji.opt.servicev2.judgeanalysis.AnalysisGreenCongestionPeriodService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable; import org.springframework.beans.factory.annotation.Configurable;
...@@ -9,6 +13,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -9,6 +13,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.text.ParseException; import java.text.ParseException;
@Component @Component
...@@ -20,17 +25,51 @@ public class AnalysisGreenCongestionPeriodWeekTask { ...@@ -20,17 +25,51 @@ public class AnalysisGreenCongestionPeriodWeekTask {
@Autowired @Autowired
private AnalysisGreenCongestionPeriodService analysisGreenCongestionPeriodService; private AnalysisGreenCongestionPeriodService analysisGreenCongestionPeriodService;
@Resource
EventInfoService eventInfoService;
@Scheduled(cron = "0 30 2 ? * 1") @Scheduled(cron = "0 30 2 ? * 1")
public void task() throws ParseException { public void task() throws ParseException {
try {
analysisGreenCongestionPeriodService.selectCountByCongestionPeriod(); analysisGreenCongestionPeriodService.selectCountByCongestionPeriod();
analysisGreenCongestionPeriodService.selectCountByLandData(); analysisGreenCongestionPeriodService.selectCountByLandData();
//analysisGreenCongestionPeriodService.selectCountByCrossData(); //analysisGreenCongestionPeriodService.selectCountByCrossData();
}catch (Exception e){
log.error("",e);
}
} }
@Scheduled(cron = "0 0 2 ? * ? ") @Scheduled(cron = "0 0 2 ? * ? ")
public void taskDay() throws ParseException { public void taskDay() throws ParseException {
try {
analysisGreenCongestionPeriodService.selectCountByCrossDataOneDay(); analysisGreenCongestionPeriodService.selectCountByCrossDataOneDay();
}catch (Exception e){
log.error("",e);
}
}
@Scheduled(cron = "0 0 2 ? * ? ")
public void insertCrossSlowRunEventData() throws ParseException {
try {
DateTime endTDateTime = DateUtil.date();
//开始时间
DateTime startTDateTime = DateUtil.offsetDay(endTDateTime, -1);
startTDateTime = DateUtil.beginOfDay(startTDateTime);
String sdt = startTDateTime.toString("yyyy-MM-dd HH:00:00");
//窗口截止时间
endTDateTime = DateUtil.parseDateTime(sdt).offset(DateField.HOUR,24).offset(DateField.SECOND,-1);
String edt = endTDateTime.toString("yyyy-MM-dd HH:mm:ss");
eventInfoService.insertCrossSlowRunEventData(sdt,edt);
}catch (Exception e){
log.error("",e);
}
} }
} }
package net.wanji.opt.task; package net.wanji.opt.task;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.opt.servicev2.judgeanalysis.AnalysisProblemCrossDayService; import net.wanji.opt.servicev2.judgeanalysis.AnalysisProblemCrossDayService;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
...@@ -9,18 +12,21 @@ import org.springframework.stereotype.Component; ...@@ -9,18 +12,21 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Date;
@Component @Component
@Slf4j @Slf4j
public class AnalysisProblemCrossDayTask implements ApplicationRunner { public class AnalysisProblemCrossDayTask implements ApplicationRunner {
@Resource @Resource
private AnalysisProblemCrossDayService analysisProblemCrossDayService; private AnalysisProblemCrossDayService analysisProblemCrossDayService;
@Override @Override
public void run(ApplicationArguments args) throws Exception { public void run(ApplicationArguments args) throws Exception {
log.info("服务启动时--干线协调方向频发拥堵/缓行路段--任务执行时间:" + LocalDateTime.now()); log.info("服务启动时--干线协调方向频发拥堵/缓行路段--任务执行时间:" + LocalDateTime.now());
// 干线协调方向频发拥堵/缓行路段 // 干线协调方向频发拥堵/缓行路段
try { try {
// analysisProblemCrossDayService.insertAnalysisProblemCrossDay(); // analysisProblemCrossDayService.insertAnalysisProblemCrossDay();
}catch (Exception e){ } catch (Exception e) {
log.error("服务启动时--干线协调方向频发拥堵/缓行路段--任务执行错误" + e); log.error("服务启动时--干线协调方向频发拥堵/缓行路段--任务执行错误" + e);
} }
log.info("服务启动时--干线协调方向频发拥堵/缓行路段--任务执行结束时间:" + LocalDateTime.now()); log.info("服务启动时--干线协调方向频发拥堵/缓行路段--任务执行结束时间:" + LocalDateTime.now());
...@@ -29,15 +35,61 @@ public class AnalysisProblemCrossDayTask implements ApplicationRunner { ...@@ -29,15 +35,61 @@ public class AnalysisProblemCrossDayTask implements ApplicationRunner {
/** /**
* 每凌晨 0:30 执行的任务 * 每凌晨 0:30 执行的任务
*/ */
@Scheduled(cron = "0 10 0 * * ?") public void executeWeeklyTask() { @Scheduled(cron = "0 10 0 * * ?")
public void executeWeeklyTask() {
//干线协调方向频发拥堵/缓行路段 //干线协调方向频发拥堵/缓行路段
log.info("定时任务--干线协调方向频发拥堵/缓行路段--执行开始时间:" + LocalDateTime.now()); log.info("定时任务--干线协调方向频发拥堵/缓行路段--执行开始时间:" + LocalDateTime.now());
try { try {
analysisProblemCrossDayService.insertAnalysisProblemCrossDay(); analysisProblemCrossDayService.insertAnalysisProblemCrossDay();
}catch (Exception e){ } catch (Exception e) {
log.error("定时任务--干线协调方向频发拥堵/缓行路段--任务执行错误" + e); log.error("定时任务--干线协调方向频发拥堵/缓行路段--任务执行错误" + e);
} }
log.info("定时任务--干线协调方向频发拥堵/缓行路段--执行结束时间:" + LocalDateTime.now()); log.info("定时任务--干线协调方向频发拥堵/缓行路段--执行结束时间:" + LocalDateTime.now());
} }
/**
* 每小时执行溢出
*/
@Scheduled(cron = "5 0 * * * ?")
public void executeGreenCrossHourTask() {
//干线协调方向频发拥堵/缓行路段
log.info("定时任务--干线协调方向频发拥堵/缓行路段--执行开始时间:" + LocalDateTime.now());
try {
DateTime endTDateTime = DateUtil.date();
//开始时间
DateTime startTDateTime = DateUtil.offsetHour(endTDateTime, -1);
String sdt = startTDateTime.toString("yyyy-MM-dd HH:00:00");
//窗口截止时间
endTDateTime =DateUtil.parseDateTime(sdt).offset(DateField.HOUR,1).offset(DateField.SECOND,-1);
String edt = endTDateTime.toString("yyyy-MM-dd HH:mm:ss");
analysisProblemCrossDayService.insertGreenCrossHourData(sdt, edt);
log.info("干线协调方向频发拥堵/缓行路段=》小时粒度数据入库,小时开始时间:{},小时截止时间:{},截止时间:{}", sdt, edt, endTDateTime.toString("yyyy-MM-dd HH:mm:ss"));
} catch (Exception e) {
log.error("定时任务--干线协调方向频发拥堵/缓行路段--任务执行错误" + e);
}
log.info("定时任务--干线协调方向频发拥堵/缓行路段--执行结束时间:" + LocalDateTime.now());
}
public static void main(String[] args) {
DateTime endTDateTime = DateUtil.date();
//开始时间
DateTime startTDateTime = DateUtil.offsetHour(endTDateTime, -1);
String sdt = startTDateTime.toString("yyyy-MM-dd HH:00:00");
//窗口截止时间
DateTime endDateTime = DateUtil.parseDateTime(sdt).offset(DateField.HOUR,1).offset(DateField.SECOND,-1);
String edt = endDateTime.toString("yyyy-MM-dd HH:mm:ss");
System.out.println(sdt+" "+edt);
}
} }
package net.wanji.opt.task; package net.wanji.opt.task;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemCrossDayMapper; import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemCrossDayMapper;
import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemGreenDayMapper; import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemGreenDayMapper;
...@@ -33,22 +35,35 @@ public class AnalysisProblemDayTask { ...@@ -33,22 +35,35 @@ public class AnalysisProblemDayTask {
private AnalysisProblemGreenDayServiceImpl nalysisProblemGreenDayServiceImpl; private AnalysisProblemGreenDayServiceImpl nalysisProblemGreenDayServiceImpl;
@Scheduled(cron = "0 15 0 ? * *") @Scheduled(cron = "0 15 0 ? * *")
public void task(){ public void task() {
try {
//执行检查路口id是否还有area_id没赋值的数据 //执行检查路口id是否还有area_id没赋值的数据
analysisProblemCrossDayServiceImpl.updateCrossAreaIdByCondition(); analysisProblemCrossDayServiceImpl.updateCrossAreaIdByCondition();
//执行检查绿波id是否还有area_id没赋值的数据
nalysisProblemGreenDayServiceImpl.updateGreenAreaIdByCondition();
//检查昨日数据是否有统计 //检查昨日数据是否有统计
List<AnalysisProblemCrossDay> list = analysisProblemCrossDayMapper.checkData(); List<AnalysisProblemCrossDay> list = analysisProblemCrossDayMapper.checkData();
if(list.isEmpty()) if (list.isEmpty()) {
{
analysisProblemCrossDayMapper.insertAnalysisProblemCrossDay(); analysisProblemCrossDayMapper.insertAnalysisProblemCrossDay();
//路口缓行事件数据单独计算
long st = System.currentTimeMillis();
DateTime yesterday = DateUtil.yesterday();
String dt = yesterday.toString("yyyyMMdd");
analysisProblemCrossDayMapper.insertAnalysisCrossSlowRunDay(Integer.valueOf(dt) );
long et = System.currentTimeMillis();
log.info("路口缓行按天统计耗时:{}ms,day:", et-st,dt);
}
} catch (Exception e) {
log.error("路口问题天数据统计异常",e);
} }
try {
//执行检查绿波id是否还有area_id没赋值的数据
nalysisProblemGreenDayServiceImpl.updateGreenAreaIdByCondition();
//检查昨日数据是否有统计 //检查昨日数据是否有统计
List<AnalysisProblemGreenDay> list1 = analysisProblemGreenDayMapper.checkData(); List<AnalysisProblemGreenDay> list1 = analysisProblemGreenDayMapper.checkData();
if(list1.isEmpty()) if (list1.isEmpty()) {
{
analysisProblemGreenDayMapper.insertAnalysisProblemGreenDay(); analysisProblemGreenDayMapper.insertAnalysisProblemGreenDay();
} }
}catch (Exception e) {
log.error("干线问题天数据统计异常",e);
}
} }
} }
...@@ -93,6 +93,9 @@ public class HisenseGreenChartTask { ...@@ -93,6 +93,9 @@ public class HisenseGreenChartTask {
// 1.根据绿波带长度和速度计算行程时间 // 1.根据绿波带长度和速度计算行程时间
// 2.根据相位差,行程时间,海信环图计算绿灯红灯点位 正向 crossRedTimesMap 反向backCrossRedTimesMap // 2.根据相位差,行程时间,海信环图计算绿灯红灯点位 正向 crossRedTimesMap 反向backCrossRedTimesMap
// todo test
//List<GreenCrossDirDTO> collect = greenCrossDirCache.stream().filter(dto -> dto.getGreenId() == 1).collect(Collectors.toList());
Map<Integer, List<GreenCrossDirDTO>> greenMap = greenCrossDirCache.stream().collect(Collectors.groupingBy(GreenCrossDirDTO::getGreenId)); Map<Integer, List<GreenCrossDirDTO>> greenMap = greenCrossDirCache.stream().collect(Collectors.groupingBy(GreenCrossDirDTO::getGreenId));
List<GreenBeltChartDTO> greenBeltChartDTOS = new ArrayList<>(); List<GreenBeltChartDTO> greenBeltChartDTOS = new ArrayList<>();
for (Map.Entry<Integer, List<GreenCrossDirDTO>> entry : greenMap.entrySet()) { for (Map.Entry<Integer, List<GreenCrossDirDTO>> entry : greenMap.entrySet()) {
...@@ -219,7 +222,7 @@ public class HisenseGreenChartTask { ...@@ -219,7 +222,7 @@ public class HisenseGreenChartTask {
Map<String, List<List<Double>>> greenStartMap = new LinkedHashMap<>(); Map<String, List<List<Double>>> greenStartMap = new LinkedHashMap<>();
List<List<Double>> firstGreenStartList = new ArrayList<>(); List<List<Double>> firstGreenStartList = new ArrayList<>();
List<List<Double>> secondGreenStartList = new ArrayList<>(); List<List<Double>> secondGreenStartList = new ArrayList<>();
List<Double> firstStartEndList = new ArrayList<>();
GreenCrossDirDTO firstDto = value.get(i); GreenCrossDirDTO firstDto = value.get(i);
String firstCrossId = firstDto.getCrossId(); String firstCrossId = firstDto.getCrossId();
Integer inCrossDir = null; Integer inCrossDir = null;
...@@ -248,7 +251,8 @@ public class HisenseGreenChartTask { ...@@ -248,7 +251,8 @@ public class HisenseGreenChartTask {
} }
if (2 == type) { if (2 == type) {
beltDir = greenBeltChartDTO.getBackDir(); beltDir = greenBeltChartDTO.getBackDir();
} } }
}
if (Objects.equals(greenId, beltGreenId) && Objects.equals(inCrossDir, beltDir)) { if (Objects.equals(greenId, beltGreenId) && Objects.equals(inCrossDir, beltDir)) {
Double travelTime = getTravelTime(i, greenBeltChartDTO, type); Double travelTime = getTravelTime(i, greenBeltChartDTO, type);
Map<String, List<List<Double>>> crossGreenTimesMap = null; Map<String, List<List<Double>>> crossGreenTimesMap = null;
...@@ -266,11 +270,6 @@ public class HisenseGreenChartTask { ...@@ -266,11 +270,6 @@ public class HisenseGreenChartTask {
List<Double> greenStartEnd = firstList.get(i1); List<Double> greenStartEnd = firstList.get(i1);
Double greenStart = greenStartEnd.get(0); Double greenStart = greenStartEnd.get(0);
Double greenEnd = greenStartEnd.get(1); Double greenEnd = greenStartEnd.get(1);
int index = 0;
Double start = 0.0;
Double end = 0.0;
Double start2 = 0.0;
Double end2 = 0.0;
for (int j = greenStart.intValue(); j <= greenEnd.intValue(); j++) { for (int j = greenStart.intValue(); j <= greenEnd.intValue(); j++) {
int firstStartPoint = j + travelTime.intValue(); int firstStartPoint = j + travelTime.intValue();
for (int i3 = 0; i3 < secondList.size(); i3++) { for (int i3 = 0; i3 < secondList.size(); i3++) {
...@@ -281,21 +280,30 @@ public class HisenseGreenChartTask { ...@@ -281,21 +280,30 @@ public class HisenseGreenChartTask {
if (greenStart <= j && j <= greenEnd if (greenStart <= j && j <= greenEnd
&& greenStart2 <= firstStartPoint && firstStartPoint <= greenEnd2) { && greenStart2 <= firstStartPoint && firstStartPoint <= greenEnd2) {
if (index == 0) { Double temp = j * 1.0;
start = j * 1.0; firstStartEndList.add(temp);
start2 = firstStartPoint * 1.0; }
} else {
Double tempEnd = j * 1.0;
end = end > tempEnd ? end : tempEnd;
Double tempEnd2 = firstStartPoint * 1.0;
end2 = end2 > tempEnd2 ? end2 : tempEnd2;
} }
++index;
} }
} }
} }
if (!CollectionUtils.isEmpty(firstStartEndList)) {
Double start = firstStartEndList.get(0);
Double end = firstStartEndList.get(0);
for (int k = 1; k < firstStartEndList.size(); k++) {
Double next = firstStartEndList.get(k);
Double prev = firstStartEndList.get(k - 1);
if (next - prev == 1.0) {
end = firstStartEndList.get(k);
if (k + 1 == firstStartEndList.size()) {
firstGreenStartList.add(Arrays.asList(start, end));
secondGreenStartList.add(Arrays.asList(start + travelTime.intValue(), end + travelTime.intValue()));
}
} else {
firstGreenStartList.add(Arrays.asList(start, end)); firstGreenStartList.add(Arrays.asList(start, end));
secondGreenStartList.add(Arrays.asList(start2, end2)); secondGreenStartList.add(Arrays.asList(start + travelTime.intValue(), end + travelTime.intValue()));
start = firstStartEndList.get(k);
end = firstStartEndList.get(k);
} }
} }
} }
...@@ -303,6 +311,7 @@ public class HisenseGreenChartTask { ...@@ -303,6 +311,7 @@ public class HisenseGreenChartTask {
greenStartMap.put(secondCrossId, secondGreenStartList); greenStartMap.put(secondCrossId, secondGreenStartList);
} }
} }
}
greenwaveStartGroup.add(greenStartMap); greenwaveStartGroup.add(greenStartMap);
} }
} }
...@@ -373,20 +382,23 @@ public class HisenseGreenChartTask { ...@@ -373,20 +382,23 @@ public class HisenseGreenChartTask {
// 绿灯时间 // 绿灯时间
crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenStartTime, cycleIndex + offset + greenEndTime)); crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenStartTime, cycleIndex + offset + greenEndTime));
} else if (i > 0 && i < cycleSum) { } else if (i > 0 && i < cycleSum) {
crossRedTimes.add(Arrays.asList(cycleIndex + offset + greenEndTime, cycleIndex * (i + 1) + offset)); crossRedTimes.add(Arrays.asList(cycleIndex + offset + greenEndTime, cycleLen * (i + 1) + offset));
// 绿灯时间 // 绿灯时间
crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenStartTime, cycleIndex + offset + greenEndTime)); crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenStartTime, cycleIndex + offset + greenEndTime));
} else if (i == cycleSum) { } else if (i == cycleSum) {
// a最后一个周期补充相位差 // a最后一个周期补充相位差
crossRedTimes.add(Arrays.asList(cycleIndex + offset + greenEndTime, cycleIndex + offset + endCycleExt));
// 绿灯时间 // 绿灯时间
if (greenStartTime > endCycleExt) { if (endCycleExt <= greenStartTime) {
//crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenStartTime, cycleIndex + offset + endCycleExt)); crossRedTimes.add(Arrays.asList(cycleIndex + offset, cycleIndex + offset + endCycleExt));
} else { } else if (greenStartTime <= endCycleExt && endCycleExt <= greenEndTime) {
crossRedTimes.add(Arrays.asList(cycleIndex + offset, cycleIndex + offset + greenStartTime));
crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenStartTime, cycleIndex + offset + endCycleExt)); crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenStartTime, cycleIndex + offset + endCycleExt));
} else {
crossRedTimes.add(Arrays.asList(cycleIndex + offset, cycleIndex + offset + greenStartTime));
crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenStartTime, cycleIndex + offset + greenEndTime));
crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenEndTime, cycleIndex + offset + endCycleExt));
} }
} }
} else { // 红灯结束时间 < 相位差, 相位差包含绿灯,endCycleExt都是红灯 } else { // 红灯结束时间 < 相位差, 相位差包含绿灯,endCycleExt都是红灯
// 相位差中绿灯时间 // 相位差中绿灯时间
if (i == 0) { if (i == 0) {
...@@ -401,7 +413,7 @@ public class HisenseGreenChartTask { ...@@ -401,7 +413,7 @@ public class HisenseGreenChartTask {
crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenStartTime, cycleIndex + offset + greenEndTime)); crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenStartTime, cycleIndex + offset + greenEndTime));
} else if (i > 0 && i < cycleSum) { } else if (i > 0 && i < cycleSum) {
crossRedTimes.add(Arrays.asList(cycleIndex + offset, cycleIndex + offset + greenStartTime)); crossRedTimes.add(Arrays.asList(cycleIndex + offset, cycleIndex + offset + greenStartTime));
crossRedTimes.add(Arrays.asList(cycleIndex + offset + greenEndTime, cycleIndex * (i + 1) + offset)); crossRedTimes.add(Arrays.asList(cycleIndex + offset + greenEndTime, cycleLen * (i + 1) + offset));
// 绿灯时间 // 绿灯时间
crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenStartTime, cycleIndex + offset + greenEndTime)); crossGreenTimes.add(Arrays.asList(cycleIndex + offset + greenStartTime, cycleIndex + offset + greenEndTime));
} }
...@@ -466,7 +478,8 @@ public class HisenseGreenChartTask { ...@@ -466,7 +478,8 @@ public class HisenseGreenChartTask {
if (StringUtils.isBlank(str)) { if (StringUtils.isBlank(str)) {
continue; continue;
} }
List<RingPhaseInfoDTO> ringPhaseInfoDTOS = mapper.readValue(str, new TypeReference<List<RingPhaseInfoDTO>>() {}); List<RingPhaseInfoDTO> ringPhaseInfoDTOS = mapper.readValue(str, new TypeReference<List<RingPhaseInfoDTO>>() {
});
// 遍历绿波路口协调方向 // 遍历绿波路口协调方向
if (StringUtils.isNotBlank(greenDirStr)) { if (StringUtils.isNotBlank(greenDirStr)) {
String[] greenDirArray = greenDirStr.split(","); String[] greenDirArray = greenDirStr.split(",");
...@@ -543,7 +556,8 @@ public class HisenseGreenChartTask { ...@@ -543,7 +556,8 @@ public class HisenseGreenChartTask {
String dir = entity.getDir(); String dir = entity.getDir();
Integer inDir = GreenBeltDirEnum.getInDir(dir); Integer inDir = GreenBeltDirEnum.getInDir(dir);
Double greenWidthTime = entity.getGreenWidthTime(); Double greenWidthTime = entity.getGreenWidthTime();
List<GreenBeltInfoVO.CrossGreenDetail> crossGreenDetailList = mapper.readValue(crossGreenDetail, new TypeReference<List<GreenBeltInfoVO.CrossGreenDetail>>() {}); List<GreenBeltInfoVO.CrossGreenDetail> crossGreenDetailList = mapper.readValue(crossGreenDetail, new TypeReference<List<GreenBeltInfoVO.CrossGreenDetail>>() {
});
if (!CollectionUtils.isEmpty(crossGreenDetailList)) { if (!CollectionUtils.isEmpty(crossGreenDetailList)) {
// 默认神思优化方案100,相位101 // 默认神思优化方案100,相位101
int index = 100; int index = 100;
......
...@@ -451,4 +451,34 @@ ...@@ -451,4 +451,34 @@
start_time DESC start_time DESC
</select> </select>
<!-- 路口缓行时间数据插入(5分钟粒度):路口有2个及以上方向发生了拥堵则计为路口发生缓行-->
<insert id="insertCrossSlowRunEventData" parameterType="map">
INSERT INTO t_analysis_cross_slow_run_event ( cross_id, dir, start_time, end_time, dt, insert_time )
SELECT
cross_id,
concat( '[', GROUP_CONCAT( dir_type ), ']' ) dir,
start_time,
DATE_ADD( start_time, INTERVAL 5 MINUTE ) AS end_time,
dt,
now()
FROM
t_cross_dir_data_hist
WHERE
start_time >= #{startTime} and start_time &lt; #{endTime}
AND `status` = 2
GROUP BY
cross_id,
start_time
HAVING
count(*)>=2
ON DUPLICATE KEY UPDATE
cross_id=values(cross_id),
dir=values(dir),
start_time=values(start_time),
end_time=values(end_time),
dt=values(dt),
insert_time=values(insert_time)
</insert>
</mapper> </mapper>
...@@ -258,7 +258,84 @@ ...@@ -258,7 +258,84 @@
time_span_list=VALUES(time_span_list), time_span_list=VALUES(time_span_list),
week_day=VALUES(week_day), week_day=VALUES(week_day),
year_week=VALUES(year_week) year_week=VALUES(year_week)
</insert> </insert>
<!-- 路口缓行数据天统计 -->
<insert id="insertAnalysisCrossSlowRunDay" parameterType="map">
<!-- 先设置会话级group_conct的最大长度 -->
SET SESSION group_concat_max_len = 1048576;
insert into t_analysis_problem_cross_day (id,cross_id,area_id,event_category,event_type,event_number,event_total_time,dt,insert_time,
serious_time_span,serious_duration,time_span_list,week_day,year_week)
select UUID(),
a.cross_id,
b.area_id,
a.category,
a.type,
count(1) as event_number , sum( TIMESTAMPDIFF(SECOND, a.start_time , a.end_time) ) as duration ,
dt , now(),
SUBSTRING_INDEX(
GROUP_CONCAT(
CONCAT(
date_format(a.start_time,'%H:%i:%s'),
'~',
CONCAT(date_format(a.end_time,'%H:%i:%s'))
)
ORDER BY TIMESTAMPDIFF( SECOND, a.start_time, a.end_time ) desc
)
,',',1) as serious_time_span,
max(TIMESTAMPDIFF( SECOND, a.start_time, a.end_time )) as serious_duration,
GROUP_CONCAT(
CONCAT(
date_format(a.start_time,'%H:%i:%s'),
'~',
CONCAT(date_format(a.end_time,'%H:%i:%s'))
)
) time_span_list,
(WEEKDAY(start_time)+1) week_day,
concat(year(start_time),'',(week(start_time)+1)) year_week
from (
<!-- 路口缓行计算 -->
SELECT
cross_id,
start_time,
DATE_ADD( start_time, INTERVAL 5 MINUTE ) AS end_time,
dt,
'4' AS category,
'708' AS type
FROM
t_cross_dir_data_hist
WHERE
dt = #{dt}
AND `status` = 2
GROUP BY
cross_id,
start_time
HAVING
count(*)>=2
) a
left join t_base_cross_info b on a.cross_id = b.id
group by a.cross_id, b.area_id,a.category,a.type
ON DUPLICATE KEY UPDATE
id=VALUES(id),
cross_id=VALUES(cross_id),
area_id=VALUES(area_id),
event_category=VALUES(event_category),
event_type=VALUES(event_type),
event_number=VALUES(event_number),
event_total_time=VALUES(event_total_time),
window_start_time=VALUES(window_start_time),
window_end_time=VALUES(window_end_time),
dt=VALUES(dt),
insert_time=VALUES(insert_time),
serious_time_span=VALUES(serious_time_span),
serious_duration=VALUES(serious_duration),
time_span_list=VALUES(time_span_list),
week_day=VALUES(week_day),
year_week=VALUES(year_week)
</insert>
<!-- 新增表t_analysis_problem_cross_dir_hour信息 --> <!-- 新增表t_analysis_problem_cross_dir_hour信息 -->
<insert id="insertAnalysisProblemCrossHour"> <insert id="insertAnalysisProblemCrossHour">
...@@ -434,5 +511,35 @@ ...@@ -434,5 +511,35 @@
where ( b.in_dir = a.dir_type OR b.out_dir = a.dir_type ) where ( b.in_dir = a.dir_type OR b.out_dir = a.dir_type )
</select> </select>
<insert id="insertGreenCrossHourData" parameterType="map">
INSERT INTO t_analysis_green_wave_cross_hour_data (green_id, dir_count, cross_id, status, dir_type, in_dir, out_dir, name, start_time, end_time)
SELECT
b.green_id,
a.dir_count,
a.cross_id,
a.status,
a.dir_type,
b.in_dir,
b.out_dir,
c.name,
#{startTime} as startTime,
#{endTime} as endTime
FROM
(
SELECT count(*) AS dir_count, cross_id, dir_type, status
FROM t_cross_dir_data_hist
WHERE
start_time BETWEEN #{startTime} AND #{endTime}
GROUP BY cross_id, dir_type, status
) a
LEFT JOIN t_greenwave_cross b ON a.cross_id = b.cross_id
LEFT JOIN t_base_cross_info c ON a.cross_id = c.id
where ( b.in_dir = a.dir_type OR b.out_dir = a.dir_type )
ON DUPLICATE KEY UPDATE
dir_count = VALUES(dir_count),
in_dir = VALUES(in_dir),
out_dir = VALUES(out_dir),
name = VALUES(name)
</insert>
</mapper> </mapper>
...@@ -54,11 +54,11 @@ ...@@ -54,11 +54,11 @@
select * from t_config_peak_hours; select * from t_config_peak_hours;
</select> </select>
<select id="selectGreenWaveWeekDataByTime" resultType="net.wanji.opt.entity.report.GreenWaveWeekData"> <select id="selectGreenWaveWeekDataByTime" resultType="net.wanji.opt.entity.report.GreenWaveWeekData">
SELECT green_id,road_direction,max(traffic_index) max_congest_index,avg(traffic_index) congest_index,sum(status>=3 and status &lt;=4)*60*5 congest_duration,avg(speed) speed,sum(trval_time) travel_time SELECT green_id,road_direction,max(traffic_index) max_congest_index,avg(traffic_index) congest_index,sum(status>=3 and status &lt;=4)*60*5 congest_duration,avg(speed) speed,avg(trval_time) travel_time
from t_greenwave_hist where start_time BETWEEN #{startDate} AND #{endDate} AND TIME( start_time ) BETWEEN #{startTime} AND #{endTime} GROUP BY green_id,road_direction from t_greenwave_hist where start_time BETWEEN #{startDate} AND #{endDate} AND TIME( start_time ) BETWEEN #{startTime} AND #{endTime} GROUP BY green_id,road_direction
</select> </select>
<select id="selectGreenWaveWeekData" resultType="net.wanji.opt.entity.report.GreenWaveWeekData"> <select id="selectGreenWaveWeekData" resultType="net.wanji.opt.entity.report.GreenWaveWeekData">
SELECT green_id,road_direction,max(traffic_index) max_congest_index,avg(traffic_index) congest_index,sum(status>=3 and status&lt;=4)*60*5 congest_duration,avg(speed) speed,sum(trval_time) travel_time SELECT green_id,road_direction,max(traffic_index) max_congest_index,avg(traffic_index) congest_index,sum(status>=3 and status&lt;=4)*60*5 congest_duration,avg(speed) speed,avg(trval_time) travel_time
from t_greenwave_hist where start_time BETWEEN #{startDate} AND #{endDate} GROUP BY green_id,road_direction from t_greenwave_hist where start_time BETWEEN #{startDate} AND #{endDate} GROUP BY green_id,road_direction
</select> </select>
......
...@@ -2,8 +2,13 @@ ...@@ -2,8 +2,13 @@
* *
*/ */
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import net.wanji.opt.SignalOptimizeApplication; import net.wanji.opt.SignalOptimizeApplication;
import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemCrossDayMapper; import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemCrossDayMapper;
import net.wanji.opt.servicev2.evaluation.EventInfoService;
import org.junit.FixMethodOrder; import org.junit.FixMethodOrder;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -12,6 +17,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,6 +17,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.text.ParseException;
import java.util.Date;
/** /**
* @author fengyi * @author fengyi
* @date * @date
...@@ -19,18 +28,79 @@ import org.springframework.test.context.junit4.SpringRunner; ...@@ -19,18 +28,79 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@SpringBootTest(classes = SignalOptimizeApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(classes = SignalOptimizeApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
@Slf4j
public class AnalysisProblemDayTaskTest { public class AnalysisProblemDayTaskTest {
@Autowired @Autowired
private AnalysisProblemCrossDayMapper analysisProblemCrossDayMapper; private AnalysisProblemCrossDayMapper analysisProblemCrossDayMapper;
@Resource
EventInfoService eventInfoService;
@Test @Test
public void testProducerTrack() { public void testProducerTrack() {
long st = System.currentTimeMillis(); long st = System.currentTimeMillis();
analysisProblemCrossDayMapper.insertAnalysisProblemCrossDay(); DateTime startTDateTime = DateUtil.beginOfDay(new Date());
DateTime endTDateTime = DateUtil.date(); //DateUtil.offsetHour(startTDateTime,1);
while (startTDateTime.isBefore(endTDateTime)) {
String sdt = startTDateTime.toString("yyyy-MM-dd HH:00:00");
startTDateTime = DateUtil.offsetHour(startTDateTime, 1);
startTDateTime = DateUtil.offsetSecond(startTDateTime, -1);
String edt = startTDateTime.toString("yyyy-MM-dd HH:mm:ss");
analysisProblemCrossDayMapper.insertGreenCrossHourData(sdt, edt);
startTDateTime = DateUtil.offsetSecond(startTDateTime, 1);
log.info("小时粒度数据入库,小时开始时间:{},小时截止时间:{},截止时间:{}", sdt, edt, endTDateTime.toString("yyyy-MM-dd HH:mm:ss"));
}
long et = System.currentTimeMillis(); long et = System.currentTimeMillis();
System.out.println((et-st)+"ms"); System.out.println((et - st) + "ms");
}
@Test
public void insertCrossSlowRunEventData() throws ParseException {
try {
for (int i = 28; i > 0; i--) {
DateTime endTDateTime = DateUtil.date();
//开始时间
DateTime startTDateTime = DateUtil.offsetDay(endTDateTime, -i);
startTDateTime = DateUtil.beginOfDay(startTDateTime);
String sdt = startTDateTime.toString("yyyy-MM-dd HH:00:00");
//窗口截止时间
endTDateTime = DateUtil.parseDateTime(sdt).offset(DateField.HOUR, 24).offset(DateField.SECOND, -1);
String edt = endTDateTime.toString("yyyy-MM-dd HH:mm:ss");
eventInfoService.insertCrossSlowRunEventData(sdt, edt);
}
} catch (Exception e) {
log.error("", e);
}
} }
@Test
public void insertCrossSlowRunDayData() throws ParseException {
try {
//路口缓行事件数据单独计算
DateTime yesterday = DateUtil.yesterday();
String dt = yesterday.toString("yyyyMMdd");
for (int i = 20250401; i < 20250428; i++) {
long st = System.currentTimeMillis();
analysisProblemCrossDayMapper.insertAnalysisCrossSlowRunDay(i);
long et = System.currentTimeMillis();
log.info("路口缓行按天统计:耗时{}ms,dt={}", et-st,i);
}
} catch (Exception e) {
log.error("", e);
}
}
} }
...@@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.Objects;
/** /**
* @author duanruiming * @author duanruiming
...@@ -32,7 +33,7 @@ public class CommonUtils { ...@@ -32,7 +33,7 @@ public class CommonUtils {
*/ */
public static String getEventHappenDirName(String dir) { public static String getEventHappenDirName(String dir) {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
if (StringUtils.isNotEmpty(dir)) { if (StringUtils.isNotEmpty(dir) && !Objects.equals("null",dir)) {
JSONArray dirArr = JSONArray.parseArray(dir); JSONArray dirArr = JSONArray.parseArray(dir);
for (int i = 0; i < dirArr.size(); i++) { for (int i = 0; i < dirArr.size(); i++) {
String dirName = DirEnum.getName(dirArr.getString(i)); String dirName = DirEnum.getName(dirArr.getString(i));
......
...@@ -53,7 +53,7 @@ public class CrossController { ...@@ -53,7 +53,7 @@ public class CrossController {
date = DateUtil.now().substring(0, 10); date = DateUtil.now().substring(0, 10);
} }
Map<String, Object> result = crossService.getCrossStatusDistribution(crossID, date, groupType, objectType, condition); Map<String, Object> result = crossService.getCrossStatusDistribution(crossID, date, groupType, objectType, condition);
List<CrossStatusDisOptTimeEntity> optTimes = crossService.getOptTimeList(crossID); List<CrossStatusDisOptTimeEntity> optTimes = crossService.getOptTimeList(crossID, date);
List<CrossOrGreenWaveTypeEntity> typeList = crossService.getCrossTypeList(crossID, date); List<CrossOrGreenWaveTypeEntity> typeList = crossService.getCrossTypeList(crossID, date);
result.put("optTimesList", optTimes); result.put("optTimesList", optTimes);
result.put("typeList", typeList); result.put("typeList", typeList);
......
package net.wanji.opt.controllerv2.judgeanalysis; package net.wanji.opt.controllerv2.judgeanalysis;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
...@@ -163,6 +164,50 @@ public class AnalysisProblemGreenDayController { ...@@ -163,6 +164,50 @@ public class AnalysisProblemGreenDayController {
} }
} }
@ApiOperation(value = "干线拥堵分析", notes = "干线拥堵分析")
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波ID", required = true, dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "startTime", value = "日期,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "日期,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String"),
})
@GetMapping(value = "/getGreenCongestionAnalysis")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenHighFrequencyProblemReasonResult.class),
})
public JsonViewObject getGreenCongestionAnalysis(Integer greenId, String startTime ,String endTime) {
JsonViewObject object = JsonViewObject.newInstance();
try {
JSONObject jsonObject = analysisProblemCrossDayService.getGreenCongestionAnalysis(greenId,startTime,endTime);
object.success(jsonObject);
} catch (Exception e) {
log.error("干线拥堵分析: ", e);
return JsonViewObject.newInstance().fail("干线拥堵分析");
}
return object;
}
@ApiOperation(value = "干线缓行分析", notes = "干线缓行分析")
@ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波ID", required = true, dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "startTime", value = "日期,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "日期,格式:yyyy-MM-dd HH:mm:ss", required = true, dataType = "String"),
})
@GetMapping(value = "/getGreenSlowAnalysis")
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = GreenHighFrequencyProblemReasonResult.class),
})
public JsonViewObject getGreenSlowAnalysis(Integer greenId, String startTime ,String endTime) {
JsonViewObject object = JsonViewObject.newInstance();
try {
JSONObject jsonObject = analysisProblemCrossDayService.getGreenSlowAnalysis(greenId,startTime,endTime);
object.success(jsonObject);
} catch (Exception e) {
log.error("干线拥堵分析: ", e);
return JsonViewObject.newInstance().fail("干线拥堵分析");
}
return object;
}
@ApiOperation(value = "干线频发问题监测【研判分析-干线-左下角】", notes = "干线频发问题监测") @ApiOperation(value = "干线频发问题监测【研判分析-干线-左下角】", notes = "干线频发问题监测")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波ID", required = true, dataType = "Integer", paramType = "query"), @ApiImplicitParam(name = "greenId", value = "绿波ID", required = true, dataType = "Integer", paramType = "query"),
......
...@@ -85,7 +85,7 @@ public class AnalysisProblemGreenHourController { ...@@ -85,7 +85,7 @@ public class AnalysisProblemGreenHourController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "Integer", defaultValue = "1"), @ApiImplicitParam(name = "greenId", value = "绿波干线", required = true, dataType = "Integer", defaultValue = "1"),
// @ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "Integer", defaultValue = "1"), // @ApiImplicitParam(name = "timeType", value = "事件类型 1:近一个月 2:近一周", required = false, dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "eventType", value = "事件代码 701:空放 702:路口失衡,703:路口溢出 707:路口拥堵", required = true, dataType = "String", defaultValue = "705"), @ApiImplicitParam(name = "eventType", value = "事件代码 701:空放 702:路口失衡,703:路口溢出 707:路口拥堵 708: 路口缓行", required = true, dataType = "String", defaultValue = "705"),
@ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"), @ApiImplicitParam(name = "startTime", value = "开始时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250317"),
@ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"), @ApiImplicitParam(name = "endTime", value = "结束时间,格式:yyyyMMdd", required = false, dataType = "Integer", defaultValue = "20250318"),
}) })
......
...@@ -22,6 +22,6 @@ public class GreenReportProblemDetailVO { ...@@ -22,6 +22,6 @@ public class GreenReportProblemDetailVO {
private Double avgSpeed; private Double avgSpeed;
@ApiModelProperty(value = "行程时间,单位分钟", example = "10") @ApiModelProperty(value = "行程时间,单位分钟", example = "10")
private Integer travelTime; private double travelTime;
} }
\ No newline at end of file
package net.wanji.opt.controllerv2.strategy; package net.wanji.opt.controllerv2.strategy;
import com.alibaba.fastjson.JSON; import io.swagger.annotations.Api;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.framework.i18n.I18nResourceBundle; import net.wanji.common.framework.i18n.I18nResourceBundle;
import net.wanji.common.framework.rest.JsonViewObject; import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo; import net.wanji.opt.common.exception.OptServiceException;
import net.wanji.opt.entity.strategy.StrategyParameterConfig; import net.wanji.opt.entity.strategy.StrategyParameterConfig;
import net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo; import net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroupVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroup;
import net.wanji.opt.servicev2.strategy.StrategyPriorityService; import net.wanji.opt.servicev2.strategy.StrategyPriorityService;
import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity; import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import net.wanji.opt.api.ResultGenerator;
import javax.validation.Valid;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
* 策略优先级日计划详情表 前端控制器 * 策略优先级日计划详情表 前端控制器
* </p> * </p>
* *
* @author fengyi * @author fengyi
* @since 2025-03-28 * @since 2025-03-28
*/ */
@Api(tags = "策略管理") @Api(tags = "策略管理")
@RestController @RestController
@RequestMapping("/strategy-priority") @RequestMapping("/strategy-priority")
...@@ -47,19 +38,18 @@ public class StrategyPriorityController { ...@@ -47,19 +38,18 @@ public class StrategyPriorityController {
private StrategyPriorityService strategyPriorityService; private StrategyPriorityService strategyPriorityService;
//策略管理-路口列表 //策略管理-路口列表
@ApiOperation(value = "策略管理-路口列表", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false) @ApiOperation(value = "策略管理-路口列表", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, hidden = false)
@ApiImplicitParams({ @ApiImplicitParams({
// @ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String"), // @ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String"),
}) })
@GetMapping("/strategyCrossList") @GetMapping("/strategyCrossList")
public JsonViewObject pageStrategyCrossList(){ public JsonViewObject pageStrategyCrossList() {
JsonViewObject jsonView = JsonViewObject.newInstance(); JsonViewObject jsonView = JsonViewObject.newInstance();
try { try {
List<StrategyPriorityDailyInfo> retLineData=strategyPriorityService.pageStrategyCrossList(); List<StrategyPriorityDailyInfo> retLineData = strategyPriorityService.pageStrategyCrossList();
jsonView.success(retLineData); jsonView.success(retLineData);
}catch (Exception e){ } catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG")); jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e); log.error("{} getAll error", this.getClass().getSimpleName(), e);
} }
...@@ -67,14 +57,14 @@ public class StrategyPriorityController { ...@@ -67,14 +57,14 @@ public class StrategyPriorityController {
} }
@ApiOperation(value = "策略管理-策略名称", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false) @ApiOperation(value = "策略管理-策略名称", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, hidden = false)
@GetMapping("/strategyList") @GetMapping("/strategyList")
public JsonViewObject getStrategyList(){ public JsonViewObject getStrategyList() {
JsonViewObject jsonView = JsonViewObject.newInstance(); JsonViewObject jsonView = JsonViewObject.newInstance();
try { try {
List<StrategyFactoryEntity> retLineData=strategyPriorityService.getStrategyList(); List<StrategyFactoryEntity> retLineData = strategyPriorityService.getStrategyList();
jsonView.success(retLineData); jsonView.success(retLineData);
}catch (Exception e){ } catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG")); jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e); log.error("{} getAll error", this.getClass().getSimpleName(), e);
} }
...@@ -82,40 +72,40 @@ public class StrategyPriorityController { ...@@ -82,40 +72,40 @@ public class StrategyPriorityController {
} }
@ApiOperation(value = "策略管理-场景", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false) @ApiOperation(value = "策略管理-场景", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, hidden = false)
@GetMapping("/sceneList") @GetMapping("/sceneList")
public JsonViewObject getSceneList(Integer type){ public JsonViewObject getSceneList(Integer type) {
JsonViewObject jsonView = JsonViewObject.newInstance(); JsonViewObject jsonView = JsonViewObject.newInstance();
try { try {
List<StrategyFactoryEntity> retLineData=strategyPriorityService.getSceneList(type); List<StrategyFactoryEntity> retLineData = strategyPriorityService.getSceneList(type);
jsonView.success(retLineData); jsonView.success(retLineData);
}catch (Exception e){ } catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG")); jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e); log.error("{} getAll error", this.getClass().getSimpleName(), e);
} }
return jsonView; return jsonView;
} }
@ApiOperation(value = "策略管理-厂商", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false) @ApiOperation(value = "策略管理-厂商", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, hidden = false)
@GetMapping("/companyList") @GetMapping("/companyList")
public JsonViewObject getCompanyList(){ public JsonViewObject getCompanyList() {
JsonViewObject jsonView = JsonViewObject.newInstance(); JsonViewObject jsonView = JsonViewObject.newInstance();
try { try {
List<StrategyFactoryEntity> retLineData=strategyPriorityService.getCompanyList(); List<StrategyFactoryEntity> retLineData = strategyPriorityService.getCompanyList();
jsonView.success(retLineData); jsonView.success(retLineData);
}catch (Exception e){ } catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG")); jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getAll error", this.getClass().getSimpleName(), e); log.error("{} getAll error", this.getClass().getSimpleName(), e);
} }
return jsonView; return jsonView;
} }
@ApiOperation(value = "策略管理-策略路口干线优先级批量保存", notes = "批量保存", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false) @ApiOperation(value = "策略管理-策略路口干线优先级批量保存", notes = "批量保存", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, hidden = false)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "dataList", value = "优先级配置数据", required = false, dataType = "String"), @ApiImplicitParam(name = "dataList", value = "优先级配置数据", required = false, dataType = "String"),
}) })
@PostMapping("/savePriority") @PostMapping("/savePriority")
public JsonViewObject savePriority(@RequestBody List<StrategyPriorityGroup>dataList){ public JsonViewObject savePriority(@RequestBody List<StrategyPriorityGroupVO> dataList) {
JsonViewObject jsonView = JsonViewObject.newInstance(); JsonViewObject jsonView = JsonViewObject.newInstance();
try { try {
strategyPriorityService.savePriority(dataList); strategyPriorityService.savePriority(dataList);
...@@ -127,18 +117,39 @@ public class StrategyPriorityController { ...@@ -127,18 +117,39 @@ public class StrategyPriorityController {
return jsonView; return jsonView;
} }
@ApiOperation(value = "策略管理-策略路口干线优先级数据回显", notes = "数据回显", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false) @ApiOperation(value = "策略管理-策略路口干线优先级批量删除", notes = "批量删除", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, hidden = false)
@ApiImplicitParams({
@ApiImplicitParam(name = "dataList", value = "优先级配置数据", required = false, dataType = "String"),
})
@PostMapping("/deletePriorityConfigList")
public JsonViewObject deletePriorityConfigList(@RequestBody List<StrategyPriorityGroupVO> dataList) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
try {
strategyPriorityService.deletePriorityConfigList(dataList);
jsonViewObject.success();
} catch (OptServiceException e1) {
return jsonViewObject.success(e1.getMessage());
} catch (Exception e) {
jsonViewObject.fail(e.getMessage());
log.error("{} StrategyPriorityController-deletePriorityConfigList", this.getClass().getSimpleName(), e);
}
return jsonViewObject;
}
@ApiOperation(value = "策略管理-策略路口干线优先级数据回显", notes = "数据回显", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, hidden = false)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String"), @ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String"),
@ApiImplicitParam(name = "greenId", value = "干线id", required = false, dataType = "Integer"), @ApiImplicitParam(name = "greenId", value = "干线id", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "Integer"), @ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "Integer"),
}) })
@GetMapping("/getPriorityConfig") @GetMapping("/getPriorityConfig")
public JsonViewObject getPriorityData(@RequestParam(required = false) String crossId,@RequestParam(required = false) Integer greenId, public JsonViewObject getPriorityData(@RequestParam(required = false) String crossId, @RequestParam(required = false) Integer greenId,
@RequestParam(required = true) Integer type){ @RequestParam(required = true) Integer type) {
JsonViewObject jsonView = JsonViewObject.newInstance(); JsonViewObject jsonView = JsonViewObject.newInstance();
try { try {
List<StrategyFactoryEntity>list=strategyPriorityService.getPriorityData(crossId,greenId,type); List<StrategyFactoryEntity> list = strategyPriorityService.getPriorityData(crossId, greenId, type);
jsonView.success(list); jsonView.success(list);
} catch (Exception e) { } catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG")); jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
...@@ -147,12 +158,12 @@ public class StrategyPriorityController { ...@@ -147,12 +158,12 @@ public class StrategyPriorityController {
return jsonView; return jsonView;
} }
@ApiOperation(value = "策略管理-策略计划表路口干线批量保存", notes = "批量保存", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false) @ApiOperation(value = "策略管理-策略计划表路口干线批量保存", notes = "批量保存", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, hidden = false)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "dailyPlanDetails", value = "日计划配置数据", required = false, dataType = "String"), @ApiImplicitParam(name = "dailyPlanDetails", value = "日计划配置数据", required = false, dataType = "String"),
}) })
@PostMapping("/savePlanConfig") @PostMapping("/savePlanConfig")
public JsonViewObject savePlanConfig(@RequestBody List<StrategyPriorityGroup>dailyPlanDetails){ public JsonViewObject savePlanConfig(@RequestBody List<StrategyPriorityGroupVO> dailyPlanDetails) {
JsonViewObject jsonView = JsonViewObject.newInstance(); JsonViewObject jsonView = JsonViewObject.newInstance();
try { try {
strategyPriorityService.savePlanConfig(dailyPlanDetails); strategyPriorityService.savePlanConfig(dailyPlanDetails);
...@@ -164,18 +175,18 @@ public class StrategyPriorityController { ...@@ -164,18 +175,18 @@ public class StrategyPriorityController {
return jsonView; return jsonView;
} }
@ApiOperation(value = "策略管理-计划配置路口干线数据回显", notes = "数据回显", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false) @ApiOperation(value = "策略管理-计划配置路口干线数据回显", notes = "数据回显", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, hidden = false)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String"), @ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String"),
@ApiImplicitParam(name = "greenId", value = "干线id", required = false, dataType = "Integer"), @ApiImplicitParam(name = "greenId", value = "干线id", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "Integer"), @ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "Integer"),
}) })
@GetMapping("/getPlanConfigData") @GetMapping("/getPlanConfigData")
public JsonViewObject getPlanConfigData(@RequestParam(required = false) String crossId,@RequestParam(required = false) Integer greenId, public JsonViewObject getPlanConfigData(@RequestParam(required = false) String crossId, @RequestParam(required = false) Integer greenId,
@RequestParam(required = true) Integer type){ @RequestParam(required = true) Integer type) {
JsonViewObject jsonView = JsonViewObject.newInstance(); JsonViewObject jsonView = JsonViewObject.newInstance();
try { try {
List<StrategyPriorityDailyInfo>list=strategyPriorityService.getPlanConfigData(crossId,greenId,type); List<StrategyPriorityDailyInfo> list = strategyPriorityService.getPlanConfigData(crossId, greenId, type);
jsonView.success(list); jsonView.success(list);
} catch (Exception e) { } catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG")); jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
...@@ -184,15 +195,15 @@ public class StrategyPriorityController { ...@@ -184,15 +195,15 @@ public class StrategyPriorityController {
return jsonView; return jsonView;
} }
@ApiOperation(value = "策略管理-策略参数配置路口干线批量保存", notes = "批量保存", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false) @ApiOperation(value = "策略管理-策略参数配置路口干线批量保存", notes = "批量保存", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, hidden = false)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "strategyPriorityGroup", value = "参数配置数据", required = false, dataType = "String"), @ApiImplicitParam(name = "strategyPriorityGroup", value = "参数配置数据", required = false, dataType = "String"),
}) })
@PostMapping("/saveParamterConfig") @PostMapping("/saveParamterConfig")
public JsonViewObject saveParamterConfig(@RequestBody StrategyPriorityGroup strategyPriorityGroup){ public JsonViewObject saveParamterConfig(@RequestBody StrategyPriorityGroupVO strategyPriorityGroupVO) {
JsonViewObject jsonView = JsonViewObject.newInstance(); JsonViewObject jsonView = JsonViewObject.newInstance();
try { try {
strategyPriorityService.saveParamterConfig(strategyPriorityGroup); strategyPriorityService.saveParamterConfig(strategyPriorityGroupVO);
jsonView.success(); jsonView.success();
} catch (Exception e) { } catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG")); jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
...@@ -202,18 +213,18 @@ public class StrategyPriorityController { ...@@ -202,18 +213,18 @@ public class StrategyPriorityController {
} }
@ApiOperation(value = "策略管理-参数配置干线路口数据回显", notes = "数据回显", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false) @ApiOperation(value = "策略管理-参数配置干线路口数据回显", notes = "数据回显", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, hidden = false)
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String"), @ApiImplicitParam(name = "crossId", value = "路口id", required = false, dataType = "String"),
@ApiImplicitParam(name = "greenId", value = "干线id", required = false, dataType = "Integer"), @ApiImplicitParam(name = "greenId", value = "干线id", required = false, dataType = "Integer"),
@ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "Integer"), @ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "Integer"),
}) })
@GetMapping("/getParamConfigData") @GetMapping("/getParamConfigData")
public JsonViewObject getParamConfigData(@RequestParam(required = false) String crossId,@RequestParam(required = false) Integer greenId, public JsonViewObject getParamConfigData(@RequestParam(required = false) String crossId, @RequestParam(required = false) Integer greenId,
@RequestParam(required = true) Integer type,@RequestParam(required = true) String strategyNo){ @RequestParam(required = true) Integer type, @RequestParam(required = true) String strategyNo) {
JsonViewObject jsonView = JsonViewObject.newInstance(); JsonViewObject jsonView = JsonViewObject.newInstance();
try { try {
List<StrategyParameterConfig>list=strategyPriorityService.getParamConfigData(crossId,greenId,type,strategyNo); List<StrategyParameterConfig> list = strategyPriorityService.getParamConfigData(crossId, greenId, type, strategyNo);
jsonView.success(list); jsonView.success(list);
} catch (Exception e) { } catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG")); jsonView.fail(I18nResourceBundle.getConstants("SAVE_FAILED_MSG"));
...@@ -225,14 +236,14 @@ public class StrategyPriorityController { ...@@ -225,14 +236,14 @@ public class StrategyPriorityController {
/* /*
策略管理-干线列表 策略管理-干线列表
*/ */
@ApiOperation(value = "策略管理-干线列表", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON,hidden = false) @ApiOperation(value = "策略管理-干线列表", notes = "查询全部记录", produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON, hidden = false)
@GetMapping("/getStrategyGreenWave") @GetMapping("/getStrategyGreenWave")
public JsonViewObject getStrategyGreenWave(){ public JsonViewObject getStrategyGreenWave() {
JsonViewObject jsonView = JsonViewObject.newInstance(); JsonViewObject jsonView = JsonViewObject.newInstance();
try { try {
List<StrategyPriorityDailyInfo> retLineData=strategyPriorityService.getStrategyGreenWave(); List<StrategyPriorityDailyInfo> retLineData = strategyPriorityService.getStrategyGreenWave();
jsonView.success(retLineData); jsonView.success(retLineData);
}catch (Exception e){ } catch (Exception e) {
jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG")); jsonView.fail(I18nResourceBundle.getConstants("GET_FAILED_MSG"));
log.error("{} getStrategyGreenWave error", this.getClass().getSimpleName(), e); log.error("{} getStrategyGreenWave error", this.getClass().getSimpleName(), e);
} }
......
...@@ -18,7 +18,7 @@ public interface CrossMapper { ...@@ -18,7 +18,7 @@ public interface CrossMapper {
* 监测详情-路口事件详情-路口状态分布趋势-优化时间 * 监测详情-路口事件详情-路口状态分布趋势-优化时间
* @param crossID 路口ID * @param crossID 路口ID
*/ */
List<CrossStatusDisOptTimeEntity> getOptTimes(String crossID); List<CrossStatusDisOptTimeEntity> getOptTimes(String crossID, String date);
/** /**
* 监测详情-路口事件详情-路口实时告警 * 监测详情-路口事件详情-路口实时告警
......
...@@ -5,6 +5,7 @@ import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay; ...@@ -5,6 +5,7 @@ import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay;
import net.wanji.opt.entity.judgeanalysis.CrossPoint; import net.wanji.opt.entity.judgeanalysis.CrossPoint;
import net.wanji.opt.synthesis.pojo.CrossOptAnalysisEntity; import net.wanji.opt.synthesis.pojo.CrossOptAnalysisEntity;
import net.wanji.opt.vo2.GreenwaveCrossResult; import net.wanji.opt.vo2.GreenwaveCrossResult;
import net.wanji.opt.vo2.LaneSturationInfo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -114,5 +115,13 @@ public interface AnalysisProblemCrossDayMapper extends BaseMapper<AnalysisProble ...@@ -114,5 +115,13 @@ public interface AnalysisProblemCrossDayMapper extends BaseMapper<AnalysisProble
List<CrossOptAnalysisEntity> getCrossOptAnalysis(@Param("greenId") String greenId,@Param("crossID") String crossID, @Param("startTime")String startTime,@Param("endTime")String endTime); List<CrossOptAnalysisEntity> getCrossOptAnalysis(@Param("greenId") String greenId,@Param("crossID") String crossID, @Param("startTime")String startTime,@Param("endTime")String endTime);
List<GreenwaveCrossResult> getTrunkLineCrossProblem(@Param("greenId") Integer greenId,@Param("status") Integer status,@Param("startTime") String startTime,@Param("endTime") String endTime); List<GreenwaveCrossResult> getTrunkLineCrossProblem(@Param("greenId") Integer greenId,@Param("status") Integer status,@Param("startTime") String startTime,@Param("endTime") String endTime);
Double getGreenStopTimeAvg(@Param("greenId") Integer greenId,@Param("startTime") String startTime,@Param("endTime") String endTime);
Double getGreenStopTimeSum(@Param("greenId") Integer greenId,@Param("startTime") String startTime,@Param("endTime") String endTime);
Double getGreenSlowStopTimeSum(@Param("greenId") Integer greenId,@Param("startTime") String startTime,@Param("endTime") String endTime);
List<LaneSturationInfo> getSturationInfoList(@Param("crossId") String crossId,@Param("startTime") String startTime,@Param("endTime") String endTime);
} }
package net.wanji.opt.dao.mapper.strategy; package net.wanji.opt.dao.mapper.strategy;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.wanji.opt.entity.strategy.StrategyParameterConfig; import net.wanji.opt.entity.strategy.StrategyParameterConfig;
import net.wanji.opt.entity.strategy.StrategyPriorityConfig; import net.wanji.opt.entity.strategy.StrategyPriorityConfig;
import net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo; import net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo;
import java.util.List;
import java.util.Map;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroup;
import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity; import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDailyInfo>{ import java.util.List;
public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDailyInfo> {
/** /**
* 查询表t_strategy_priority_daily_info所有信息 * 查询表t_strategy_priority_daily_info所有信息
...@@ -21,30 +18,35 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily ...@@ -21,30 +18,35 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily
/** /**
* 根据主键id查询表t_strategy_priority_daily_info信息 * 根据主键id查询表t_strategy_priority_daily_info信息
*
* @param id * @param id
*/ */
StrategyPriorityDailyInfo findStrategyPriorityDailyInfoByid(@Param("id") Long id); StrategyPriorityDailyInfo findStrategyPriorityDailyInfoByid(@Param("id") Long id);
/** /**
* 根据条件查询表t_strategy_priority_daily_info信息 * 根据条件查询表t_strategy_priority_daily_info信息
*
* @param strategyPriorityDailyInfo * @param strategyPriorityDailyInfo
*/ */
List<StrategyPriorityDailyInfo> findStrategyPriorityDailyInfoByCondition(StrategyPriorityDailyInfo strategyPriorityDailyInfo); List<StrategyPriorityDailyInfo> findStrategyPriorityDailyInfoByCondition(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
/** /**
* 根据主键id查询表t_strategy_priority_daily_info信息 * 根据主键id查询表t_strategy_priority_daily_info信息
*
* @param id * @param id
*/ */
Integer deleteStrategyPriorityDailyInfoByid(@Param("id") Long id); Integer deleteStrategyPriorityDailyInfoByid(@Param("id") Long id);
/** /**
* 根据主键id更新表t_strategy_priority_daily_info信息 * 根据主键id更新表t_strategy_priority_daily_info信息
*
* @param strategyPriorityDailyInfo * @param strategyPriorityDailyInfo
*/ */
Integer updateStrategyPriorityDailyInfoByid(StrategyPriorityDailyInfo strategyPriorityDailyInfo); Integer updateStrategyPriorityDailyInfoByid(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
/** /**
* 新增表t_strategy_priority_daily_info信息 * 新增表t_strategy_priority_daily_info信息
*
* @param strategyPriorityDailyInfo * @param strategyPriorityDailyInfo
*/ */
Integer addStrategyPriorityDailyInfo(StrategyPriorityDailyInfo strategyPriorityDailyInfo); Integer addStrategyPriorityDailyInfo(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
...@@ -68,10 +70,9 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily ...@@ -68,10 +70,9 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily
void deletePriorityConfig(String crossId); void deletePriorityConfig(String crossId);
List<String> getstrategyNo(@Param("crossId") String crossId, @Param("type") Integer type);
List<String> getstrategyNo(@Param("crossId") String crossId,@Param("type") Integer type); List<StrategyFactoryEntity> getPriorityConfigData(@Param("strategyNo") List<String> strategyNo, @Param("crossId") String crossId, @Param("type") Integer type);
List<StrategyFactoryEntity> getPriorityConfigData(@Param("strategyNo") List<String> strategyNo,@Param("crossId") String crossId,@Param("type") Integer type);
void savePlanConfig(@Param("savePlanList") List<StrategyPriorityDailyInfo> savePlanList); void savePlanConfig(@Param("savePlanList") List<StrategyPriorityDailyInfo> savePlanList);
...@@ -80,7 +81,7 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily ...@@ -80,7 +81,7 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily
void deletePlanConfig(String crossId); void deletePlanConfig(String crossId);
List<StrategyPriorityDailyInfo> getPlanConfigData(@Param("crossId") String crossId,@Param("type")Integer type); List<StrategyPriorityDailyInfo> getPlanConfigData(@Param("crossId") String crossId, @Param("type") Integer type);
List<StrategyParameterConfig> paramterConfigTable(String crossId); List<StrategyParameterConfig> paramterConfigTable(String crossId);
...@@ -89,7 +90,7 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily ...@@ -89,7 +90,7 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily
void saveParamConfig(@Param("savePlanList") List<StrategyParameterConfig> savePlanList); void saveParamConfig(@Param("savePlanList") List<StrategyParameterConfig> savePlanList);
List<StrategyParameterConfig> getParamConfigData(@Param("crossId") String crossId,@Param("type")Integer type,@Param("strategyNo") String strategyNo); List<StrategyParameterConfig> getParamConfigData(@Param("crossId") String crossId, @Param("type") Integer type, @Param("strategyNo") String strategyNo);
List<StrategyPriorityDailyInfo> getStrategyGreenWave(); List<StrategyPriorityDailyInfo> getStrategyGreenWave();
...@@ -97,20 +98,60 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily ...@@ -97,20 +98,60 @@ public interface StrategyPriorityMapper extends BaseMapper<StrategyPriorityDaily
void deleteGreenPriorityConfig(Integer greenId); void deleteGreenPriorityConfig(Integer greenId);
List<String> getGreenstrategyNo(@Param("greenId") Integer greenId,@Param("type") Integer type); List<String> getGreenstrategyNo(@Param("greenId") Integer greenId, @Param("type") Integer type);
List<StrategyFactoryEntity> getGreenPriorityConfigData(@Param("strategyNo") List<String> strategyNo, @Param("greenId") Integer greenId,@Param("type") Integer type); List<StrategyFactoryEntity> getGreenPriorityConfigData(@Param("strategyNo") List<String> strategyNo, @Param("greenId") Integer greenId, @Param("type") Integer type);
List<StrategyPriorityDailyInfo> selectGreenPlanTable(Integer greenId); List<StrategyPriorityDailyInfo> selectGreenPlanTable(Integer greenId);
void deleteGreenPlanConfig(Integer greenId); void deleteGreenPlanConfig(Integer greenId);
List<StrategyPriorityDailyInfo> getGreenPlanConfigData(@Param("greenId") Integer greenId,@Param("type")Integer type); List<StrategyPriorityDailyInfo> getGreenPlanConfigData(@Param("greenId") Integer greenId, @Param("type") Integer type);
List<StrategyParameterConfig> paramterGreenConfigTable(Integer greenId); List<StrategyParameterConfig> paramterGreenConfigTable(Integer greenId);
void deleteGreenParamterConfig(Integer greenId); void deleteGreenParamterConfig(Integer greenId);
List<StrategyParameterConfig> getGreenParamConfigData(@Param("greenId") Integer greenId, @Param("type") Integer type,@Param("strategyNo") String strategyNo); List<StrategyParameterConfig> getGreenParamConfigData(@Param("greenId") Integer greenId, @Param("type") Integer type, @Param("strategyNo") String strategyNo);
/**
* 通过路口编号或干线编号,分组编号查询策略库详情
* @param crossId
* @param greenId
* @param groupId
* @return
*/
List<StrategyFactoryEntity> selectCrossGroupStrategyList(@Param("crossId") String crossId, @Param("greenId") Integer greenId, @Param("groupId") Integer groupId);
/**
* 删除路口编号分组下策略编号
* @param crossId
* @param greenId
* @param groupId
* @param strategyNo
* @return
*/
void deleteCrossGreenPriorityConfig(@Param("crossId") String crossId, @Param("greenId") Integer greenId,
@Param("groupId") Integer groupId, @Param("strategyNo") String strategyNo);
/**
* 通过路口编号或干线编号,分组编号,查询优先级配置日计划详情
* @param crossId
* @param greenId
* @param groupId
* @return
*/
List<StrategyPriorityDailyInfo> selectCrossGreenGroupDailyPlanList(@Param("crossId") String crossId, @Param("greenId") Integer greenId, @Param("groupId") Integer groupId);
/**
* 通过路口编号或干线编号,分组编号查询策略优先级配置详情
* @param crossId
* @param greenId
* @param groupId
* @return
*/
List<StrategyPriorityConfig> selectCrossGroupStrategyPriorityList(@Param("crossId") String crossId, @Param("greenId") Integer greenId, @Param("groupId") Integer groupId);
} }
...@@ -42,4 +42,7 @@ public class TEventOptimizeInfoVO { ...@@ -42,4 +42,7 @@ public class TEventOptimizeInfoVO {
@ApiModelProperty(value = "时间数量") @ApiModelProperty(value = "时间数量")
private Integer eventNumber; private Integer eventNumber;
@ApiModelProperty(value = "增加事件方向")
private String dirName;
} }
\ No newline at end of file
...@@ -25,5 +25,11 @@ public class CrossRidLaneDTO { ...@@ -25,5 +25,11 @@ public class CrossRidLaneDTO {
private Integer outDir; private Integer outDir;
@ApiModelProperty(value = "驶入方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北" ) @ApiModelProperty(value = "驶入方向:1北;2东北;3东;4东南;5南;6西南;7西;8西北" )
private Integer inDir; private Integer inDir;
@ApiModelProperty(value = "车道类型:1路段车道;2进口车道;3出口车道;4左转弯待转区;6直行待行区" )
private Integer laneType;
@ApiModelProperty(value = "开始路口编号" )
private String startCrossId;
@ApiModelProperty(value = "结束路口编号" )
private String endCrossId;
} }
package net.wanji.opt.entity.strategy; package net.wanji.opt.entity.strategy;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable; import com.baomidou.mybatisplus.annotation.TableId;
import java.util.List; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.models.auth.In;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import com.baomidou.mybatisplus.annotation.TableName;
import net.wanji.opt.entity.comprehensivequery.CrossEntity; import java.io.Serializable;
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@TableName("t_strategy_priority_daily_info") @TableName("t_strategy_priority_daily_info")
public class StrategyPriorityDailyInfo implements Serializable { public class StrategyPriorityDailyInfo implements Serializable {
...@@ -68,5 +66,4 @@ public class StrategyPriorityDailyInfo implements Serializable { ...@@ -68,5 +66,4 @@ public class StrategyPriorityDailyInfo implements Serializable {
private Integer type; private Integer type;
} }
package net.wanji.opt.entity.strategy.dto; package net.wanji.opt.entity.strategy.dto;
import com.baomidou.mybatisplus.annotation.TableField; import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import net.wanji.opt.entity.strategy.*; import net.wanji.opt.entity.strategy.StrategyPriorityConfig;
import net.wanji.opt.entity.strategy.StrategyPriorityParamter;
import net.wanji.opt.entity.strategy.StrategyPriorityPlanDetails;
import net.wanji.opt.entity.strategy.StrategySchedulingParam;
import java.util.List; import java.util.List;
/**
* @author
* @date
*/
@Data @Data
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class StrategyPriorityGroup { public class StrategyPriorityGroupVO {
//分组ID @ApiModelProperty("分组ID")
private Integer labelCode; private Integer groupId;
//分组名称 @ApiModelProperty("分组名称")
private String label; private String groupName;
//路口Id @ApiModelProperty("路口编号列表")
private String crossId;
//路口Id
private List<String> crossIds; private List<String> crossIds;
//执行时间 @ApiModelProperty("执行时间")
private String weekExecute; private String weekExecute;
//日计划编号 @ApiModelProperty("日计划编号")
private Integer dailyPlanId; private Integer dailyPlanId;
//策略编号 @ApiModelProperty("策略编号")
private String strategyNo; private String strategyNo;
//优先级的配置信息 @ApiModelProperty("优先级的配置信息")
private List<StrategyPriorityConfig> data; private List<StrategyPriorityConfig> data;
//计划表的配置信息日计划详情 @ApiModelProperty("计划表的配置信息日计划详情")
private List<StrategyPriorityPlanDetails> dailyPlanDetails; private List<StrategyPriorityPlanDetails> dailyPlanDetails;
// 参数配置表的配置信息 @ApiModelProperty("参数配置表的配置信息")
private List<StrategyPriorityParamter> parameterConfigList; private List<StrategyPriorityParamter> parameterConfigList;
// 调度配置表的配置信息 @ApiModelProperty("调度配置表的配置信息")
private StrategySchedulingParam schedulingParamters; private StrategySchedulingParam schedulingParamters;
//1:路口,2干线 @ApiModelProperty("类型:1:路口,2干线")
private Integer type; private Integer type;
//干线 ID @ApiModelProperty("干线编号列表")
private Integer greenId;
//干线 IDs
private List<Integer> greenIds; private List<Integer> greenIds;
/**
//策略名称 参数配置神思用 * 策略名称 参数配置神思用
*/
private String strategyName; private String strategyName;
//场景 参数配置神思用 /**
* 场景 参数配置神思用
*/
private String method; private String method;
//场景code 参数配置神思用 /**
* 场景code 参数配置神思用
*/
private Integer scene; private Integer scene;
} }
...@@ -54,7 +54,7 @@ public interface CrossService { ...@@ -54,7 +54,7 @@ public interface CrossService {
* @param crossID 路口ID * @param crossID 路口ID
* @return * @return
*/ */
List<CrossStatusDisOptTimeEntity> getOptTimeList(String crossID); List<CrossStatusDisOptTimeEntity> getOptTimeList(String crossID, String date);
/** /**
* 获取路口基础信息————方向、转向、车道信息 * 获取路口基础信息————方向、转向、车道信息
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.wanji.databus.po.EventOptimizeCountPo; import net.wanji.databus.po.EventOptimizeCountPo;
import net.wanji.opt.common.CommonUtils;
import net.wanji.opt.common.EsDateIndexUtil; import net.wanji.opt.common.EsDateIndexUtil;
import net.wanji.opt.dao.mapper.eventoptimize.TEventOptimizeInfoMapper; import net.wanji.opt.dao.mapper.eventoptimize.TEventOptimizeInfoMapper;
import net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo; import net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo;
...@@ -70,6 +71,7 @@ public class TEventOptimizeInfoServiceImpl extends ServiceImpl<TEventOptimizeInf ...@@ -70,6 +71,7 @@ public class TEventOptimizeInfoServiceImpl extends ServiceImpl<TEventOptimizeInf
TEventOptimizeInfoVO tEventOptimizeInfoVO = new TEventOptimizeInfoVO(); TEventOptimizeInfoVO tEventOptimizeInfoVO = new TEventOptimizeInfoVO();
BeanUtils.copyProperties(x, tEventOptimizeInfoVO); BeanUtils.copyProperties(x, tEventOptimizeInfoVO);
tEventOptimizeInfoVO.setEventLabal(getEventLabel1(x.getEventType())); tEventOptimizeInfoVO.setEventLabal(getEventLabel1(x.getEventType()));
tEventOptimizeInfoVO.setDirName(CommonUtils.getEventHappenDirName(x.getDir()));
tEventOptimizeInfoVO.setOptStatus(1); tEventOptimizeInfoVO.setOptStatus(1);
return tEventOptimizeInfoVO; return tEventOptimizeInfoVO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
......
...@@ -209,8 +209,9 @@ public class CrossServiceImpl implements CrossService { ...@@ -209,8 +209,9 @@ public class CrossServiceImpl implements CrossService {
} }
@Override @Override
public List<CrossStatusDisOptTimeEntity> getOptTimeList(String crossID) { public List<CrossStatusDisOptTimeEntity> getOptTimeList(String crossID, String date) {
return crossMapper.getOptTimes(crossID); String dt = date.substring(0, 10).replaceAll("-", "");
return crossMapper.getOptTimes(crossID, dt);
} }
/** /**
......
...@@ -28,6 +28,7 @@ import net.wanji.opt.cache.BaseCrossInfoCache; ...@@ -28,6 +28,7 @@ import net.wanji.opt.cache.BaseCrossInfoCache;
import net.wanji.opt.common.RedisUtils; import net.wanji.opt.common.RedisUtils;
import net.wanji.opt.common.enums.EventInfoTypeEnum; import net.wanji.opt.common.enums.EventInfoTypeEnum;
import net.wanji.opt.common.enums.GreenBeltDirEnum; import net.wanji.opt.common.enums.GreenBeltDirEnum;
import net.wanji.opt.common.enums.GreenWaveInDirEnum;
import net.wanji.opt.dao.mapper.*; import net.wanji.opt.dao.mapper.*;
import net.wanji.opt.dto.GreenBeltChartDTO; import net.wanji.opt.dto.GreenBeltChartDTO;
import net.wanji.opt.entity.GreenChartSchemeHist; import net.wanji.opt.entity.GreenChartSchemeHist;
...@@ -46,6 +47,7 @@ import org.springframework.util.CollectionUtils; ...@@ -46,6 +47,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
...@@ -357,8 +359,17 @@ public class TrendServiceV2Impl implements TrendServiceV2 { ...@@ -357,8 +359,17 @@ public class TrendServiceV2Impl implements TrendServiceV2 {
double durationRate = durationOffset / last.getDuration(); double durationRate = durationOffset / last.getDuration();
result.setCountRate((int) (Math.round(countRate * 100) )); result.setCountRate((int) (Math.round(countRate * 100) ));
result.setDurationRate((int) (Math.round(durationRate * 100) )); result.setDurationRate((int) (Math.round(durationRate * 100) ));
String greenDir = result.getGreenDir();
StringBuilder stringBuilder = new StringBuilder();
if (!StringUtils.isEmpty(greenDir)) {
for (String dir : greenDir.split(",")) {
stringBuilder.append(GreenBeltDirEnum.getCode(Integer.valueOf(dir))).append(",");
}
}
int length = stringBuilder.length();
String substring = stringBuilder.substring(0, length - 1);
result.setGreenDir(substring);
} }
} }
}); });
} }
......
package net.wanji.opt.servicev2.judgeanalysis; package net.wanji.opt.servicev2.judgeanalysis;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay; import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay;
import net.wanji.opt.vo2.CrossOptAnalysisVO; import net.wanji.opt.vo2.CrossOptAnalysisVO;
...@@ -77,4 +78,8 @@ public interface AnalysisProblemCrossDayService extends IService<AnalysisProblem ...@@ -77,4 +78,8 @@ public interface AnalysisProblemCrossDayService extends IService<AnalysisProblem
CrossOptAnalysisVO getCrossOptAnalysis(String crossID, String startTime,String endTime); CrossOptAnalysisVO getCrossOptAnalysis(String crossID, String startTime,String endTime);
List<JudTrunkLineCrossProblemEntityVO> getTrunkLineCrossProblem(Integer greenId, Integer status, String startTime, String endTime); List<JudTrunkLineCrossProblemEntityVO> getTrunkLineCrossProblem(Integer greenId, Integer status, String startTime, String endTime);
JSONObject getGreenCongestionAnalysis(Integer greenId, String startTime, String endTime);
JSONObject getGreenSlowAnalysis(Integer greenId, String startTime, String endTime);
} }
...@@ -485,7 +485,7 @@ public class AnalysisGreenCongestionPeriodServiceImpl implements AnalysisGreenCo ...@@ -485,7 +485,7 @@ public class AnalysisGreenCongestionPeriodServiceImpl implements AnalysisGreenCo
greenReportProblemDetail.setProblemSpan(getTimeString(periodVO)); greenReportProblemDetail.setProblemSpan(getTimeString(periodVO));
greenReportProblemDetail.setStatus(ConsgestionStatusEnum.getDesc(periodVO.getStatus())); greenReportProblemDetail.setStatus(ConsgestionStatusEnum.getDesc(periodVO.getStatus()));
greenReportProblemDetail.setAvgSpeed(Math.round(periodVO.getSpeed() * 100) / 100.0); greenReportProblemDetail.setAvgSpeed(Math.round(periodVO.getSpeed() * 100) / 100.0);
greenReportProblemDetail.setTravelTime(periodVO.getTravelTime() / 60); greenReportProblemDetail.setTravelTime(Math.round(periodVO.getTravelTime()*10 / 60.0)/10.0);
greenReportProblemDetail.setCongestIndex(Math.round(periodVO.getCongestIndex() * 100) / 100.0); greenReportProblemDetail.setCongestIndex(Math.round(periodVO.getCongestIndex() * 100) / 100.0);
return greenReportProblemDetail; return greenReportProblemDetail;
} }
......
...@@ -4,6 +4,10 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -4,6 +4,10 @@ import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.wanji.common.utils.tool.DateUtil; import net.wanji.common.utils.tool.DateUtil;
import net.wanji.databus.dao.entity.GreenwaveCrossPO;
import net.wanji.databus.dao.mapper.BaseCrossInfoMapper;
import net.wanji.databus.dao.mapper.GreenwaveCrossMapper;
import net.wanji.databus.po.BaseCrossInfoPO;
import net.wanji.opt.common.EsDateIndexUtil; import net.wanji.opt.common.EsDateIndexUtil;
import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemCrossDayMapper; import net.wanji.opt.dao.mapper.judgeanalysis.AnalysisProblemCrossDayMapper;
import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay; import net.wanji.opt.entity.judgeanalysis.AnalysisProblemCrossDay;
...@@ -14,9 +18,11 @@ import net.wanji.opt.synthesis.pojo.CrossOptAnalysisEntity; ...@@ -14,9 +18,11 @@ import net.wanji.opt.synthesis.pojo.CrossOptAnalysisEntity;
import net.wanji.opt.vo2.CrossOptAnalysisVO; import net.wanji.opt.vo2.CrossOptAnalysisVO;
import net.wanji.opt.vo2.GreenwaveCrossResult; import net.wanji.opt.vo2.GreenwaveCrossResult;
import net.wanji.opt.vo2.JudTrunkLineCrossProblemEntityVO; import net.wanji.opt.vo2.JudTrunkLineCrossProblemEntityVO;
import net.wanji.opt.vo2.LaneSturationInfo;
import net.wanji.opt.vo2.report.JudTrunkLineCrossProblemEntityDTO; import net.wanji.opt.vo2.report.JudTrunkLineCrossProblemEntityDTO;
import org.locationtech.jts.geom.Geometry; import org.locationtech.jts.geom.Geometry;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -38,6 +44,10 @@ public class AnalysisProblemCrossDayServiceImpl extends ServiceImpl<AnalysisProb ...@@ -38,6 +44,10 @@ public class AnalysisProblemCrossDayServiceImpl extends ServiceImpl<AnalysisProb
@Resource @Resource
private AnalysisProblemCrossDayMapper analysisProblemCrossDayMapper; private AnalysisProblemCrossDayMapper analysisProblemCrossDayMapper;
@Autowired
private GreenwaveCrossMapper greenwaveCrossMapper;
@Autowired
private BaseCrossInfoMapper baseCrossInfoMapper;
/** /**
...@@ -229,155 +239,109 @@ public class AnalysisProblemCrossDayServiceImpl extends ServiceImpl<AnalysisProb ...@@ -229,155 +239,109 @@ public class AnalysisProblemCrossDayServiceImpl extends ServiceImpl<AnalysisProb
Map<String, List<GreenwaveCrossResult>> crossIdMap = greenwaveCrossResults.stream().collect(Collectors.groupingBy(GreenwaveCrossResult::getCrossId)); Map<String, List<GreenwaveCrossResult>> crossIdMap = greenwaveCrossResults.stream().collect(Collectors.groupingBy(GreenwaveCrossResult::getCrossId));
int slowCount = greenwaveCrossResults.stream().filter(x -> 2 == x.getStatus()).mapToInt(GreenwaveCrossResult::getDirCount).sum(); int slowCount = greenwaveCrossResults.stream().filter(x -> 2 == x.getStatus()).mapToInt(GreenwaveCrossResult::getDirCount).sum();
int conCount = greenwaveCrossResults.stream().filter(x -> 3 == x.getStatus() || 4 == x.getStatus()).mapToInt(GreenwaveCrossResult::getDirCount).sum(); int conCount = greenwaveCrossResults.stream().filter(x -> 3 == x.getStatus() || 4 == x.getStatus()).mapToInt(GreenwaveCrossResult::getDirCount).sum();
for (List<GreenwaveCrossResult> crossResults : crossIdMap.values()) { List<GreenwaveCrossPO> greenwaveCrossPOS = greenwaveCrossMapper.selectByGreenwaveId(greenId);
for (GreenwaveCrossPO greenwaveCrossPO : greenwaveCrossPOS) {
BaseCrossInfoPO baseCrossInfoPO = baseCrossInfoMapper.selectById(greenwaveCrossPO.getCrossId());
JudTrunkLineCrossProblemEntityDTO judTrunkLineCrossProblemEntityDTO = new JudTrunkLineCrossProblemEntityDTO(); JudTrunkLineCrossProblemEntityDTO judTrunkLineCrossProblemEntityDTO = new JudTrunkLineCrossProblemEntityDTO();
judTrunkLineCrossProblemEntityDTO.setGreenId(crossResults.get(0).getGreenId()); judTrunkLineCrossProblemEntityDTO.setGreenId(greenwaveCrossPO.getGreenId());
judTrunkLineCrossProblemEntityDTO.setCrossId(crossResults.get(0).getCrossId()); judTrunkLineCrossProblemEntityDTO.setCrossId(greenwaveCrossPO.getCrossId());
judTrunkLineCrossProblemEntityDTO.setCrossName(baseCrossInfoPO.getName());
judTrunkLineCrossProblemEntityDTO.setSort(greenwaveCrossPO.getSort());
judTrunkLineCrossProblemEntityDTO.setInDir(greenwaveCrossPO.getInDir());
judTrunkLineCrossProblemEntityDTO.setOutDir(greenwaveCrossPO.getOutDir());
judTrunkLineCrossProblemEntityDTO.setStatusR(1);
judTrunkLineCrossProblemEntityDTO.setStatusL(1);
List<GreenwaveCrossResult> crossResults = crossIdMap.get(greenwaveCrossPO.getCrossId());
if (ObjectUtil.isNotEmpty(crossResults)) {
judTrunkLineCrossProblemEntityDTO.setCrossName(crossResults.get(0).getName()); judTrunkLineCrossProblemEntityDTO.setCrossName(crossResults.get(0).getName());
if (ObjectUtil.isEmpty(status) || status == 2) { if (ObjectUtil.isEmpty(status) || status == 2) {
int slowCountCross = crossResults.stream().filter(x -> 2 == x.getStatus()).mapToInt(GreenwaveCrossResult::getDirCount).sum(); int slowCountCross = crossResults.stream().filter(x -> 2 == x.getStatus()).mapToInt(GreenwaveCrossResult::getDirCount).sum();
if (slowCount > 0 && slowCountCross * 100 / slowCount > 10) { if (slowCount > 0 && slowCountCross * 100 / slowCount > 10) {
judTrunkLineCrossProblemEntityDTO.setCount(slowCountCross); Map<Integer, Integer> dirTypeCountMap = crossResults.stream().filter(x -> 2 == x.getStatus()).collect(Collectors.groupingBy(
Map<Integer, Integer> dirTypeCountMap = crossResults.stream().collect(Collectors.groupingBy(
GreenwaveCrossResult::getDirType, GreenwaveCrossResult::getDirType,
Collectors.summingInt(GreenwaveCrossResult::getDirCount) Collectors.summingInt(GreenwaveCrossResult::getDirCount)
)); ));
if(ObjectUtil.isNotEmpty(dirTypeCountMap)){
AtomicInteger atomicIntegerDir = new AtomicInteger(1);
for (Integer dirType : dirTypeCountMap.keySet()) { for (Integer dirType : dirTypeCountMap.keySet()) {
if(atomicIntegerDir.get()>1){ if (dirType == crossResults.get(0).getInDir()) {
judTrunkLineCrossProblemEntityDTO.setOutDir(dirType);
if(dirTypeCountMap.get(dirType) == 0){
judTrunkLineCrossProblemEntityDTO.setStatusR(1);
}else {
judTrunkLineCrossProblemEntityDTO.setStatusR(2);
}
}else {
judTrunkLineCrossProblemEntityDTO.setInDir(dirType);
if(dirTypeCountMap.get(dirType) == 0){
judTrunkLineCrossProblemEntityDTO.setStatusL(1);
}else {
judTrunkLineCrossProblemEntityDTO.setStatusL(2); judTrunkLineCrossProblemEntityDTO.setStatusL(2);
} }
if (dirType == crossResults.get(0).getOutDir()) {
judTrunkLineCrossProblemEntityDTO.setStatusR(2);
} }
} }
} }
if(ObjectUtil.isNotEmpty(crossResults.get(0))){
if(ObjectUtil.isNotEmpty(judTrunkLineCrossProblemEntityDTO.getInDir())){
if(crossResults.get(0).getInDir() == judTrunkLineCrossProblemEntityDTO.getInDir()){
if(ObjectUtil.isEmpty(judTrunkLineCrossProblemEntityDTO.getOutDir())){
judTrunkLineCrossProblemEntityDTO.setOutDir(crossResults.get(0).getOutDir());
judTrunkLineCrossProblemEntityDTO.setStatusR(1);
}
}
if(crossResults.get(0).getOutDir() == judTrunkLineCrossProblemEntityDTO.getInDir()){
if(ObjectUtil.isEmpty(judTrunkLineCrossProblemEntityDTO.getOutDir())){
judTrunkLineCrossProblemEntityDTO.setOutDir(crossResults.get(0).getInDir());
judTrunkLineCrossProblemEntityDTO.setStatusR(1);
}
}
}
if(ObjectUtil.isNotEmpty(judTrunkLineCrossProblemEntityDTO.getOutDir())){
if(crossResults.get(0).getOutDir() == judTrunkLineCrossProblemEntityDTO.getOutDir()){
if(ObjectUtil.isEmpty(judTrunkLineCrossProblemEntityDTO.getInDir())){
judTrunkLineCrossProblemEntityDTO.setInDir(crossResults.get(0).getInDir());
judTrunkLineCrossProblemEntityDTO.setStatusR(1);
}
}
if(crossResults.get(0).getInDir() == judTrunkLineCrossProblemEntityDTO.getOutDir()){
if(ObjectUtil.isEmpty(judTrunkLineCrossProblemEntityDTO.getInDir())){
judTrunkLineCrossProblemEntityDTO.setInDir(crossResults.get(0).getOutDir());
judTrunkLineCrossProblemEntityDTO.setStatusR(1);
}
}
}
}
} else {
continue;
} }
} }
if (ObjectUtil.isEmpty(status) || status == 3 || status == 4) { if (ObjectUtil.isEmpty(status) || status == 3 || status == 4) {
int conCountCross = crossResults.stream().filter(x -> 3 == x.getStatus() || 4 == x.getStatus()).mapToInt(GreenwaveCrossResult::getDirCount).sum(); int conCountCross = crossResults.stream().filter(x -> 3 == x.getStatus() || 4 == x.getStatus()).mapToInt(GreenwaveCrossResult::getDirCount).sum();
if (conCount > 0 && conCountCross * 100 / conCount > 10) { if (conCount > 0 && conCountCross * 100 / conCount > 10) {
if(ObjectUtil.isEmpty(judTrunkLineCrossProblemEntityDTO.getCount())){
judTrunkLineCrossProblemEntityDTO.setCount(conCountCross);
}
Map<Integer, Integer> dirTypeCountMap = crossResults.stream().collect(Collectors.groupingBy( Map<Integer, Integer> dirTypeCountMap = crossResults.stream().collect(Collectors.groupingBy(
GreenwaveCrossResult::getDirType, GreenwaveCrossResult::getDirType,
Collectors.summingInt(GreenwaveCrossResult::getDirCount) Collectors.summingInt(GreenwaveCrossResult::getDirCount)
)); ));
if(ObjectUtil.isNotEmpty(dirTypeCountMap)){
AtomicInteger atomicIntegerDir = new AtomicInteger(1);
for (Integer dirType : dirTypeCountMap.keySet()) { for (Integer dirType : dirTypeCountMap.keySet()) {
if(atomicIntegerDir.get()>1){ if (dirType == crossResults.get(0).getInDir()) {
if(ObjectUtil.isEmpty(judTrunkLineCrossProblemEntityDTO.getOutDir())){ judTrunkLineCrossProblemEntityDTO.setStatusL(3);
judTrunkLineCrossProblemEntityDTO.setOutDir(dirType);
} }
if(dirTypeCountMap.get(dirType) == 0){ if (dirType == crossResults.get(0).getOutDir()) {
judTrunkLineCrossProblemEntityDTO.setStatusR(1);
}else {
judTrunkLineCrossProblemEntityDTO.setStatusR(3); judTrunkLineCrossProblemEntityDTO.setStatusR(3);
} }
}else {
if(ObjectUtil.isEmpty(judTrunkLineCrossProblemEntityDTO.getInDir())){
judTrunkLineCrossProblemEntityDTO.setInDir(dirType);
}
if(dirTypeCountMap.get(dirType) == 0){
judTrunkLineCrossProblemEntityDTO.setStatusL(1);
}else {
judTrunkLineCrossProblemEntityDTO.setStatusL(3);
}
} }
} }
} }
if(ObjectUtil.isNotEmpty(crossResults.get(0))){ crossProblemEntityDTOS.add(judTrunkLineCrossProblemEntityDTO);
if(ObjectUtil.isNotEmpty(judTrunkLineCrossProblemEntityDTO.getInDir())){
if(crossResults.get(0).getInDir() == judTrunkLineCrossProblemEntityDTO.getInDir()){
if(ObjectUtil.isEmpty(judTrunkLineCrossProblemEntityDTO.getOutDir())){
judTrunkLineCrossProblemEntityDTO.setOutDir(crossResults.get(0).getOutDir());
judTrunkLineCrossProblemEntityDTO.setStatusR(1);
} }
} }
if(crossResults.get(0).getOutDir() == judTrunkLineCrossProblemEntityDTO.getInDir()){ List<JudTrunkLineCrossProblemEntityVO> judTrunkLineCrossProblemEntityVOS = crossProblemEntityDTOS.stream().map(x -> {
if(ObjectUtil.isEmpty(judTrunkLineCrossProblemEntityDTO.getOutDir())){ JudTrunkLineCrossProblemEntityVO judTrunkLineCrossProblemEntityVO = new JudTrunkLineCrossProblemEntityVO();
judTrunkLineCrossProblemEntityDTO.setOutDir(crossResults.get(0).getInDir()); BeanUtils.copyProperties(x, judTrunkLineCrossProblemEntityVO);
judTrunkLineCrossProblemEntityDTO.setStatusR(1); return judTrunkLineCrossProblemEntityVO;
}).collect(Collectors.toList());
return judTrunkLineCrossProblemEntityVOS;
} }
@Override
public JSONObject getGreenCongestionAnalysis(Integer greenId, String startTime, String endTime) {
Double stoptimes = analysisProblemCrossDayMapper.getGreenStopTimeAvg(greenId, startTime, endTime);
Double stoptimesSum = analysisProblemCrossDayMapper.getGreenStopTimeSum(greenId, startTime, endTime);
List<GreenwaveCrossPO> greenwaveCrossPOS = greenwaveCrossMapper.selectByGreenwaveId(greenId);
JSONObject jsonObject = new JSONObject();
if (stoptimesSum > greenwaveCrossPOS.size()) {
jsonObject.put("slowAnalysis", "干线相位协调不佳,干线频繁停车,平均停车次数" + stoptimes + "次,易拥堵");
}
String crossName = "";
for (GreenwaveCrossPO greenwaveCrossPO : greenwaveCrossPOS) {
List<LaneSturationInfo> sturationInfoList = analysisProblemCrossDayMapper.getSturationInfoList(greenwaveCrossPO.getCrossId(), startTime, endTime);
List<LaneSturationInfo> infoList = sturationInfoList.stream().filter(x -> greenwaveCrossPO.getInDir() == x.getDir() || greenwaveCrossPO.getOutDir() == x.getDir()).collect(Collectors.toList());
if (ObjectUtil.isEmpty(infoList) || infoList.size() == 0) {
continue;
} }
List<LaneSturationInfo> sturationInfos = infoList.stream().filter(x -> ObjectUtil.isNotEmpty(x.getSturation()) && x.getSturation() > 0.8).collect(Collectors.toList());
if (sturationInfos.size() * 1.0 / infoList.size() > 0.5) {
BaseCrossInfoPO baseCrossInfoPO = baseCrossInfoMapper.selectById(greenwaveCrossPO.getCrossId());
if (ObjectUtil.isEmpty(crossName)) {
crossName = baseCrossInfoPO.getName();
} else {
crossName = crossName + "、" + baseCrossInfoPO.getName();
} }
if(ObjectUtil.isNotEmpty(judTrunkLineCrossProblemEntityDTO.getOutDir())){
if(crossResults.get(0).getOutDir() == judTrunkLineCrossProblemEntityDTO.getOutDir()){
if(ObjectUtil.isEmpty(judTrunkLineCrossProblemEntityDTO.getInDir())){
judTrunkLineCrossProblemEntityDTO.setInDir(crossResults.get(0).getInDir());
judTrunkLineCrossProblemEntityDTO.setStatusR(1);
} }
if (ObjectUtil.isNotEmpty(crossName)) {
jsonObject.put("crossAnalysis", crossName + "协调方向流量饱和,易引发拥堵");
} }
if(crossResults.get(0).getInDir() == judTrunkLineCrossProblemEntityDTO.getOutDir()){
if(ObjectUtil.isEmpty(judTrunkLineCrossProblemEntityDTO.getInDir())){
judTrunkLineCrossProblemEntityDTO.setInDir(crossResults.get(0).getOutDir());
judTrunkLineCrossProblemEntityDTO.setStatusR(1);
} }
return jsonObject;
} }
@Override
public JSONObject getGreenSlowAnalysis(Integer greenId, String startTime, String endTime) {
Double stoptimes = analysisProblemCrossDayMapper.getGreenSlowStopTimeSum(greenId, startTime, endTime);
List<GreenwaveCrossPO> greenwaveCrossPOS = greenwaveCrossMapper.selectByGreenwaveId(greenId);
JSONObject jsonObject = new JSONObject();
if (stoptimes > greenwaveCrossPOS.size() / 2) {
jsonObject.put("slowAnalysis", "干线绿波协调不连续,易引发缓行");
} }
return jsonObject;
} }
} else {
continue;
}
}
crossProblemEntityDTOS.add(judTrunkLineCrossProblemEntityDTO);
}
}
AtomicInteger atomicInteger = new AtomicInteger(1);
crossProblemEntityDTOS.stream().sorted(Comparator.comparingInt(JudTrunkLineCrossProblemEntityDTO::getCount)).forEach(x->x.setSort(atomicInteger.getAndIncrement()));
List<JudTrunkLineCrossProblemEntityVO> judTrunkLineCrossProblemEntityVOS = crossProblemEntityDTOS.stream().map(x -> {
JudTrunkLineCrossProblemEntityVO judTrunkLineCrossProblemEntityVO = new JudTrunkLineCrossProblemEntityVO();
BeanUtils.copyProperties(x, judTrunkLineCrossProblemEntityVO);
return judTrunkLineCrossProblemEntityVO;
}).collect(Collectors.toList());
return judTrunkLineCrossProblemEntityVOS;
}
} }
...@@ -60,7 +60,10 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -60,7 +60,10 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
List<CrossRidLaneVO> crossRidLaneVOS = new ArrayList<>(); List<CrossRidLaneVO> crossRidLaneVOS = new ArrayList<>();
for (String laneName : laneNameMap.keySet()) { for (String laneName : laneNameMap.keySet()) {
List<CrossRidLaneDTO> laneDTOS = laneNameMap.get(laneName); List<CrossRidLaneDTO> laneDTOS = laneNameMap.get(laneName).stream().filter(x -> ObjectUtil.isNotEmpty(x.getLaneType()) && x.getLaneType() == 2).collect(Collectors.toList());
if(ObjectUtil.isEmpty(laneDTOS)){
continue;
}
CrossRidLaneVO crossRidLaneVO = new CrossRidLaneVO(); CrossRidLaneVO crossRidLaneVO = new CrossRidLaneVO();
crossRidLaneVO.setLaneName(laneName); crossRidLaneVO.setLaneName(laneName);
if (ObjectUtil.isEmpty(laneDTOS.get(0).getInDir()) || ObjectUtil.isEmpty(laneDTOS.get(0).getOutDir())) { if (ObjectUtil.isEmpty(laneDTOS.get(0).getInDir()) || ObjectUtil.isEmpty(laneDTOS.get(0).getOutDir())) {
...@@ -68,7 +71,20 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -68,7 +71,20 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
} else { } else {
crossRidLaneVO.setLaneDir(CrossDirEnum.getDesc(laneDTOS.get(0).getInDir()) + CrossDirEnum.getDesc(laneDTOS.get(0).getOutDir()) + "走向"); crossRidLaneVO.setLaneDir(CrossDirEnum.getDesc(laneDTOS.get(0).getInDir()) + CrossDirEnum.getDesc(laneDTOS.get(0).getOutDir()) + "走向");
} }
crossRidLaneVO.setLaneNum(laneDTOS.size()); Map<String, List<CrossRidLaneDTO>> endCrossRoadMap = laneNameMap.get(laneName).stream().filter(x ->ObjectUtil.isNotEmpty(x.getLaneType()) && x.getLaneType() == 1 && x.getCrossId().equals(x.getStartCrossId())).collect(Collectors.groupingBy(CrossRidLaneDTO::getEndCrossId));
Map<String, List<CrossRidLaneDTO>> startCrossRoadMap = laneNameMap.get(laneName).stream().filter(x ->ObjectUtil.isNotEmpty(x.getLaneType()) && x.getLaneType() == 1 && x.getCrossId().equals(x.getEndCrossId())).collect(Collectors.groupingBy(CrossRidLaneDTO::getStartCrossId));
int maxCount = 0;
for (String endCrossId : endCrossRoadMap.keySet()) {
for (String startCrossId : startCrossRoadMap.keySet()) {
if (endCrossId.equals(startCrossId)) {
int count = endCrossRoadMap.get(endCrossId).size() + startCrossRoadMap.get(startCrossId).size();
if (count > maxCount) {
maxCount = count;
}
}
}
}
crossRidLaneVO.setLaneNum(maxCount);
Map<Integer, List<CrossRidLaneDTO>> dirLaneMap = laneDTOS.stream().collect(Collectors.groupingBy(CrossRidLaneDTO::getDir)); Map<Integer, List<CrossRidLaneDTO>> dirLaneMap = laneDTOS.stream().collect(Collectors.groupingBy(CrossRidLaneDTO::getDir));
List<LaneDirNumVO> laneDirNumVOS = new ArrayList<>(); List<LaneDirNumVO> laneDirNumVOS = new ArrayList<>();
for (Integer dir : dirLaneMap.keySet()) { for (Integer dir : dirLaneMap.keySet()) {
...@@ -232,26 +248,36 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -232,26 +248,36 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
if (workTotalFlowSum > 0) { if (workTotalFlowSum > 0) {
crossRunStateAnalysisResultResponseDTO.setAvgFlowLastWeekCompare("提升" + Math.round(workTotalFlowSum) + "辆"); crossRunStateAnalysisResultResponseDTO.setAvgFlowLastWeekCompare("提升" + Math.round(workTotalFlowSum) + "辆");
} else if (workTotalFlowSum == 0) {
crossRunStateAnalysisResultResponseDTO.setAvgFlowLastWeekCompare("持平");
} else { } else {
crossRunStateAnalysisResultResponseDTO.setAvgFlowLastWeekCompare("下降" + Math.abs(Math.round(workTotalFlowSum)) + "辆"); crossRunStateAnalysisResultResponseDTO.setAvgFlowLastWeekCompare("下降" + Math.abs(Math.round(workTotalFlowSum)) + "辆");
} }
if (weekEndAvgFlowSum > 0) { if (weekEndAvgFlowSum > 0) {
crossRunStateAnalysisResultResponseDTO.setEndAvgFlowLastWeekCompare("提升" + Math.round(weekEndAvgFlowSum) + "辆"); crossRunStateAnalysisResultResponseDTO.setEndAvgFlowLastWeekCompare("提升" + Math.round(weekEndAvgFlowSum) + "辆");
} else if (weekEndAvgFlowSum == 0) {
crossRunStateAnalysisResultResponseDTO.setEndAvgFlowLastWeekCompare("持平");
} else { } else {
crossRunStateAnalysisResultResponseDTO.setEndAvgFlowLastWeekCompare("下降" + Math.abs(Math.round(weekEndAvgFlowSum)) + "辆"); crossRunStateAnalysisResultResponseDTO.setEndAvgFlowLastWeekCompare("下降" + Math.abs(Math.round(weekEndAvgFlowSum)) + "辆");
} }
if (workDayAmPeakMaxHourFlowSum > 0) { if (workDayAmPeakMaxHourFlowSum > 0) {
crossRunStateAnalysisResultResponseDTO.setAmPeakMaxHourFlowLastWeekCompare("提升" + workDayAmPeakMaxHourFlowSum + "辆"); crossRunStateAnalysisResultResponseDTO.setAmPeakMaxHourFlowLastWeekCompare("提升" + workDayAmPeakMaxHourFlowSum + "辆");
} else if (workDayAmPeakMaxHourFlowSum == 0) {
crossRunStateAnalysisResultResponseDTO.setAmPeakMaxHourFlowLastWeekCompare("持平");
} else { } else {
crossRunStateAnalysisResultResponseDTO.setAmPeakMaxHourFlowLastWeekCompare("下降" + Math.abs(workDayAmPeakMaxHourFlowSum) + "辆"); crossRunStateAnalysisResultResponseDTO.setAmPeakMaxHourFlowLastWeekCompare("下降" + Math.abs(workDayAmPeakMaxHourFlowSum) + "辆");
} }
if (workDayPmPeakMaxHourFlowSum > 0) { if (workDayPmPeakMaxHourFlowSum > 0) {
crossRunStateAnalysisResultResponseDTO.setPmPeakMaxHourFlowLastWeekCompare("提升" + workDayPmPeakMaxHourFlowSum + "辆"); crossRunStateAnalysisResultResponseDTO.setPmPeakMaxHourFlowLastWeekCompare("提升" + workDayPmPeakMaxHourFlowSum + "辆");
} else if (workDayPmPeakMaxHourFlowSum == 0) {
crossRunStateAnalysisResultResponseDTO.setPmPeakMaxHourFlowLastWeekCompare("持平");
} else { } else {
crossRunStateAnalysisResultResponseDTO.setPmPeakMaxHourFlowLastWeekCompare("下降" + Math.abs(workDayPmPeakMaxHourFlowSum) + "辆"); crossRunStateAnalysisResultResponseDTO.setPmPeakMaxHourFlowLastWeekCompare("下降" + Math.abs(workDayPmPeakMaxHourFlowSum) + "辆");
} }
if (workDayFmPeakMaxHourFlowSum > 0) { if (workDayFmPeakMaxHourFlowSum > 0) {
crossRunStateAnalysisResultResponseDTO.setFmPeakMaxHourFlowLastWeekCompare("提升" + workDayFmPeakMaxHourFlowSum + "辆"); crossRunStateAnalysisResultResponseDTO.setFmPeakMaxHourFlowLastWeekCompare("提升" + workDayFmPeakMaxHourFlowSum + "辆");
} else if (workDayFmPeakMaxHourFlowSum == 0) {
crossRunStateAnalysisResultResponseDTO.setFmPeakMaxHourFlowLastWeekCompare("持平");
} else { } else {
crossRunStateAnalysisResultResponseDTO.setFmPeakMaxHourFlowLastWeekCompare("下降" + Math.abs(workDayFmPeakMaxHourFlowSum) + "辆"); crossRunStateAnalysisResultResponseDTO.setFmPeakMaxHourFlowLastWeekCompare("下降" + Math.abs(workDayFmPeakMaxHourFlowSum) + "辆");
} }
...@@ -263,7 +289,7 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -263,7 +289,7 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
} }
} else { } else {
if (workDayAmPeakAvgTrafficIndexLast == 0) { if (workDayAmPeakAvgTrafficIndexLast == 0) {
crossRunStateAnalysisResultResponseDTO.setAmPeakAvgTrafficIndexLastWeekCompare("下降0%"); crossRunStateAnalysisResultResponseDTO.setAmPeakAvgTrafficIndexLastWeekCompare("持平");
} else { } else {
crossRunStateAnalysisResultResponseDTO.setAmPeakAvgTrafficIndexLastWeekCompare("下降" + Math.abs(Math.round(workDayAmPeakAvgTrafficIndexSum * 100 / workDayAmPeakAvgTrafficIndexLast * 100) / 100.0) + "%"); crossRunStateAnalysisResultResponseDTO.setAmPeakAvgTrafficIndexLastWeekCompare("下降" + Math.abs(Math.round(workDayAmPeakAvgTrafficIndexSum * 100 / workDayAmPeakAvgTrafficIndexLast * 100) / 100.0) + "%");
} }
...@@ -276,7 +302,7 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -276,7 +302,7 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
} }
} else { } else {
if (workDayPmPeakAvgTrafficIndexLast == 0) { if (workDayPmPeakAvgTrafficIndexLast == 0) {
crossRunStateAnalysisResultResponseDTO.setPmPeakAvgTrafficIndexLastWeekCompare("下降0%"); crossRunStateAnalysisResultResponseDTO.setPmPeakAvgTrafficIndexLastWeekCompare("持平");
} else { } else {
crossRunStateAnalysisResultResponseDTO.setPmPeakAvgTrafficIndexLastWeekCompare("下降" + Math.abs(Math.round(workDayPmPeakAvgTrafficIndexSum * 100 / workDayPmPeakAvgTrafficIndexLast * 100) / 100.0) + "%"); crossRunStateAnalysisResultResponseDTO.setPmPeakAvgTrafficIndexLastWeekCompare("下降" + Math.abs(Math.round(workDayPmPeakAvgTrafficIndexSum * 100 / workDayPmPeakAvgTrafficIndexLast * 100) / 100.0) + "%");
} }
...@@ -440,6 +466,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -440,6 +466,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
amPeakAvgTrafficIndexLastWeekCompare = (amPeakTrafficIndex - amPeakTrafficIndexLast) / amPeakTrafficIndexLast; amPeakAvgTrafficIndexLastWeekCompare = (amPeakTrafficIndex - amPeakTrafficIndexLast) / amPeakTrafficIndexLast;
if (amPeakAvgTrafficIndexLastWeekCompare > 0) { if (amPeakAvgTrafficIndexLastWeekCompare > 0) {
peakResultResponseVO.setAmPeakAvgTrafficIndexLastWeekCompare("增加" + Math.round(amPeakAvgTrafficIndexLastWeekCompare * 100) + "%"); peakResultResponseVO.setAmPeakAvgTrafficIndexLastWeekCompare("增加" + Math.round(amPeakAvgTrafficIndexLastWeekCompare * 100) + "%");
} else if (amPeakAvgTrafficIndexLastWeekCompare == 0) {
peakResultResponseVO.setAmPeakAvgTrafficIndexLastWeekCompare("持平");
} else { } else {
peakResultResponseVO.setAmPeakAvgTrafficIndexLastWeekCompare("减少" + Math.abs(Math.round(amPeakAvgTrafficIndexLastWeekCompare * 100)) + "%"); peakResultResponseVO.setAmPeakAvgTrafficIndexLastWeekCompare("减少" + Math.abs(Math.round(amPeakAvgTrafficIndexLastWeekCompare * 100)) + "%");
} }
...@@ -457,6 +485,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -457,6 +485,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
pmPeakAvgTrafficIndexLastWeekCompare = (pmPeakTrafficIndex - pmPeakTrafficIndexLast) / pmPeakTrafficIndexLast; pmPeakAvgTrafficIndexLastWeekCompare = (pmPeakTrafficIndex - pmPeakTrafficIndexLast) / pmPeakTrafficIndexLast;
if (pmPeakAvgTrafficIndexLastWeekCompare > 0) { if (pmPeakAvgTrafficIndexLastWeekCompare > 0) {
peakResultResponseVO.setPmPeakAvgTrafficIndexLastWeekCompare("增加" + Math.round(pmPeakAvgTrafficIndexLastWeekCompare * 100) + "%"); peakResultResponseVO.setPmPeakAvgTrafficIndexLastWeekCompare("增加" + Math.round(pmPeakAvgTrafficIndexLastWeekCompare * 100) + "%");
} else if (pmPeakAvgTrafficIndexLastWeekCompare == 0) {
peakResultResponseVO.setPmPeakAvgTrafficIndexLastWeekCompare("持平");
} else { } else {
peakResultResponseVO.setPmPeakAvgTrafficIndexLastWeekCompare("减少" + Math.abs(Math.round(pmPeakAvgTrafficIndexLastWeekCompare * 100)) + "%"); peakResultResponseVO.setPmPeakAvgTrafficIndexLastWeekCompare("减少" + Math.abs(Math.round(pmPeakAvgTrafficIndexLastWeekCompare * 100)) + "%");
} }
...@@ -477,6 +507,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -477,6 +507,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
double amPeakCapacityLastWeekCompare = (amPeakCapacity - amPeakCapacityLast) / amPeakCapacityLast; double amPeakCapacityLastWeekCompare = (amPeakCapacity - amPeakCapacityLast) / amPeakCapacityLast;
if (amPeakCapacityLastWeekCompare > 0) { if (amPeakCapacityLastWeekCompare > 0) {
peakResultResponseVO.setAmPeakCapacityLastWeekCompare("提升" + Math.round(amPeakCapacityLastWeekCompare * 100) + "%"); peakResultResponseVO.setAmPeakCapacityLastWeekCompare("提升" + Math.round(amPeakCapacityLastWeekCompare * 100) + "%");
} else if (amPeakCapacityLastWeekCompare == 0) {
peakResultResponseVO.setAmPeakCapacityLastWeekCompare("持平");
} else { } else {
peakResultResponseVO.setAmPeakCapacityLastWeekCompare("下降" + Math.abs(Math.round(amPeakCapacityLastWeekCompare * 100)) + "%"); peakResultResponseVO.setAmPeakCapacityLastWeekCompare("下降" + Math.abs(Math.round(amPeakCapacityLastWeekCompare * 100)) + "%");
} }
...@@ -495,6 +527,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -495,6 +527,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
double pmPeakCapacityLastWeekCompare = (pmPeakCapacity - pmPeakCapacityLast) / pmPeakCapacityLast; double pmPeakCapacityLastWeekCompare = (pmPeakCapacity - pmPeakCapacityLast) / pmPeakCapacityLast;
if (pmPeakCapacityLastWeekCompare > 0) { if (pmPeakCapacityLastWeekCompare > 0) {
peakResultResponseVO.setPmPeakCapacityLastWeekCompare("提升" + Math.round(pmPeakCapacityLastWeekCompare * 100) + "%"); peakResultResponseVO.setPmPeakCapacityLastWeekCompare("提升" + Math.round(pmPeakCapacityLastWeekCompare * 100) + "%");
} else if (pmPeakCapacityLastWeekCompare == 0) {
peakResultResponseVO.setPmPeakCapacityLastWeekCompare("持平");
} else { } else {
peakResultResponseVO.setPmPeakCapacityLastWeekCompare("下降" + Math.abs(Math.round(pmPeakCapacityLastWeekCompare * 100)) + "%"); peakResultResponseVO.setPmPeakCapacityLastWeekCompare("下降" + Math.abs(Math.round(pmPeakCapacityLastWeekCompare * 100)) + "%");
} }
...@@ -513,6 +547,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -513,6 +547,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
double amPeakDelayTimeLastWeekCompare = (amPeakDelayTime - amPeakDelayTimeLast) / amPeakDelayTimeLast; double amPeakDelayTimeLastWeekCompare = (amPeakDelayTime - amPeakDelayTimeLast) / amPeakDelayTimeLast;
if (amPeakDelayTimeLastWeekCompare > 0) { if (amPeakDelayTimeLastWeekCompare > 0) {
peakResultResponseVO.setAmPeakDelayTimeLastWeekCompare("增加" + Math.round(amPeakDelayTimeLastWeekCompare * 100) + "%"); peakResultResponseVO.setAmPeakDelayTimeLastWeekCompare("增加" + Math.round(amPeakDelayTimeLastWeekCompare * 100) + "%");
} else if (amPeakDelayTimeLastWeekCompare == 0) {
peakResultResponseVO.setAmPeakDelayTimeLastWeekCompare("持平");
} else { } else {
peakResultResponseVO.setAmPeakDelayTimeLastWeekCompare("减少" + Math.abs(Math.round(amPeakDelayTimeLastWeekCompare * 100)) + "%"); peakResultResponseVO.setAmPeakDelayTimeLastWeekCompare("减少" + Math.abs(Math.round(amPeakDelayTimeLastWeekCompare * 100)) + "%");
} }
...@@ -531,6 +567,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -531,6 +567,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
double pmPeakDelayTimeLastWeekCompare = (pmPeakDelayTime - pmPeakDelayTimeLast) / pmPeakDelayTimeLast; double pmPeakDelayTimeLastWeekCompare = (pmPeakDelayTime - pmPeakDelayTimeLast) / pmPeakDelayTimeLast;
if (pmPeakDelayTimeLastWeekCompare > 0) { if (pmPeakDelayTimeLastWeekCompare > 0) {
peakResultResponseVO.setPmPeakDelayTimeLastWeekCompare("增加" + Math.round(pmPeakDelayTimeLastWeekCompare * 100) + "%"); peakResultResponseVO.setPmPeakDelayTimeLastWeekCompare("增加" + Math.round(pmPeakDelayTimeLastWeekCompare * 100) + "%");
} else if (pmPeakDelayTimeLastWeekCompare == 0) {
peakResultResponseVO.setPmPeakDelayTimeLastWeekCompare("持平");
} else { } else {
peakResultResponseVO.setPmPeakDelayTimeLastWeekCompare("减少" + Math.abs(Math.round(pmPeakDelayTimeLastWeekCompare * 100)) + "%"); peakResultResponseVO.setPmPeakDelayTimeLastWeekCompare("减少" + Math.abs(Math.round(pmPeakDelayTimeLastWeekCompare * 100)) + "%");
} }
...@@ -549,6 +587,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -549,6 +587,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
double amPeakMaxQueueLengthLastWeekCompare = (amPeakMaxQueueLength - amPeakMaxQueueLengthLast) / amPeakMaxQueueLengthLast; double amPeakMaxQueueLengthLastWeekCompare = (amPeakMaxQueueLength - amPeakMaxQueueLengthLast) / amPeakMaxQueueLengthLast;
if (amPeakMaxQueueLengthLastWeekCompare > 0) { if (amPeakMaxQueueLengthLastWeekCompare > 0) {
peakResultResponseVO.setAmPeakMaxQueueLengthLastWeekCompare("增加" + Math.round(amPeakMaxQueueLengthLastWeekCompare * 100) + "%"); peakResultResponseVO.setAmPeakMaxQueueLengthLastWeekCompare("增加" + Math.round(amPeakMaxQueueLengthLastWeekCompare * 100) + "%");
} else if (amPeakMaxQueueLengthLastWeekCompare == 0) {
peakResultResponseVO.setAmPeakMaxQueueLengthLastWeekCompare("持平");
} else { } else {
peakResultResponseVO.setAmPeakMaxQueueLengthLastWeekCompare("减少" + Math.abs(Math.round(amPeakMaxQueueLengthLastWeekCompare * 100)) + "%"); peakResultResponseVO.setAmPeakMaxQueueLengthLastWeekCompare("减少" + Math.abs(Math.round(amPeakMaxQueueLengthLastWeekCompare * 100)) + "%");
} }
...@@ -567,6 +607,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -567,6 +607,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
double pmPeakMaxQueueLengthLastWeekCompare = (pmPeakMaxQueueLength - pmPeakMaxQueueLengthLast) / pmPeakMaxQueueLengthLast; double pmPeakMaxQueueLengthLastWeekCompare = (pmPeakMaxQueueLength - pmPeakMaxQueueLengthLast) / pmPeakMaxQueueLengthLast;
if (pmPeakMaxQueueLengthLastWeekCompare > 0) { if (pmPeakMaxQueueLengthLastWeekCompare > 0) {
peakResultResponseVO.setPmPeakMaxQueueLengthLastWeekCompare("增加" + Math.round(pmPeakMaxQueueLengthLastWeekCompare * 100) + "%"); peakResultResponseVO.setPmPeakMaxQueueLengthLastWeekCompare("增加" + Math.round(pmPeakMaxQueueLengthLastWeekCompare * 100) + "%");
} else if (pmPeakMaxQueueLengthLastWeekCompare == 0) {
peakResultResponseVO.setPmPeakMaxQueueLengthLastWeekCompare("持平");
} else { } else {
peakResultResponseVO.setPmPeakMaxQueueLengthLastWeekCompare("减少" + Math.abs(Math.round(pmPeakMaxQueueLengthLastWeekCompare * 100)) + "%"); peakResultResponseVO.setPmPeakMaxQueueLengthLastWeekCompare("减少" + Math.abs(Math.round(pmPeakMaxQueueLengthLastWeekCompare * 100)) + "%");
} }
...@@ -585,6 +627,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -585,6 +627,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
double amPeakStopTimesLastWeekCompare = (amPeakStopTimes - amPeakStopTimesLast) / amPeakStopTimesLast; double amPeakStopTimesLastWeekCompare = (amPeakStopTimes - amPeakStopTimesLast) / amPeakStopTimesLast;
if (amPeakStopTimesLastWeekCompare > 0) { if (amPeakStopTimesLastWeekCompare > 0) {
peakResultResponseVO.setAmPeakStopTimesLastWeekCompare("增加" + Math.round(amPeakStopTimesLastWeekCompare * 100) + "%"); peakResultResponseVO.setAmPeakStopTimesLastWeekCompare("增加" + Math.round(amPeakStopTimesLastWeekCompare * 100) + "%");
} else if (amPeakStopTimesLastWeekCompare == 0) {
peakResultResponseVO.setAmPeakStopTimesLastWeekCompare("持平");
} else { } else {
peakResultResponseVO.setAmPeakStopTimesLastWeekCompare("减少" + Math.abs(Math.round(amPeakStopTimesLastWeekCompare * 100)) + "%"); peakResultResponseVO.setAmPeakStopTimesLastWeekCompare("减少" + Math.abs(Math.round(amPeakStopTimesLastWeekCompare * 100)) + "%");
} }
...@@ -603,17 +647,19 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -603,17 +647,19 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
double pmPeakStopTimesLastWeekCompare = (pmPeakStopTimes - pmPeakStopTimesLast) / pmPeakStopTimesLast; double pmPeakStopTimesLastWeekCompare = (pmPeakStopTimes - pmPeakStopTimesLast) / pmPeakStopTimesLast;
if (pmPeakStopTimesLastWeekCompare > 0) { if (pmPeakStopTimesLastWeekCompare > 0) {
peakResultResponseVO.setPmPeakStopTimesLastWeekCompare("增加" + Math.round(pmPeakStopTimesLastWeekCompare * 100) + "%"); peakResultResponseVO.setPmPeakStopTimesLastWeekCompare("增加" + Math.round(pmPeakStopTimesLastWeekCompare * 100) + "%");
} else if (pmPeakStopTimesLastWeekCompare == 0) {
peakResultResponseVO.setPmPeakStopTimesLastWeekCompare("持平");
} else { } else {
peakResultResponseVO.setPmPeakStopTimesLastWeekCompare("减少" + Math.abs(Math.round(pmPeakStopTimesLastWeekCompare * 100)) + "%"); peakResultResponseVO.setPmPeakStopTimesLastWeekCompare("减少" + Math.abs(Math.round(pmPeakStopTimesLastWeekCompare * 100)) + "%");
} }
} }
//总体运行效果明显提升【略有下降】 //总体运行效果明显提升【略有下降】
if (pmPeakTrafficIndex + amPeakTrafficIndex - amPeakTrafficIndexLast - pmPeakTrafficIndexLast > 0) { if (pmPeakTrafficIndex + amPeakTrafficIndex - amPeakTrafficIndexLast - pmPeakTrafficIndexLast > 0) {
peakResultResponseVO.setTotalityRunSituation("明显提升"); peakResultResponseVO.setTotalityRunSituation("略有下降");
} else if (pmPeakTrafficIndex + amPeakTrafficIndex - amPeakTrafficIndexLast - pmPeakTrafficIndexLast == 0) { } else if (pmPeakTrafficIndex + amPeakTrafficIndex - amPeakTrafficIndexLast - pmPeakTrafficIndexLast == 0) {
peakResultResponseVO.setTotalityRunSituation("持平"); peakResultResponseVO.setTotalityRunSituation("持平");
} else { } else {
peakResultResponseVO.setTotalityRunSituation("略有下降"); peakResultResponseVO.setTotalityRunSituation("明显提升");
} }
//本周早高峰集中时段7:30~8:30 //本周早高峰集中时段7:30~8:30
List<String> timeList = new ArrayList<>(); List<String> timeList = new ArrayList<>();
...@@ -666,9 +712,9 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -666,9 +712,9 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
//本周早高峰持续时长上周比较情况提前【延后】20分钟 //本周早高峰持续时长上周比较情况提前【延后】20分钟
Long thisWeekAmPeakDurationSituation = thisWeekAmPeakDuration - thisWeekAmPeakDurationLast; Long thisWeekAmPeakDurationSituation = thisWeekAmPeakDuration - thisWeekAmPeakDurationLast;
if (thisWeekAmPeakDurationSituation > 0) { if (thisWeekAmPeakDurationSituation > 0) {
peakResultResponseVO.setThisWeekAmPeakDurationSituation("延" + thisWeekAmPeakDurationSituation + "分钟"); peakResultResponseVO.setThisWeekAmPeakDurationSituation("延" + thisWeekAmPeakDurationSituation + "分钟");
} else { } else {
peakResultResponseVO.setThisWeekAmPeakDurationSituation("提前" + Math.abs(thisWeekAmPeakDurationSituation) + "分钟"); peakResultResponseVO.setThisWeekAmPeakDurationSituation("缩短" + Math.abs(thisWeekAmPeakDurationSituation) + "分钟");
} }
//本周晚高峰集中时段7:30~8:30 //本周晚高峰集中时段7:30~8:30
...@@ -723,9 +769,9 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -723,9 +769,9 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
//本周晚高峰持续时长上周比较情况提前【延后】20分钟 //本周晚高峰持续时长上周比较情况提前【延后】20分钟
Long thisWeekPmPeakDurationSituation = thisWeekPmPeakDuration - thisWeekPmPeakDurationLast; Long thisWeekPmPeakDurationSituation = thisWeekPmPeakDuration - thisWeekPmPeakDurationLast;
if (thisWeekPmPeakDurationSituation > 0) { if (thisWeekPmPeakDurationSituation > 0) {
peakResultResponseVO.setThisWeekPmPeakDurationSituation("延" + thisWeekPmPeakDurationSituation + "分钟"); peakResultResponseVO.setThisWeekPmPeakDurationSituation("延" + thisWeekPmPeakDurationSituation + "分钟");
} else { } else {
peakResultResponseVO.setThisWeekPmPeakDurationSituation("提前" + Math.abs(thisWeekPmPeakDurationSituation) + "分钟"); peakResultResponseVO.setThisWeekPmPeakDurationSituation("缩短" + Math.abs(thisWeekPmPeakDurationSituation) + "分钟");
} }
//峰期交通流参数对比分析 //峰期交通流参数对比分析
...@@ -913,6 +959,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -913,6 +959,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
int weekCapacitySituation = (weekCapacity - weekCapacityLast) / weekCapacityLast * 100; int weekCapacitySituation = (weekCapacity - weekCapacityLast) / weekCapacityLast * 100;
if (weekCapacitySituation > 0) { if (weekCapacitySituation > 0) {
resultResponseVO.setWeekCapacitySituation("提升" + weekCapacitySituation + "%"); resultResponseVO.setWeekCapacitySituation("提升" + weekCapacitySituation + "%");
} else if (weekCapacitySituation == 0) {
resultResponseVO.setWeekCapacitySituation("持平");
} else { } else {
resultResponseVO.setWeekCapacitySituation("降低" + Math.abs(weekCapacitySituation) + "%"); resultResponseVO.setWeekCapacitySituation("降低" + Math.abs(weekCapacitySituation) + "%");
} }
...@@ -922,6 +970,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -922,6 +970,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
long weekStopTimesSituation = Math.round((weekStopTimes - weekStopTimesLast) / weekStopTimesLast * 100); long weekStopTimesSituation = Math.round((weekStopTimes - weekStopTimesLast) / weekStopTimesLast * 100);
if (weekCapacitySituation > 0) { if (weekCapacitySituation > 0) {
resultResponseVO.setWeekStopTimesSituation("增加" + weekStopTimesSituation + "%"); resultResponseVO.setWeekStopTimesSituation("增加" + weekStopTimesSituation + "%");
} else if (weekCapacitySituation == 0) {
resultResponseVO.setWeekStopTimesSituation("持平");
} else { } else {
resultResponseVO.setWeekStopTimesSituation("减少" + Math.abs(weekStopTimesSituation) + "%"); resultResponseVO.setWeekStopTimesSituation("减少" + Math.abs(weekStopTimesSituation) + "%");
} }
...@@ -931,6 +981,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -931,6 +981,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
long weekDelayTimeSituation = Math.round((weekDelayTime - weekDelayTimeLast) / weekDelayTimeLast * 100); long weekDelayTimeSituation = Math.round((weekDelayTime - weekDelayTimeLast) / weekDelayTimeLast * 100);
if (weekDelayTimeSituation > 0) { if (weekDelayTimeSituation > 0) {
resultResponseVO.setWeekDelayTimeSituation("增加" + weekDelayTimeSituation + "%"); resultResponseVO.setWeekDelayTimeSituation("增加" + weekDelayTimeSituation + "%");
} else if (weekDelayTimeSituation == 0) {
resultResponseVO.setWeekDelayTimeSituation("持平");
} else { } else {
resultResponseVO.setWeekDelayTimeSituation("减少" + Math.abs(weekDelayTimeSituation) + "%"); resultResponseVO.setWeekDelayTimeSituation("减少" + Math.abs(weekDelayTimeSituation) + "%");
} }
...@@ -940,6 +992,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -940,6 +992,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
long weekMaxQueueLengthSituation = Math.round((weekMaxQueueLength - weekMaxQueueLengthLast) / weekMaxQueueLengthLast * 100); long weekMaxQueueLengthSituation = Math.round((weekMaxQueueLength - weekMaxQueueLengthLast) / weekMaxQueueLengthLast * 100);
if (weekMaxQueueLengthSituation > 0) { if (weekMaxQueueLengthSituation > 0) {
resultResponseVO.setWeekMaxQueueLengthSituation("增加" + weekMaxQueueLengthSituation + "%"); resultResponseVO.setWeekMaxQueueLengthSituation("增加" + weekMaxQueueLengthSituation + "%");
} else if (weekMaxQueueLengthSituation == 0) {
resultResponseVO.setWeekMaxQueueLengthSituation("持平");
} else { } else {
resultResponseVO.setWeekMaxQueueLengthSituation("减少" + Math.abs(weekMaxQueueLengthSituation) + "%"); resultResponseVO.setWeekMaxQueueLengthSituation("减少" + Math.abs(weekMaxQueueLengthSituation) + "%");
} }
...@@ -1069,6 +1123,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -1069,6 +1123,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
} }
if (avgCapacityCompareSituation > 0) { if (avgCapacityCompareSituation > 0) {
analysisResponseVO.setAvgCapacityCompareSituation("提升" + avgCapacityCompareSituation + "%"); analysisResponseVO.setAvgCapacityCompareSituation("提升" + avgCapacityCompareSituation + "%");
} else if (avgCapacityCompareSituation == 0) {
analysisResponseVO.setAvgCapacityCompareSituation("持平");
} else { } else {
analysisResponseVO.setAvgCapacityCompareSituation("降低" + Math.abs(avgCapacityCompareSituation) + "%"); analysisResponseVO.setAvgCapacityCompareSituation("降低" + Math.abs(avgCapacityCompareSituation) + "%");
} }
...@@ -1084,6 +1140,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -1084,6 +1140,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
} }
if (delayTimeCompare > 0) { if (delayTimeCompare > 0) {
analysisResponseVO.setDelayTimeCompare("增加" + delayTimeCompare + "%"); analysisResponseVO.setDelayTimeCompare("增加" + delayTimeCompare + "%");
} else if (delayTimeCompare == 0) {
analysisResponseVO.setDelayTimeCompare("持平");
} else { } else {
analysisResponseVO.setDelayTimeCompare("减少" + Math.abs(delayTimeCompare) + "%"); analysisResponseVO.setDelayTimeCompare("减少" + Math.abs(delayTimeCompare) + "%");
} }
...@@ -1099,6 +1157,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -1099,6 +1157,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
} }
if (avgStopTimesCompare > 0) { if (avgStopTimesCompare > 0) {
analysisResponseVO.setAvgStopTimesCompare("增加" + avgStopTimesCompare + "%"); analysisResponseVO.setAvgStopTimesCompare("增加" + avgStopTimesCompare + "%");
} else if (avgStopTimesCompare == 0) {
analysisResponseVO.setAvgStopTimesCompare("持平");
} else { } else {
analysisResponseVO.setAvgStopTimesCompare("减少" + Math.abs(avgStopTimesCompare) + "%"); analysisResponseVO.setAvgStopTimesCompare("减少" + Math.abs(avgStopTimesCompare) + "%");
} }
...@@ -1114,6 +1174,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService { ...@@ -1114,6 +1174,8 @@ public class CrossRidLaneServiceImpl implements CrossRidLaneService {
} }
if (maxQueueLengthCompare > 0) { if (maxQueueLengthCompare > 0) {
analysisResponseVO.setMaxQueueLengthCompare("提升" + maxQueueLengthCompare + "%"); analysisResponseVO.setMaxQueueLengthCompare("提升" + maxQueueLengthCompare + "%");
} else if (maxQueueLengthCompare == 0) {
analysisResponseVO.setMaxQueueLengthCompare("持平");
} else { } else {
analysisResponseVO.setMaxQueueLengthCompare("降低" + Math.abs(maxQueueLengthCompare) + "%"); analysisResponseVO.setMaxQueueLengthCompare("降低" + Math.abs(maxQueueLengthCompare) + "%");
} }
......
...@@ -54,7 +54,12 @@ public class GreenWaveCrossRidServiceImpl implements GreenWaveCrossRidService { ...@@ -54,7 +54,12 @@ public class GreenWaveCrossRidServiceImpl implements GreenWaveCrossRidService {
String[] dirs = greenDir.split(","); String[] dirs = greenDir.split(",");
String content = StrUtil.format("{}{}走向",CrossDirEnum.getDesc(Integer.valueOf(dirs[0])),CrossDirEnum.getDesc(Integer.valueOf(dirs[1]))) ; String content = StrUtil.format("{}{}走向",CrossDirEnum.getDesc(Integer.valueOf(dirs[0])),CrossDirEnum.getDesc(Integer.valueOf(dirs[1]))) ;
GreenWaveCrossRidInfoVO greenWaveCrossRidInfoVO = new GreenWaveCrossRidInfoVO(); GreenWaveCrossRidInfoVO greenWaveCrossRidInfoVO = new GreenWaveCrossRidInfoVO();
GreenWaveCrossRidInfo greenWaveCrossRidInfo = greenWaveCrossRidInfoList.get(1); GreenWaveCrossRidInfo greenWaveCrossRidInfo = greenWaveCrossRidInfoList.get(0);
for (GreenWaveCrossRidInfo waveCrossRidInfo : greenWaveCrossRidInfoList) {
if(waveCrossRidInfo.getIsKeyRoute() == 1){
greenWaveCrossRidInfo = waveCrossRidInfo;
}
}
BeanUtils.copyProperties(greenWaveCrossRidInfo,greenWaveCrossRidInfoVO); BeanUtils.copyProperties(greenWaveCrossRidInfo,greenWaveCrossRidInfoVO);
greenWaveCrossRidInfoVO.setGreenDirName(content); greenWaveCrossRidInfoVO.setGreenDirName(content);
greenWaveCrossRidInfoVO.setLevelName(RoadLevelEnum.getDesc(greenWaveCrossRidInfo.getLevel())); greenWaveCrossRidInfoVO.setLevelName(RoadLevelEnum.getDesc(greenWaveCrossRidInfo.getLevel()));
......
...@@ -306,7 +306,7 @@ public class GreenWaveWeekDataServiceImpl extends ServiceImpl<GreenWaveWeekDataM ...@@ -306,7 +306,7 @@ public class GreenWaveWeekDataServiceImpl extends ServiceImpl<GreenWaveWeekDataM
double avgCongestDuration = greenWaveWeekDataVO.getAvgCongestDuration() / list.size(); double avgCongestDuration = greenWaveWeekDataVO.getAvgCongestDuration() / list.size();
greenWaveWeekDataVO.setCongestIndex(Math.round(congestIndex*100.0)/100.0); greenWaveWeekDataVO.setCongestIndex(Math.round(congestIndex*100.0)/100.0);
greenWaveWeekDataVO.setMaxCongestIndex(Math.round(maxCongestIndex*100.0)/100.0); greenWaveWeekDataVO.setMaxCongestIndex(Math.round(maxCongestIndex*100.0)/100.0);
greenWaveWeekDataVO.setCongestCount(Math.round(congestCount)*1.0); // greenWaveWeekDataVO.setCongestCount(Math.round(congestCount)*1.0);
greenWaveWeekDataVO.setCongestDuration(Math.round(congestDuration*100.0)/100.0); greenWaveWeekDataVO.setCongestDuration(Math.round(congestDuration*100.0)/100.0);
greenWaveWeekDataVO.setMaxCongestDuration(Math.round(maxCongestDuration*100.0)/100.0); greenWaveWeekDataVO.setMaxCongestDuration(Math.round(maxCongestDuration*100.0)/100.0);
greenWaveWeekDataVO.setAvgCongestDuration(Math.round(avgCongestDuration*100.0)/100.0); greenWaveWeekDataVO.setAvgCongestDuration(Math.round(avgCongestDuration*100.0)/100.0);
...@@ -316,7 +316,7 @@ public class GreenWaveWeekDataServiceImpl extends ServiceImpl<GreenWaveWeekDataM ...@@ -316,7 +316,7 @@ public class GreenWaveWeekDataServiceImpl extends ServiceImpl<GreenWaveWeekDataM
greenWaveWeekDataVO.setGreenRoadType(RoadLevelEnum.getDesc(greenInfoList.get(0).getLevel())); greenWaveWeekDataVO.setGreenRoadType(RoadLevelEnum.getDesc(greenInfoList.get(0).getLevel()));
greenWaveWeekDataVOList.add(greenWaveWeekDataVO); greenWaveWeekDataVOList.add(greenWaveWeekDataVO);
} }
List<GreenWaveWeekDataVO> collect = greenWaveWeekDataVOList.stream().sorted(Comparator.comparingDouble(GreenWaveWeekDataVO::getCongestCount).reversed()).collect(Collectors.toList()); List<GreenWaveWeekDataVO> collect = greenWaveWeekDataVOList.stream().sorted(Comparator.comparingDouble(GreenWaveWeekDataVO::getCongestIndex).reversed()).collect(Collectors.toList());
collect.forEach(x->{ collect.forEach(x->{
x.setRank(collect.indexOf(x)+1); x.setRank(collect.indexOf(x)+1);
}); });
...@@ -359,24 +359,24 @@ public class GreenWaveWeekDataServiceImpl extends ServiceImpl<GreenWaveWeekDataM ...@@ -359,24 +359,24 @@ public class GreenWaveWeekDataServiceImpl extends ServiceImpl<GreenWaveWeekDataM
greenReportSamePeriodData.setPeakFlow(greenWaveWeekData.getFlow()); greenReportSamePeriodData.setPeakFlow(greenWaveWeekData.getFlow());
greenReportSamePeriodData.setCongestIndex(Math.round(greenWaveWeekData.getCongestIndex()*100)/100.0); greenReportSamePeriodData.setCongestIndex(Math.round(greenWaveWeekData.getCongestIndex()*100)/100.0);
greenReportSamePeriodData.setAvgSpeed(Math.round(greenWaveWeekData.getSpeed()*100)/100.0); greenReportSamePeriodData.setAvgSpeed(Math.round(greenWaveWeekData.getSpeed()*100)/100.0);
greenReportSamePeriodData.setTravelTime(Double.valueOf(greenWaveWeekData.getTravelTime())); greenReportSamePeriodData.setTravelTime(Math.round(greenWaveWeekData.getTravelTime()*100/60.0)/100.0);
double speed = greenWaveWeekData.getSpeed() - waveWeekData.getSpeed(); double speed = greenWaveWeekData.getSpeed() - waveWeekData.getSpeed();
double flow = greenWaveWeekData.getFlow() - waveWeekData.getFlow(); double flow = greenWaveWeekData.getFlow() - waveWeekData.getFlow();
double travelTime = greenWaveWeekData.getTravelTime() - waveWeekData.getTravelTime(); double travelTime = greenWaveWeekData.getTravelTime() - waveWeekData.getTravelTime();
double congestIndex = greenWaveWeekData.getCongestIndex() - waveWeekData.getCongestIndex(); double congestIndex = greenWaveWeekData.getCongestIndex() - waveWeekData.getCongestIndex();
if(flow<0){ if(flow<0){
samePeriodData.setAmPeakSituation("减"); samePeriodData.setAmPeakSituation("减");
}else if(flow == 0){ }else if(flow == 0){
samePeriodData.setAmPeakSituation("相等"); samePeriodData.setAmPeakSituation("相等");
}else { }else {
samePeriodData.setAmPeakSituation("增加"); samePeriodData.setAmPeakSituation("增加");
} }
if(travelTime<0){ if(travelTime<0){
samePeriodData.setAmTravelTimeSituation("减少"); samePeriodData.setAmTravelTimeSituation("减少"+Math.abs(travelTime)+"s");
}else if(travelTime == 0){ }else if(travelTime == 0){
samePeriodData.setAmTravelTimeSituation("相等"); samePeriodData.setAmTravelTimeSituation("相等");
}else { }else {
samePeriodData.setAmTravelTimeSituation("增加"); samePeriodData.setAmTravelTimeSituation("增加"+Math.abs(travelTime)+"s");
} }
if(waveWeekData.getSpeed()!=0){ if(waveWeekData.getSpeed()!=0){
greenReportSamePeriodData.setAvgSpeedRatio(Math.round((speed/waveWeekData.getSpeed()*10000))/100.0); greenReportSamePeriodData.setAvgSpeedRatio(Math.round((speed/waveWeekData.getSpeed()*10000))/100.0);
...@@ -413,20 +413,20 @@ public class GreenWaveWeekDataServiceImpl extends ServiceImpl<GreenWaveWeekDataM ...@@ -413,20 +413,20 @@ public class GreenWaveWeekDataServiceImpl extends ServiceImpl<GreenWaveWeekDataM
greenReportSamePeriodData.setPeakFlow(greenWaveWeekData.getFlow()); greenReportSamePeriodData.setPeakFlow(greenWaveWeekData.getFlow());
greenReportSamePeriodData.setCongestIndex(Math.round(greenWaveWeekData.getCongestIndex()*100)/100.0); greenReportSamePeriodData.setCongestIndex(Math.round(greenWaveWeekData.getCongestIndex()*100)/100.0);
greenReportSamePeriodData.setAvgSpeed(Math.round(greenWaveWeekData.getSpeed()*100)/100.0); greenReportSamePeriodData.setAvgSpeed(Math.round(greenWaveWeekData.getSpeed()*100)/100.0);
greenReportSamePeriodData.setTravelTime(Double.valueOf(greenWaveWeekData.getTravelTime())); greenReportSamePeriodData.setTravelTime(Math.round(greenWaveWeekData.getTravelTime()*100/60.0)/100.0);
double speed = greenWaveWeekData.getSpeed() - waveWeekData.getSpeed(); double speed = greenWaveWeekData.getSpeed() - waveWeekData.getSpeed();
double flow = greenWaveWeekData.getFlow() - waveWeekData.getFlow(); double flow = greenWaveWeekData.getFlow() - waveWeekData.getFlow();
double travelTime = greenWaveWeekData.getTravelTime() - waveWeekData.getTravelTime(); double travelTime = greenWaveWeekData.getTravelTime() - waveWeekData.getTravelTime();
double congestIndex = greenWaveWeekData.getCongestIndex() - waveWeekData.getCongestIndex(); double congestIndex = greenWaveWeekData.getCongestIndex() - waveWeekData.getCongestIndex();
if(flow<0){ if(flow<0){
samePeriodData.setPmPeakSituation("减"); samePeriodData.setPmPeakSituation("减");
}else if(flow == 0){ }else if(flow == 0){
samePeriodData.setPmPeakSituation("相等"); samePeriodData.setPmPeakSituation("相等");
}else { }else {
samePeriodData.setPmPeakSituation("增加"); samePeriodData.setPmPeakSituation("增加");
} }
if(travelTime<0){ if(travelTime<0){
samePeriodData.setPmTravelTimeSituation("减少"); samePeriodData.setPmTravelTimeSituation("减少"+Math.abs(travelTime)+"s");
}else if(travelTime == 0){ }else if(travelTime == 0){
samePeriodData.setPmTravelTimeSituation("相等"); samePeriodData.setPmTravelTimeSituation("相等");
}else { }else {
...@@ -467,7 +467,7 @@ public class GreenWaveWeekDataServiceImpl extends ServiceImpl<GreenWaveWeekDataM ...@@ -467,7 +467,7 @@ public class GreenWaveWeekDataServiceImpl extends ServiceImpl<GreenWaveWeekDataM
greenReportSamePeriodData.setPeakFlow(greenWaveWeekData.getFlow()); greenReportSamePeriodData.setPeakFlow(greenWaveWeekData.getFlow());
greenReportSamePeriodData.setCongestIndex(Math.round(greenWaveWeekData.getCongestIndex()*100)/100.0); greenReportSamePeriodData.setCongestIndex(Math.round(greenWaveWeekData.getCongestIndex()*100)/100.0);
greenReportSamePeriodData.setAvgSpeed(Math.round(greenWaveWeekData.getSpeed()*100)/100.0); greenReportSamePeriodData.setAvgSpeed(Math.round(greenWaveWeekData.getSpeed()*100)/100.0);
greenReportSamePeriodData.setTravelTime(Double.valueOf(greenWaveWeekData.getTravelTime())); greenReportSamePeriodData.setTravelTime(Math.round(greenWaveWeekData.getTravelTime()*100/60.0)/100.0);
double speed = greenWaveWeekData.getSpeed() - waveWeekData.getSpeed(); double speed = greenWaveWeekData.getSpeed() - waveWeekData.getSpeed();
double flow = greenWaveWeekData.getFlow() - waveWeekData.getFlow(); double flow = greenWaveWeekData.getFlow() - waveWeekData.getFlow();
double travelTime = greenWaveWeekData.getTravelTime() - waveWeekData.getTravelTime(); double travelTime = greenWaveWeekData.getTravelTime() - waveWeekData.getTravelTime();
......
package net.wanji.opt.servicev2.strategy; package net.wanji.opt.servicev2.strategy;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException;
import io.swagger.models.auth.In;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.entity.strategy.StrategyParameterConfig; import net.wanji.opt.entity.strategy.StrategyParameterConfig;
import net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo; import net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage; import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroupVO;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroup;
import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity; import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* <p> * <p>
...@@ -33,16 +27,23 @@ public interface StrategyPriorityService extends IService<StrategyPriorityDailyI ...@@ -33,16 +27,23 @@ public interface StrategyPriorityService extends IService<StrategyPriorityDailyI
List<StrategyFactoryEntity> getCompanyList(); List<StrategyFactoryEntity> getCompanyList();
void savePriority(List<StrategyPriorityGroup> dataList) throws Exception; void savePriority(List<StrategyPriorityGroupVO> dataList) throws Exception;
/**
* 删除优先级配置表中策略
* @param dataList
* @throws Exception
*/
void deletePriorityConfigList(List<StrategyPriorityGroupVO> dataList) throws Exception;
List<StrategyFactoryEntity> getPriorityData(String crossId,Integer greenId, Integer type) throws Exception; List<StrategyFactoryEntity> getPriorityData(String crossId,Integer greenId, Integer type) throws Exception;
void savePlanConfig(List<StrategyPriorityGroup> dailyPlanDetails) throws Exception; void savePlanConfig(List<StrategyPriorityGroupVO> dailyPlanDetails) throws Exception;
List<StrategyPriorityDailyInfo> getPlanConfigData(String crossId, Integer greenId,Integer type); List<StrategyPriorityDailyInfo> getPlanConfigData(String crossId, Integer greenId,Integer type);
void saveParamterConfig(StrategyPriorityGroup strategyPriorityGroup) throws Exception; void saveParamterConfig(StrategyPriorityGroupVO strategyPriorityGroupVO) throws Exception;
List<StrategyParameterConfig> getParamConfigData(String crossId,Integer greenId, Integer type,String strategyNo); List<StrategyParameterConfig> getParamConfigData(String crossId,Integer greenId, Integer type,String strategyNo);
......
...@@ -6,9 +6,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -6,9 +6,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.wanji.common.utils.tool.StringUtils; import net.wanji.common.utils.tool.StringUtils;
import net.wanji.opt.common.exception.OptServiceException;
import net.wanji.opt.dao.mapper.strategy.StrategyPriorityMapper; import net.wanji.opt.dao.mapper.strategy.StrategyPriorityMapper;
import net.wanji.opt.entity.strategy.*; import net.wanji.opt.entity.strategy.*;
import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroup; import net.wanji.opt.entity.strategy.dto.StrategyPriorityGroupVO;
import net.wanji.opt.servicev2.strategy.StrategyPriorityService; import net.wanji.opt.servicev2.strategy.StrategyPriorityService;
import net.wanji.opt.synthesis.pojo.Result; import net.wanji.opt.synthesis.pojo.Result;
import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity; import net.wanji.opt.synthesis.pojo.StrategyFactoryEntity;
...@@ -89,20 +90,23 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -89,20 +90,23 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
return strategyList; return strategyList;
} }
/* /**
* 策略优先级保存 路口 干线共用 * 策略优先级保存 路口 干线共用
* */ *
* @param dataList
* @throws Exception
*/
@Override @Override
@Transactional @Transactional
public void savePriority(List<StrategyPriorityGroup> dataList) throws Exception { public void savePriority(List<StrategyPriorityGroupVO> dataList) throws Exception {
try { try {
List<StrategyPriorityConfig> saveList = new ArrayList<>(); List<StrategyPriorityConfig> saveList = new ArrayList<>();
for (StrategyPriorityGroup group : dataList) { for (StrategyPriorityGroupVO group : dataList) {
//Type : 1;路口2:干线 //Type : 1;路口2:干线
Integer typePd = group.getType(); Integer typePd = group.getType();
if (typePd == 1) { if (typePd == 1) {
String label = group.getLabel(); String groupName = group.getGroupName();
Integer labelCode = group.getLabelCode(); Integer groupId = group.getGroupId();
//1;路口2干线 //1;路口2干线
Integer type = group.getType(); Integer type = group.getType();
//路口id //路口id
...@@ -120,9 +124,9 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -120,9 +124,9 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
StrategyPriorityConfig strategyPriorityConfig = new StrategyPriorityConfig(); StrategyPriorityConfig strategyPriorityConfig = new StrategyPriorityConfig();
strategyPriorityConfig.setCrossId(crossId); strategyPriorityConfig.setCrossId(crossId);
//分组id //分组id
strategyPriorityConfig.setGroupId(labelCode); strategyPriorityConfig.setGroupId(groupId);
//分组名称 //分组名称
strategyPriorityConfig.setGroupName(label); strategyPriorityConfig.setGroupName(groupName);
//策略编号 //策略编号
strategyPriorityConfig.setStrategyNo(item.getStrategyNo()); strategyPriorityConfig.setStrategyNo(item.getStrategyNo());
//优先级 //优先级
...@@ -134,8 +138,8 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -134,8 +138,8 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
} }
} }
} else if (typePd == 2) { } else if (typePd == 2) {
String label = group.getLabel(); String label = group.getGroupName();
Integer labelCode = group.getLabelCode(); Integer labelCode = group.getGroupId();
//1;路口2干线 //1;路口2干线
Integer type = group.getType(); Integer type = group.getType();
//干线id //干线id
...@@ -183,6 +187,44 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -183,6 +187,44 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
} }
} }
@Override
@Transactional(rollbackFor = RuntimeException.class)
public void deletePriorityConfigList(List<StrategyPriorityGroupVO> dataList) throws Exception {
if (CollectionUtils.isNotEmpty(dataList)) {
for (StrategyPriorityGroupVO strategyPriorityGroupVO : dataList) {
Integer groupId = strategyPriorityGroupVO.getGroupId();
List<StrategyPriorityConfig> priorityConfigs = strategyPriorityGroupVO.getData();
List<String> crossIds = strategyPriorityGroupVO.getCrossIds();
String crossId = null;
if (CollectionUtils.isNotEmpty(crossIds)) {
crossId = crossIds.get(0);
}
List<Integer> greenIds = strategyPriorityGroupVO.getGreenIds();
Integer greenId = null;
if (CollectionUtils.isNotEmpty(greenIds)) {
greenId = greenIds.get(0);
}
// 当全部删除时,1.校验日计划中是否有使用;2.并且删除数量=数据库中数量
List<StrategyPriorityConfig> data4DB = strategyPriorityMapper.selectCrossGroupStrategyPriorityList(crossId, greenId, groupId);
List<StrategyPriorityDailyInfo> dailyInfos = strategyPriorityMapper.selectCrossGreenGroupDailyPlanList(crossId, greenId, groupId);
if (CollectionUtils.isEmpty(data4DB)) {
return;
}
if (CollectionUtils.isNotEmpty(dailyInfos) && data4DB.size() <= priorityConfigs.size()) {
throw new OptServiceException("日计划中已使用当前分组: " + groupId + " 不能清空!");
}
// 删除路口编号分组下策略编号
if (CollectionUtils.isNotEmpty(priorityConfigs)) {
for (StrategyPriorityConfig priorityConfig : priorityConfigs) {
strategyPriorityMapper.deleteCrossGreenPriorityConfig(crossId, greenId, groupId, priorityConfig.getStrategyNo());
}
}
}
}
}
/* /*
* 策略优先级路口跟干线数据回显 * 策略优先级路口跟干线数据回显
* */ * */
...@@ -228,12 +270,12 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -228,12 +270,12 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
* */ * */
@Override @Override
@Transactional @Transactional
public void savePlanConfig(List<StrategyPriorityGroup> dailyPlanDetails) throws Exception { public void savePlanConfig(List<StrategyPriorityGroupVO> dailyPlanDetails) throws Exception {
try { try {
List<StrategyPriorityDailyInfo> savePlanList = new ArrayList<>(); List<StrategyPriorityDailyInfo> savePlanList = new ArrayList<>();
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
for (StrategyPriorityGroup group : dailyPlanDetails) { for (StrategyPriorityGroupVO group : dailyPlanDetails) {
//Type : 1;路口2:干线 //Type : 1;路口2:干线
Integer typePd = group.getType(); Integer typePd = group.getType();
if (typePd == 1) { if (typePd == 1) {
...@@ -260,6 +302,19 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -260,6 +302,19 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
//取出日计划详情 //取出日计划详情
List<StrategyPriorityPlanDetails> dailyPlanDetails1 = group.getDailyPlanDetails(); List<StrategyPriorityPlanDetails> dailyPlanDetails1 = group.getDailyPlanDetails();
if (CollectionUtils.isNotEmpty(dailyPlanDetails1)) {
dailyPlanDetails1.forEach(item -> {
StringBuilder sb = new StringBuilder();
List<StrategyFactoryEntity> factoryList = strategyPriorityMapper.selectCrossGroupStrategyList(crossId, null, item.getGroupId());
if (CollectionUtils.isNotEmpty(factoryList)) {
for (StrategyFactoryEntity factory : factoryList) {
sb.append(factory.getMethod()).append(",");
}
String content = sb.substring(0, sb.length() - 1);
item.setContent(content);
}
});
}
String dailyPlanDetailsJson = JSON.toJSONString(dailyPlanDetails1); String dailyPlanDetailsJson = JSON.toJSONString(dailyPlanDetails1);
strategyPriorityDailyInfo.setDailyPlanDetails(dailyPlanDetailsJson); strategyPriorityDailyInfo.setDailyPlanDetails(dailyPlanDetailsJson);
...@@ -289,6 +344,19 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -289,6 +344,19 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
//取出日计划详情 //取出日计划详情
List<StrategyPriorityPlanDetails> dailyPlanDetails1 = group.getDailyPlanDetails(); List<StrategyPriorityPlanDetails> dailyPlanDetails1 = group.getDailyPlanDetails();
if (CollectionUtils.isNotEmpty(dailyPlanDetails1)) {
dailyPlanDetails1.forEach(item -> {
StringBuilder sb = new StringBuilder();
List<StrategyFactoryEntity> factoryList = strategyPriorityMapper.selectCrossGroupStrategyList(null, greenId, item.getGroupId());
if (CollectionUtils.isNotEmpty(factoryList)) {
for (StrategyFactoryEntity factory : factoryList) {
sb.append(factory.getMethod()).append(",");
}
String content = sb.substring(0, sb.length() - 1);
item.setContent(content);
}
});
}
String dailyPlanDetailsJson = JSON.toJSONString(dailyPlanDetails1); String dailyPlanDetailsJson = JSON.toJSONString(dailyPlanDetails1);
strategyPriorityDailyInfo.setDailyPlanDetails(dailyPlanDetailsJson); strategyPriorityDailyInfo.setDailyPlanDetails(dailyPlanDetailsJson);
...@@ -338,7 +406,7 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -338,7 +406,7 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
* */ * */
@Override @Override
@Transactional @Transactional
public void saveParamterConfig(StrategyPriorityGroup group) throws Exception { public void saveParamterConfig(StrategyPriorityGroupVO group) throws Exception {
try { try {
List<StrategyParameterConfig> savePlanList = new ArrayList<>(); List<StrategyParameterConfig> savePlanList = new ArrayList<>();
...@@ -610,7 +678,7 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -610,7 +678,7 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
// return pushStrategyPriorityList; // return pushStrategyPriorityList;
// } // }
/*优先级配置神思推送*/ /*优先级配置神思推送*/
private List<StrategyPriorityConfigPush> pushStrategyPriorityConfig(List<StrategyPriorityGroup> dataList) { private List<StrategyPriorityConfigPush> pushStrategyPriorityConfig(List<StrategyPriorityGroupVO> dataList) {
// 最终优先级配置推送神思 // 最终优先级配置推送神思
List<StrategyPriorityConfigPush> pushStrategyPriorityList = new ArrayList<>(); List<StrategyPriorityConfigPush> pushStrategyPriorityList = new ArrayList<>();
...@@ -618,7 +686,7 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -618,7 +686,7 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
StrategyPriorityConfigPush strategyPriorityConfigPush = new StrategyPriorityConfigPush(); StrategyPriorityConfigPush strategyPriorityConfigPush = new StrategyPriorityConfigPush();
// 分组详情列表 // 分组详情列表
List<GroupIdDetails> groupIdDetailsList = new ArrayList<>(); List<GroupIdDetails> groupIdDetailsList = new ArrayList<>();
for (StrategyPriorityGroup group : dataList) { for (StrategyPriorityGroupVO group : dataList) {
// 设置基本信息 // 设置基本信息
Integer type = group.getType(); Integer type = group.getType();
...@@ -636,8 +704,8 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -636,8 +704,8 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
GroupIdDetails groupIdDetails = new GroupIdDetails(); GroupIdDetails groupIdDetails = new GroupIdDetails();
// 设置分组名称和编号 // 设置分组名称和编号
groupIdDetails.setGroupName(group.getLabel()); groupIdDetails.setGroupName(group.getGroupName());
groupIdDetails.setGroupId(group.getLabelCode()); groupIdDetails.setGroupId(group.getGroupId());
// 创建一个临时列表,用于存储所有策略详情数据 // 创建一个临时列表,用于存储所有策略详情数据
List<StrategyPriorityDetailsPush> detailsList = new ArrayList<>(); List<StrategyPriorityDetailsPush> detailsList = new ArrayList<>();
...@@ -678,14 +746,14 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -678,14 +746,14 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
} }
/*日计划配置神思推送*/ /*日计划配置神思推送*/
private List<StrategyPriorityPlanPush> pushStrategyPriorityPlan(List<StrategyPriorityGroup> dailyPlanDetails) { private List<StrategyPriorityPlanPush> pushStrategyPriorityPlan(List<StrategyPriorityGroupVO> dailyPlanDetails) {
//日计划推送到神思 //日计划推送到神思
List<StrategyPriorityPlanPush> strategyPriorityPlanPushList = new ArrayList<>(); List<StrategyPriorityPlanPush> strategyPriorityPlanPushList = new ArrayList<>();
StrategyPriorityPlanPush strategyPriorityPlanPush = new StrategyPriorityPlanPush(); StrategyPriorityPlanPush strategyPriorityPlanPush = new StrategyPriorityPlanPush();
// //
List<DailyPlanDetails> dailyPlanDetailsList = new ArrayList<>(); List<DailyPlanDetails> dailyPlanDetailsList = new ArrayList<>();
for (StrategyPriorityGroup group : dailyPlanDetails) { for (StrategyPriorityGroupVO group : dailyPlanDetails) {
Integer type = group.getType(); Integer type = group.getType();
strategyPriorityPlanPush.setType(type); strategyPriorityPlanPush.setType(type);
...@@ -742,7 +810,7 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap ...@@ -742,7 +810,7 @@ public class StrategyPriorityServiceImpl extends ServiceImpl<StrategyPriorityMap
} }
/*参数配置神思推送*/ /*参数配置神思推送*/
private List<StrategyParameterPush> pushStrategyPriorityParam(StrategyPriorityGroup group) { private List<StrategyParameterPush> pushStrategyPriorityParam(StrategyPriorityGroupVO group) {
List<StrategyParameterPush> StrategyParameterPushList = new ArrayList<>(); List<StrategyParameterPush> StrategyParameterPushList = new ArrayList<>();
//推送神思接口 //推送神思接口
StrategyParameterPush strategyParameterPush = new StrategyParameterPush(); StrategyParameterPush strategyParameterPush = new StrategyParameterPush();
......
...@@ -61,10 +61,10 @@ public class StrategyFactoryEntity { ...@@ -61,10 +61,10 @@ public class StrategyFactoryEntity {
* 分组名称 * 分组名称
*/ */
@TableField(exist = false) @TableField(exist = false)
private String label; private String groupName;
/** /**
* 分组ID * 分组ID
*/ */
@TableField(exist = false) @TableField(exist = false)
private Integer labelCode; private Integer groupId;
} }
package net.wanji.opt.vo2;
import lombok.Data;
@Data
public class LaneSturationInfo {
/**
* 路口ID
*/
private String crossId;
/**
* 方向
*/
private Integer dir;
/**
* 车道ID
*/
private String id;
/**
* 平均饱和度
*/
private Double sturation;
}
\ No newline at end of file
spring: spring:
profiles: profiles:
active: test active: test
logging:
level:
org.apache.ibatis: DEBUG
\ No newline at end of file
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
and a.cross_id = #{crossID} and a.cross_id = #{crossID}
and sign(a.rtn_type) = -1 and sign(a.rtn_type) = -1
and a.current_algo = 1 and a.current_algo = 1
and a.issue_time >= CURDATE() and a.dt = #{date}
union union
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
and a.cross_id = #{crossID} and a.cross_id = #{crossID}
and a.current_algo = 2 and a.current_algo = 2
and a.response_code = 200 and a.response_code = 200
and a.issue_time >= CURDATE() and a.dt = #{date}
union union
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
and a.cross_id = #{crossID} and a.cross_id = #{crossID}
and a.current_algo = 3 and a.current_algo = 3
and a.response_code = 200 and a.response_code = 200
and a.issue_time >= CURDATE() and a.dt = #{date}
) b ) b
order by b.issue_time order by b.issue_time
</select> </select>
......
...@@ -317,7 +317,7 @@ ...@@ -317,7 +317,7 @@
select t1.id, t1.name, t1.wkt, t2.type, ifnull(t2.count, 0) as count, ifnull(t2.duration, 0) as duration, select t1.id, t1.name, t1.wkt, t2.type, ifnull(t2.count, 0) as count, ifnull(t2.duration, 0) as duration,
case when t2.type = '705' then '缓行次数' case when t2.type = '705' then '缓行次数'
when t2.type = '706' then '拥堵次数' when t2.type = '706' then '拥堵次数'
end as typeDesc end as typeDesc, t1.green_dir, t1.start_time
from from
t_greenwave_info t1 t_greenwave_info t1
left join ( left join (
......
...@@ -39,13 +39,15 @@ ...@@ -39,13 +39,15 @@
<!-- 用于方案信号评价-路口优化记录查询(包含当日数据) --> <!-- 用于方案信号评价-路口优化记录查询(包含当日数据) -->
<select id="selectCrossOptimize" parameterType="map" resultType="net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo"> <select id="selectCrossOptimize" parameterType="map" resultType="net.wanji.opt.entity.eventoptimize.TEventOptimizeInfo">
SELECT SELECT
cross_id, a.cross_id,
current_algo AS event_type, a.current_algo AS event_type,
issue_time AS opt_start_time, a.issue_time AS opt_start_time,
duration AS opt_duration, a.duration AS opt_duration,
DATE_ADD( issue_time, INTERVAL duration SECOND ) AS opt_end_time DATE_ADD( issue_time, INTERVAL a.duration SECOND ) AS opt_end_time,
(case when current_algo=1 then concat('[',empty_dir,']') else b.dir end) dir
FROM FROM
t_strategy_cross_result t_strategy_cross_result a
left join t_event_info b on a.event_id=b.event_serial_number
WHERE WHERE
1=1 1=1
<if test="startTime != null and endTime != null"> <if test="startTime != null and endTime != null">
...@@ -53,7 +55,7 @@ ...@@ -53,7 +55,7 @@
AND issue_time &lt; #{endTime} AND issue_time &lt; #{endTime}
</if> </if>
<if test="crossId != null" > <if test="crossId != null" >
AND cross_id = #{crossId} AND a.cross_id = #{crossId}
</if> </if>
AND response_code = 200 AND response_code = 200
</select> </select>
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<if test="areaId != null and areaId != ''"> <if test="areaId != null and areaId != ''">
and tapcd.area_id = #{areaId} and tapcd.area_id = #{areaId}
</if> </if>
and tapcd.event_type != 708
GROUP BY tapcd.event_type GROUP BY tapcd.event_type
union union
SELECT sum(event_number) as event_number, SELECT sum(event_number) as event_number,
...@@ -53,6 +54,7 @@ ...@@ -53,6 +54,7 @@
<if test="areaId != null and areaId != ''"> <if test="areaId != null and areaId != ''">
and t1.area_id = #{areaId} and t1.area_id = #{areaId}
</if> </if>
and t1.event_type != 708
GROUP BY dt, t1.event_type GROUP BY dt, t1.event_type
UNION UNION
SELECT SELECT
......
...@@ -321,6 +321,7 @@ ...@@ -321,6 +321,7 @@
<if test="crossId!=null and crossId!=''"> <if test="crossId!=null and crossId!=''">
and tapcd.cross_id = #{crossId} and tapcd.cross_id = #{crossId}
</if> </if>
and tapcd.event_type != 708
GROUP BY tapcd.event_type GROUP BY tapcd.event_type
</select> </select>
...@@ -341,6 +342,7 @@ ...@@ -341,6 +342,7 @@
<if test="crossId != null and crossId != ''"> <if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId} and t1.cross_id = #{crossId}
</if> </if>
and t1.event_type != 708
GROUP BY dt, t1.event_type GROUP BY dt, t1.event_type
ORDER BY dt ORDER BY dt
</select> </select>
...@@ -389,4 +391,52 @@ ...@@ -389,4 +391,52 @@
</select> </select>
<select id="getGreenStopTimeAvg" resultType="java.lang.Double">
select COALESCE(AVG(stop_times), 0) stop_time from t_greenwave_hist
where 1=1
<if test="greenId != null">
green_id = #{greenId}
</if>
<if test="startTime != null and endTime != null">
and start_time BETWEEN #{startTime} AND #{endTime}
</if>
and status in (3,4)
</select>
<select id="getGreenStopTimeSum" resultType="java.lang.Double">
select COALESCE(sum(stop_times), 0) stop_time from t_greenwave_hist
where 1=1
<if test="greenId != null">
green_id = #{greenId}
</if>
<if test="startTime != null and endTime != null">
and start_time BETWEEN #{startTime} AND #{endTime}
</if>
and status in (3,4)
</select>
<select id="getGreenSlowStopTimeSum" resultType="java.lang.Double">
select COALESCE(sum(stop_times), 0) stop_time from t_greenwave_hist
where 1=1
<if test="greenId != null">
green_id = #{greenId}
</if>
<if test="startTime != null and endTime != null">
and start_time BETWEEN #{startTime} AND #{endTime}
</if>
and status = 2
</select>
<select id="getSturationInfoList" resultType="net.wanji.opt.vo2.LaneSturationInfo">
SELECT a.cross_id,a.dir,a.id,avg(b.sturation) sturation
from t_base_lane_info a
LEFT JOIN
(
SELECT id,sturation from t_lane_data_hist
where cross_id = #{crossId} and start_time BETWEEN #{startTime} AND #{endTime}
) b
on a.id=b.id
where a.cross_id = #{crossId} and a.type=2
GROUP BY a.cross_id,a.dir,a.id
</select>
</mapper> </mapper>
...@@ -13,14 +13,17 @@ ...@@ -13,14 +13,17 @@
b.dir as dir, b.dir as dir,
b.turn as turn, b.turn as turn,
c.name AS lane_name, c.name AS lane_name,
b.type as lane_type,
c.out_dir as out_dir, c.out_dir as out_dir,
c.in_dir as in_dir c.in_dir as in_dir,
c.start_cross_id,
c.end_cross_id
FROM FROM
t_base_cross_info AS a t_base_cross_info AS a
LEFT JOIN t_base_lane_info AS b ON a.id = b.cross_id LEFT JOIN t_base_rid_info AS c ON a.id = c.start_cross_id or a.id = c.end_cross_id
LEFT JOIN t_base_rid_info AS c ON b.rid = c.id LEFT JOIN t_base_lane_info AS b ON b.rid = c.id
WHERE WHERE
a.is_signal = 1 and b.type = 2 a.is_signal = 1
<if test="crossIdList != null"> <if test="crossIdList != null">
and a.id in and a.id in
<foreach collection="crossIdList" item="crossId" open="(" close=")" separator=","> <foreach collection="crossIdList" item="crossId" open="(" close=")" separator=",">
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.opt.dao.mapper.strategy.StrategyPriorityMapper"> <mapper namespace="net.wanji.opt.dao.mapper.strategy.StrategyPriorityMapper">
<!-- 通用设置 --> <!-- 通用设置 -->
<!-- 通用查询列 --> <!-- 通用查询列 -->
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, daily_plan_id, week_execute, daily_plan_details, cross_id id, daily_plan_id, week_execute, daily_plan_details, cross_id
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM t_strategy_priority_daily_info FROM t_strategy_priority_daily_info
WHERE 1=1 WHERE 1=1
<include refid="StrategyPriorityDailyInfoByCondition" /> <include refid="StrategyPriorityDailyInfoByCondition"/>
</select> </select>
<!-- 根据主键id删除表t_strategy_priority_daily_info信息 --> <!-- 根据主键id删除表t_strategy_priority_daily_info信息 -->
...@@ -84,7 +84,8 @@ ...@@ -84,7 +84,8 @@
</delete> </delete>
<!-- 根据主键id更新表t_strategy_priority_daily_info信息 --> <!-- 根据主键id更新表t_strategy_priority_daily_info信息 -->
<update id="updateStrategyPriorityDailyInfoByid" parameterType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo"> <update id="updateStrategyPriorityDailyInfoByid"
parameterType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
UPDATE t_strategy_priority_daily_info UPDATE t_strategy_priority_daily_info
<set> <set>
<include refid="StrategyPriorityDailyInfoSetColumns"/> <include refid="StrategyPriorityDailyInfoSetColumns"/>
...@@ -110,7 +111,8 @@ ...@@ -110,7 +111,8 @@
) )
</insert> </insert>
<select id="pageStrategyCrossList" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo"> <select id="pageStrategyCrossList" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
SELECT SELECT
DISTINCT DISTINCT
t4.`name` as waveName, t3.`name` as crossName, t4.`name` as waveName, t3.`name` as crossName,
...@@ -162,7 +164,8 @@ ...@@ -162,7 +164,8 @@
</insert> </insert>
<select id="selectPriorityTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityConfig"> <select id="selectPriorityTable" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityConfig">
select select
id,group_id,cross_id id,group_id,cross_id
FROM FROM
...@@ -179,11 +182,12 @@ ...@@ -179,11 +182,12 @@
WHERE cross_id =#{crossId} WHERE cross_id =#{crossId}
</delete> </delete>
<select id="getPriorityConfigData" parameterType="map" resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity"> <select id="getPriorityConfigData" parameterType="map"
resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity">
SELECT t2.status,t2.scene, SELECT t2.status,t2.scene,
t2.method,t2.strategy_name,t2.strategy_no, t2.method,t2.strategy_name,t2.strategy_no,
t2.mark,t2.company,t1.priority as priority,t1.id, t2.mark,t2.company,t1.priority as priority,t1.id,
t1.group_id as labelCode ,t1.group_name as label,t1.cross_id as crossId t1.group_id, t1.group_name, t1.cross_id as crossId
FROM FROM
t_strategy_priority_config t1 t_strategy_priority_config t1
LEFT JOIN t_strategy_factory_info t2 on t1.strategy_no=t2.strategy_no and t2.status='1' LEFT JOIN t_strategy_factory_info t2 on t1.strategy_no=t2.strategy_no and t2.status='1'
...@@ -200,7 +204,8 @@ ...@@ -200,7 +204,8 @@
AND t1.type=#{type} AND t1.type=#{type}
</if> </if>
</select> </select>
<select id="getGreenPriorityConfigData" parameterType="map" resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity"> <select id="getGreenPriorityConfigData" parameterType="map"
resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity">
SELECT t2.status, SELECT t2.status,
t2.method,t2.strategy_name,t2.strategy_no, t2.method,t2.strategy_name,t2.strategy_no,
t2.mark,t2.company,t1.priority as priority,t1.id, t2.mark,t2.company,t1.priority as priority,t1.id,
...@@ -251,7 +256,7 @@ ...@@ -251,7 +256,7 @@
</if> </if>
</select> </select>
<insert id="savePlanConfig" parameterType="java.util.List" > <insert id="savePlanConfig" parameterType="java.util.List">
INSERT INTO INSERT INTO
t_strategy_priority_daily_info (daily_plan_id,week_execute,daily_plan_details,cross_id,type,green_id) t_strategy_priority_daily_info (daily_plan_id,week_execute,daily_plan_details,cross_id,type,green_id)
VALUES VALUES
...@@ -259,7 +264,8 @@ ...@@ -259,7 +264,8 @@
(#{item.dailyPlanId},#{item.weekExecute},#{item.dailyPlanDetails},#{item.crossId},#{item.type},#{item.greenId}) (#{item.dailyPlanId},#{item.weekExecute},#{item.dailyPlanDetails},#{item.crossId},#{item.type},#{item.greenId})
</foreach> </foreach>
</insert> </insert>
<select id="selectPlanTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo"> <select id="selectPlanTable" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
select select
id,daily_plan_id,cross_id id,daily_plan_id,cross_id
FROM FROM
...@@ -270,7 +276,8 @@ ...@@ -270,7 +276,8 @@
and cross_id = #{crossId} and cross_id = #{crossId}
</if> </if>
</select> </select>
<select id="selectGreenPlanTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo"> <select id="selectGreenPlanTable" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
select select
id,daily_plan_id,cross_id id,daily_plan_id,cross_id
FROM FROM
...@@ -291,7 +298,8 @@ ...@@ -291,7 +298,8 @@
FROM t_strategy_priority_daily_info FROM t_strategy_priority_daily_info
WHERE green_id =#{greenId} WHERE green_id =#{greenId}
</delete> </delete>
<select id="getPlanConfigData" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo"> <select id="getPlanConfigData" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
SELECT SELECT
id,daily_plan_id,week_execute,daily_plan_details,cross_id id,daily_plan_id,week_execute,daily_plan_details,cross_id
FROM FROM
...@@ -305,7 +313,8 @@ ...@@ -305,7 +313,8 @@
and type = #{type} and type = #{type}
</if> </if>
</select> </select>
<select id="getGreenPlanConfigData" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo"> <select id="getGreenPlanConfigData" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
SELECT SELECT
id,daily_plan_id,week_execute,daily_plan_details,cross_id id,daily_plan_id,week_execute,daily_plan_details,cross_id
FROM FROM
...@@ -319,7 +328,8 @@ ...@@ -319,7 +328,8 @@
and type = #{type} and type = #{type}
</if> </if>
</select> </select>
<select id="paramterConfigTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig"> <select id="paramterConfigTable" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
SELECT SELECT
id,cross_id id,cross_id
FROM t_strategy_priority_parameter FROM t_strategy_priority_parameter
...@@ -329,7 +339,8 @@ ...@@ -329,7 +339,8 @@
AND cross_id =#{crossId} AND cross_id =#{crossId}
</if> </if>
</select> </select>
<select id="paramterGreenConfigTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig"> <select id="paramterGreenConfigTable" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
SELECT SELECT
id,cross_id id,cross_id
FROM t_strategy_priority_parameter FROM t_strategy_priority_parameter
...@@ -350,7 +361,7 @@ ...@@ -350,7 +361,7 @@
FROM t_strategy_priority_parameter FROM t_strategy_priority_parameter
WHERE green_id = #{greenId} WHERE green_id = #{greenId}
</delete> </delete>
<insert id="saveParamConfig" parameterType="list" > <insert id="saveParamConfig" parameterType="list">
INSERT INTO t_strategy_priority_parameter INSERT INTO t_strategy_priority_parameter
(cross_id,strategy_no,param_details,scheduling_param,type,green_id) (cross_id,strategy_no,param_details,scheduling_param,type,green_id)
VALUES VALUES
...@@ -359,14 +370,15 @@ ...@@ -359,14 +370,15 @@
</foreach> </foreach>
</insert> </insert>
<select id="getParamConfigData" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig"> <select id="getParamConfigData" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
SELECT SELECT
id,strategy_no,cross_id,param_details,scheduling_param,type id,strategy_no,cross_id,param_details,scheduling_param,type
FROM FROM
t_strategy_priority_parameter t_strategy_priority_parameter
WHERE WHERE
1=1 1=1
<if test="crossId!=null and crossId!=''" > <if test="crossId!=null and crossId!=''">
AND cross_id =#{crossId} AND cross_id =#{crossId}
</if> </if>
<if test="type!=null and type!=''"> <if test="type!=null and type!=''">
...@@ -377,7 +389,8 @@ ...@@ -377,7 +389,8 @@
</if> </if>
</select> </select>
<select id="getGreenParamConfigData" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig"> <select id="getGreenParamConfigData" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyParameterConfig">
SELECT SELECT
id,strategy_no,cross_id,param_details,type id,strategy_no,cross_id,param_details,type
FROM FROM
...@@ -395,7 +408,8 @@ ...@@ -395,7 +408,8 @@
</if> </if>
</select> </select>
<select id="getStrategyGreenWave" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo"> <select id="getStrategyGreenWave" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
SELECT t1.green_id as greenId, t4.name as waveName, t1.cross_id as crossId, SELECT t1.green_id as greenId, t4.name as waveName, t1.cross_id as crossId,
t3.name as crossName,t1.sort, t3.name as crossName,t1.sort,
t2.daily_plan_details as dailyPlanDetails t2.daily_plan_details as dailyPlanDetails
...@@ -404,7 +418,8 @@ ...@@ -404,7 +418,8 @@
LEFT JOIN t_strategy_priority_daily_info t2 on t1.green_id = t2.green_id and t2.type=2 LEFT JOIN t_strategy_priority_daily_info t2 on t1.green_id = t2.green_id and t2.type=2
LEFT JOIN t_base_cross_info t3 on t1.cross_id = t3.id LEFT JOIN t_base_cross_info t3 on t1.cross_id = t3.id
</select> </select>
<select id="selectGreenPriorityTable" parameterType="map" resultType="net.wanji.opt.entity.strategy.StrategyPriorityConfig"> <select id="selectGreenPriorityTable" parameterType="map"
resultType="net.wanji.opt.entity.strategy.StrategyPriorityConfig">
select select
id,group_id,cross_id id,group_id,cross_id
FROM FROM
...@@ -421,4 +436,78 @@ ...@@ -421,4 +436,78 @@
WHERE green_id =#{greenId} WHERE green_id =#{greenId}
</delete> </delete>
<!-- 通过路口或者绿波编号,分组编号查询分组中策略信息详情 -->
<select id="selectCrossGroupStrategyList" resultType="net.wanji.opt.synthesis.pojo.StrategyFactoryEntity">
select t2.type, t2.scene, t2.strategy_name, t2.strategy_no, t2.method, t2.company,
t2.mark, t2.status, t2.opt_type, t2.create_time, t2.modify_time
from t_strategy_priority_config t1
left join t_strategy_factory_info t2 on t1.strategy_no = t2.strategy_no
<where>
<if test="crossId != null and crossId != ''">
and t1.cross_id = #{crossId}
</if>
<if test="greenId!=null and greenId!=''">
and t1.green_id = #{greenId}
</if>
<if test="groupId != null and groupId != ''">
and t1.group_id = #{groupId}
</if>
order by t1.priority
</where>
</select>
<delete id="deleteCrossGreenPriorityConfig">
DELETE
FROM t_strategy_priority_config
<where>
<if test="crossId != null and crossId != ''">
and cross_id = #{crossId}
</if>
<if test="greenId!=null and greenId!=''">
and green_id = #{greenId}
</if>
<if test="groupId != null and groupId != ''">
and group_id = #{groupId}
</if>
<if test="strategyNo != null and strategyNo != ''">
and strategy_no = #{strategyNo}
</if>
</where>
</delete>
<!-- 通过路口或者绿波编号,分组编号查询日计划详情 -->
<select id="selectCrossGreenGroupDailyPlanList" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
select daily_plan_id, week_execute, daily_plan_details, cross_id, type, green_id, gmt_create
from t_strategy_priority_daily_info
<where>
<if test="crossId != null and crossId != ''">
and cross_id = #{crossId}
</if>
<if test="greenId!=null and greenId!=''">
and green_id = #{greenId}
</if>
<if test="groupId != null and groupId != ''">
and JSON_CONTAINS(JSON_EXTRACT(daily_plan_details, '$'), JSON_OBJECT('groupId', #{groupId}))
</if>
</where>
</select>
<!-- 通过路口或者绿波编号,分组编号查询策略优先级配置详情 -->
<select id="selectCrossGroupStrategyPriorityList" resultType="net.wanji.opt.entity.strategy.StrategyPriorityDailyInfo">
select group_id, group_name, priority, strategy_no, cross_id, green_id, type, gmt_create
from t_strategy_priority_config
<where>
<if test="crossId != null and crossId != ''">
and cross_id = #{crossId}
</if>
<if test="greenId!=null and greenId!=''">
and green_id = #{greenId}
</if>
<if test="groupId != null and groupId != ''">
and group_id = #{groupId}
</if>
</where>
</select>
</mapper> </mapper>
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