Commit 59cd7874 authored by duwei's avatar duwei

空放时长接口开发

parent a2e010bb
...@@ -238,9 +238,11 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService { ...@@ -238,9 +238,11 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
} }
int startStamp = (int) (startDate.getTime() / 1000); // 10位时间戳 int startStamp = (int) (startDate.getTime() / 1000); // 10位时间戳
int endStamp = (int) (endDate.getTime() / 1000); int endStamp = (int) (endDate.getTime() / 1000);
String startTime = DateUtil.format(startDate, "yyyy-MM-dd HH:mm:ss");
String endTime = DateUtil.format(endDate, "yyyy-MM-dd HH:mm:ss");
List<CrossDataHistPO> crossDataHistPOList = crossDataHistMapper.selectByCrossIdAndStartEnd( List<CrossDataHistPO> crossDataHistPOList = crossDataHistMapper.selectByCrossIdAndStartEnd2(
crossId, startStamp, endStamp); crossId, startTime, endTime);
return crossDataHistPOList; return crossDataHistPOList;
} }
...@@ -284,14 +286,18 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService { ...@@ -284,14 +286,18 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
int startStamp = (int) (startDate.getTime() / 1000); // 10位时间戳 int startStamp = (int) (startDate.getTime() / 1000); // 10位时间戳
int endStamp = (int) (endDate.getTime() / 1000); int endStamp = (int) (endDate.getTime() / 1000);
String startTime = DateUtil.format(startDate, "yyyy-MM-dd HH:mm:ss");
String endTime = DateUtil.format(endDate, "yyyy-MM-dd HH:mm:ss");
//2. 查询路口统计表 t_cross_data_hist //2. 查询路口统计表 t_cross_data_hist
List<RunningEvaluateIndexStatusVO> runningEvaluateIndexStatusVOS = buildRes(bo, crossId, status); List<RunningEvaluateIndexStatusVO> runningEvaluateIndexStatusVOS = buildRes(bo, crossId, status);
runningEvaluateStatusVO.setRunningEvaluateIndexStatusVOList(runningEvaluateIndexStatusVOS); runningEvaluateStatusVO.setRunningEvaluateIndexStatusVOList(runningEvaluateIndexStatusVOS);
//3. 获取问题列表 //3. 获取问题列表
// 路口级别全量数据 // 路口级别全量数据
List<MetricHistDTO> crossDTOList = crossDataHistMapper.selectMetricHistDTO( List<MetricHistDTO> crossDTOList = crossDataHistMapper.selectMetricHistDTO2(
crossId, startStamp, endStamp); crossId, startTime, endTime);
//4. 过滤有问题的记录 //4. 过滤有问题的记录
List<MetricHistDTO> filteredList = crossDTOList.stream() List<MetricHistDTO> filteredList = crossDTOList.stream()
...@@ -902,7 +908,7 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService { ...@@ -902,7 +908,7 @@ public class RunningEvaluateServiceImpl implements RunningEvaluateService {
.orElse(0.0); .orElse(0.0);
}else if (status == CrossStatusEnum.EMPTY_RELEASE.getCode()) { }else if (status == CrossStatusEnum.EMPTY_RELEASE.getCode()) {
average = subList.stream() average = subList.stream()
.mapToDouble(CrossDataHistPO::getEmptyReleaseIndex) .mapToDouble(CrossDataHistPO::getDuration)
.average() .average()
.orElse(0.0); .orElse(0.0);
} }
......
...@@ -25,10 +25,21 @@ public interface CrossDataHistMapper extends BaseMapper<CrossDataHistPO> { ...@@ -25,10 +25,21 @@ public interface CrossDataHistMapper extends BaseMapper<CrossDataHistPO> {
List<CrossDataHistPO> selectByCrossIdAndStartEnd(String crossId, int startStamp, int endStamp); List<CrossDataHistPO> selectByCrossIdAndStartEnd(String crossId, int startStamp, int endStamp);
/**
* 通过字符串日期获取数据
* @param crossId
* @param startStamp
* @param endStamp
* @return
*/
List<CrossDataHistPO> selectByCrossIdAndStartEnd2(String crossId, String startStamp, String endStamp);
List<CrossDataHistVO> selectByCrossIdAndStartEndStat(String crossId, int startStamp, int endStamp, String granularity); List<CrossDataHistVO> selectByCrossIdAndStartEndStat(String crossId, int startStamp, int endStamp, String granularity);
List<MetricHistDTO> selectMetricHistDTO(String crossId, int startStamp, int endStamp); List<MetricHistDTO> selectMetricHistDTO(String crossId, int startStamp, int endStamp);
List<MetricHistDTO> selectMetricHistDTO2(String crossId, String startStamp, String endStamp);
Double selectMaxSaturation(String crossId, int startStamp, int endStamp); Double selectMaxSaturation(String crossId, int startStamp, int endStamp);
List<CrossDataHistPO> selectByCrossIdsAndTimestamp(List<String> crossIdList, int startTimeStamp, int endTimeStamp); List<CrossDataHistPO> selectByCrossIdsAndTimestamp(List<String> crossIdList, int startTimeStamp, int endTimeStamp);
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
cross_id, status, type, traffic_index, start_time, end_time, duration, is_unbalance, is_spillover, is_congestion,is_emptyrelease, cross_id, status, type, traffic_index, start_time, end_time, duration, is_unbalance, is_spillover, is_congestion,is_emptyrelease,
unbalance_index, spillover_index, congestion_index,emptyrelease_index, unbalance_dirs, spillover_dirs, congestion_dirs, unbalance_index, spillover_index, congestion_index, unbalance_dirs, spillover_dirs, congestion_dirs,
flow, flow_rate, speed, queue_length, stop_times, delay_time, sturation, batch_time, gmt_create, gmt_modified, flow, flow_rate, speed, queue_length, stop_times, delay_time, sturation, batch_time, gmt_create, gmt_modified,
clear_rate,load_balance,not_clear_car_nums,green_light_efficiency,effusion_rate, clear_rate,load_balance,not_clear_car_nums,green_light_efficiency,effusion_rate,
no_stop_rate,one_stop_rate,two_stop_rate,three_stop_rate,non_motor_flow,v_85, no_stop_rate,one_stop_rate,two_stop_rate,three_stop_rate,non_motor_flow,v_85,
...@@ -95,6 +95,15 @@ ...@@ -95,6 +95,15 @@
and batch_time <![CDATA[ <= ]]> #{endStamp} and batch_time <![CDATA[ <= ]]> #{endStamp}
order by batch_time order by batch_time
</select> </select>
<select id="selectByCrossIdAndStartEnd2" resultType="net.wanji.databus.po.CrossDataHistPO">
select <include refid="Base_Column_List"></include>
from t_cross_data_hist
where cross_id = #{crossId}
and start_time <![CDATA[ >= ]]> #{startStamp}
and start_time <![CDATA[ <= ]]> #{endStamp}
order by batch_time
</select>
<!-- 交通指标-路口级统计 --> <!-- 交通指标-路口级统计 -->
<select id="selectByCrossIdAndStartEndStat" resultType="net.wanji.databus.vo.CrossDataHistVO"> <select id="selectByCrossIdAndStartEndStat" resultType="net.wanji.databus.vo.CrossDataHistVO">
SELECT SELECT
...@@ -154,6 +163,15 @@ ...@@ -154,6 +163,15 @@
order by batch_time order by batch_time
</select> </select>
<select id="selectMetricHistDTO2" resultType="net.wanji.databus.dto.MetricHistDTO">
select status, start_time, duration, flow, speed, sturation, stop_times, delay_time, batch_time, one_stop_rate, queue_length, effusion_rate, no_stop_rate, green_light_efficiency, load_balance
from t_cross_data_hist
where cross_id = #{crossId}
and start_time <![CDATA[ >= ]]> #{startStamp}
and start_time <![CDATA[ <= ]]> #{endStamp}
order by batch_time
</select>
<select id="selectMaxSaturation" resultType="java.lang.Double"> <select id="selectMaxSaturation" resultType="java.lang.Double">
select max(sturation) select max(sturation)
from t_cross_data_hist from t_cross_data_hist
......
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