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 {
analysisGreenCongestionPeriodService.selectCountByCongestionPeriod();
analysisGreenCongestionPeriodService.selectCountByLandData(); try {
analysisGreenCongestionPeriodService.selectCountByCongestionPeriod();
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 {
analysisGreenCongestionPeriodService.selectCountByCrossDataOneDay();
try {
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() {
//执行检查路口id是否还有area_id没赋值的数据 try {
analysisProblemCrossDayServiceImpl.updateCrossAreaIdByCondition(); //执行检查路口id是否还有area_id没赋值的数据
//执行检查绿波id是否还有area_id没赋值的数据 analysisProblemCrossDayServiceImpl.updateCrossAreaIdByCondition();
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 {
List<AnalysisProblemGreenDay> list1 = analysisProblemGreenDayMapper.checkData(); //执行检查绿波id是否还有area_id没赋值的数据
if(list1.isEmpty()) nalysisProblemGreenDayServiceImpl.updateGreenAreaIdByCondition();
{ //检查昨日数据是否有统计
analysisProblemGreenDayMapper.insertAnalysisProblemGreenDay(); List<AnalysisProblemGreenDay> list1 = analysisProblemGreenDayMapper.checkData();
if (list1.isEmpty()) {
analysisProblemGreenDayMapper.insertAnalysisProblemGreenDay();
}
}catch (Exception e) {
log.error("干线问题天数据统计异常",e);
} }
} }
} }
...@@ -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>
...@@ -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();
analysisProblemCrossDayMapper.insertAnalysisProblemCrossDay(); long st = System.currentTimeMillis();
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
...@@ -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所有信息
*/ /**
List<StrategyPriorityDailyInfo> findAllStrategyPriorityDailyInfo(); * 查询表t_strategy_priority_daily_info所有信息
*/
/** List<StrategyPriorityDailyInfo> findAllStrategyPriorityDailyInfo();
* 根据主键id查询表t_strategy_priority_daily_info信息
* @param id /**
*/ * 根据主键id查询表t_strategy_priority_daily_info信息
StrategyPriorityDailyInfo findStrategyPriorityDailyInfoByid(@Param("id") Long id); *
* @param id
*/
StrategyPriorityDailyInfo findStrategyPriorityDailyInfoByid(@Param("id") Long id);
/**
* 根据条件查询表t_strategy_priority_daily_info信息
*
* @param strategyPriorityDailyInfo
*/
List<StrategyPriorityDailyInfo> findStrategyPriorityDailyInfoByCondition(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
/**
* 根据主键id查询表t_strategy_priority_daily_info信息
*
* @param id
*/
Integer deleteStrategyPriorityDailyInfoByid(@Param("id") Long id);
/**
* 根据主键id更新表t_strategy_priority_daily_info信息
*
* @param strategyPriorityDailyInfo
*/
Integer updateStrategyPriorityDailyInfoByid(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
/**
* 新增表t_strategy_priority_daily_info信息
*
* @param strategyPriorityDailyInfo
*/
Integer addStrategyPriorityDailyInfo(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
List<StrategyPriorityDailyInfo> pageStrategyCrossList();
/** List<StrategyFactoryEntity> getStrategyList();
* 根据条件查询表t_strategy_priority_daily_info信息
* @param strategyPriorityDailyInfo
*/
List<StrategyPriorityDailyInfo> findStrategyPriorityDailyInfoByCondition(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
/** List<StrategyFactoryEntity> getSceneList(Integer type);
* 根据主键id查询表t_strategy_priority_daily_info信息
* @param id
*/
Integer deleteStrategyPriorityDailyInfoByid(@Param("id") Long id);
/**
* 根据主键id更新表t_strategy_priority_daily_info信息
* @param strategyPriorityDailyInfo
*/
Integer updateStrategyPriorityDailyInfoByid(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
/**
* 新增表t_strategy_priority_daily_info信息
* @param strategyPriorityDailyInfo
*/
Integer addStrategyPriorityDailyInfo(StrategyPriorityDailyInfo strategyPriorityDailyInfo);
List<StrategyFactoryEntity> getCompanyList();
List<StrategyPriorityDailyInfo> pageStrategyCrossList();
void savePriorityInsert(List<StrategyPriorityConfig> saveList);
List<StrategyFactoryEntity> getStrategyList();
List<StrategyFactoryEntity> getSceneList(Integer type); List<StrategyPriorityConfig> selectPriorityTable(String crossId);
List<StrategyFactoryEntity> getCompanyList(); void deletePriorityConfig(String crossId);
void savePriorityInsert(List<StrategyPriorityConfig> saveList); 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<StrategyPriorityConfig> selectPriorityTable(String crossId); void savePlanConfig(@Param("savePlanList") List<StrategyPriorityDailyInfo> savePlanList);
void deletePriorityConfig(String crossId); List<StrategyPriorityDailyInfo> selectPlanTable(String crossId);
void deletePlanConfig(String crossId);
List<String> getstrategyNo(@Param("crossId") String crossId,@Param("type") Integer type); List<StrategyPriorityDailyInfo> getPlanConfigData(@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<StrategyParameterConfig> paramterConfigTable(String crossId);
void savePlanConfig(@Param("savePlanList") List<StrategyPriorityDailyInfo> savePlanList);
List<StrategyPriorityDailyInfo> selectPlanTable(String crossId); void deleteParamterConfig(String crossId);
void deletePlanConfig(String crossId); void saveParamConfig(@Param("savePlanList") List<StrategyParameterConfig> savePlanList);
List<StrategyParameterConfig> getParamConfigData(@Param("crossId") String crossId, @Param("type") Integer type, @Param("strategyNo") String strategyNo);
List<StrategyPriorityDailyInfo> getPlanConfigData(@Param("crossId") String crossId,@Param("type")Integer type); List<StrategyPriorityDailyInfo> getStrategyGreenWave();
List<StrategyParameterConfig> paramterConfigTable(String crossId); List<StrategyPriorityConfig> selectGreenPriorityTable(Integer greenId);
void deleteGreenPriorityConfig(Integer greenId);
void deleteParamterConfig(String crossId); List<String> getGreenstrategyNo(@Param("greenId") Integer greenId, @Param("type") Integer type);
void saveParamConfig(@Param("savePlanList") List<StrategyParameterConfig> savePlanList); List<StrategyFactoryEntity> getGreenPriorityConfigData(@Param("strategyNo") List<String> strategyNo, @Param("greenId") Integer greenId, @Param("type") Integer type);
List<StrategyParameterConfig> getParamConfigData(@Param("crossId") String crossId,@Param("type")Integer type,@Param("strategyNo") String strategyNo); List<StrategyPriorityDailyInfo> selectGreenPlanTable(Integer greenId);
List<StrategyPriorityDailyInfo> getStrategyGreenWave(); void deleteGreenPlanConfig(Integer greenId);
List<StrategyPriorityConfig> selectGreenPriorityTable(Integer greenId); List<StrategyPriorityDailyInfo> getGreenPlanConfigData(@Param("greenId") Integer greenId, @Param("type") Integer type);
void deleteGreenPriorityConfig(Integer greenId); List<StrategyParameterConfig> paramterGreenConfigTable(Integer greenId);
List<String> getGreenstrategyNo(@Param("greenId") Integer greenId,@Param("type") Integer type); void deleteGreenParamterConfig(Integer greenId);
List<StrategyFactoryEntity> getGreenPriorityConfigData(@Param("strategyNo") List<String> strategyNo, @Param("greenId") Integer greenId,@Param("type") Integer type); List<StrategyParameterConfig> getGreenParamConfigData(@Param("greenId") Integer greenId, @Param("type") Integer type, @Param("strategyNo") String strategyNo);
List<StrategyPriorityDailyInfo> selectGreenPlanTable(Integer greenId); /**
* 通过路口编号或干线编号,分组编号查询策略库详情
* @param crossId
* @param greenId
* @param groupId
* @return
*/
List<StrategyFactoryEntity> selectCrossGroupStrategyList(@Param("crossId") String crossId, @Param("greenId") Integer greenId, @Param("groupId") Integer groupId);
void deleteGreenPlanConfig(Integer greenId);
List<StrategyPriorityDailyInfo> getGreenPlanConfigData(@Param("greenId") Integer greenId,@Param("type")Integer type); /**
* 删除路口编号分组下策略编号
* @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);
List<StrategyParameterConfig> paramterGreenConfigTable(Integer greenId); /**
* 通过路口编号或干线编号,分组编号,查询优先级配置日计划详情
* @param crossId
* @param greenId
* @param groupId
* @return
*/
List<StrategyPriorityDailyInfo> selectCrossGreenGroupDailyPlanList(@Param("crossId") String crossId, @Param("greenId") Integer greenId, @Param("groupId") Integer groupId);
void deleteGreenParamterConfig(Integer greenId); /**
* 通过路口编号或干线编号,分组编号查询策略优先级配置详情
* @param crossId
* @param greenId
* @param groupId
* @return
*/
List<StrategyPriorityConfig> selectCrossGroupStrategyPriorityList(@Param("crossId") String crossId, @Param("greenId") Integer greenId, @Param("groupId") Integer groupId);
List<StrategyParameterConfig> getGreenParamConfigData(@Param("greenId") Integer greenId, @Param("type") Integer type,@Param("strategyNo") String strategyNo);
} }
...@@ -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;
} }
......
...@@ -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);
......
...@@ -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=",">
......
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