Commit 57f71c11 authored by hanbing's avatar hanbing

信控优化-问题路口增加正常路口

parent 9326ca57
...@@ -14,5 +14,5 @@ import java.util.List; ...@@ -14,5 +14,5 @@ import java.util.List;
@Repository @Repository
public interface CrossDirDataHistMapper { public interface CrossDirDataHistMapper {
List<CrossDirDataHistPO> selectByCrossIdAndTimestamp(String crossId, long preSeconds, long afterSeconds); List<CrossDirDataHistPO> selectByCrossIdAndTimestamp(String crossId, long preSeconds);
} }
...@@ -7,7 +7,7 @@ import lombok.Data; ...@@ -7,7 +7,7 @@ import lombok.Data;
@Data @Data
@ApiModel(value = "AbnormalCrossListDTO", description = "问题路口列表输入参数") @ApiModel(value = "AbnormalCrossListDTO", description = "问题路口列表输入参数")
public class AbnormalCrossListDTO { public class AbnormalCrossListDTO {
@ApiModelProperty(value = "路口状态 1失衡 2拥堵 3溢出", notes = "", required = false) @ApiModelProperty(value = "路口状态 0正常 1失衡 2拥堵 3溢出", notes = "", required = false)
private Integer status; private Integer status;
@ApiModelProperty(value = "路口名称", notes = "", required = false) @ApiModelProperty(value = "路口名称", notes = "", required = false)
private String name; private String name;
......
...@@ -212,12 +212,14 @@ public class TrendServiceImpl implements TrendService { ...@@ -212,12 +212,14 @@ public class TrendServiceImpl implements TrendService {
private List<AbnormalCrossDetailVO.DirDataElement> buildDirData(String crossId) { private List<AbnormalCrossDetailVO.DirDataElement> buildDirData(String crossId) {
List<AbnormalCrossDetailVO.DirDataElement> dirData = new ArrayList<>(); List<AbnormalCrossDetailVO.DirDataElement> dirData = new ArrayList<>();
// 获取当前时间前后20分钟的10位时间戳 // 获取当前时间之前40分钟的10位时间戳
long currentSeconds = DateUtil.currentSeconds(); long currentSeconds = DateUtil.currentSeconds();
long preSeconds = currentSeconds - 20 * 60;
long afterSeconds = currentSeconds + 20 * 60; // todo 演示用,固定当前时间为 2023-02-11 10:30:00
currentSeconds = 1676082600L;
long preSeconds = currentSeconds - 40 * 60;
List<CrossDirDataHistPO> crossDirDataHistPOList = List<CrossDirDataHistPO> crossDirDataHistPOList =
crossDirDataHistMapper.selectByCrossIdAndTimestamp(crossId, preSeconds, afterSeconds); crossDirDataHistMapper.selectByCrossIdAndTimestamp(crossId, preSeconds);
for (CrossDirDataHistPO crossDirDataHistPO : crossDirDataHistPOList) { for (CrossDirDataHistPO crossDirDataHistPO : crossDirDataHistPOList) {
AbnormalCrossDetailVO.DirDataElement dirDataElement = new AbnormalCrossDetailVO.DirDataElement(); AbnormalCrossDetailVO.DirDataElement dirDataElement = new AbnormalCrossDetailVO.DirDataElement();
...@@ -279,12 +281,15 @@ public class TrendServiceImpl implements TrendService { ...@@ -279,12 +281,15 @@ public class TrendServiceImpl implements TrendService {
private static void buildAbnormalCrossStats(AbnormalCrossVO abnormalCrossVO, private static void buildAbnormalCrossStats(AbnormalCrossVO abnormalCrossVO,
List<AbnormalCrossListVO> abnormalCrossListVOList) { List<AbnormalCrossListVO> abnormalCrossListVOList) {
AbnormalCrossStats abnormalCrossStats = new AbnormalCrossStats(); AbnormalCrossStats abnormalCrossStats = new AbnormalCrossStats();
Integer normal = abnormalCrossStats.getNormal();
Integer unbalance = abnormalCrossStats.getUnbalance(); Integer unbalance = abnormalCrossStats.getUnbalance();
Integer congestion = abnormalCrossStats.getCongestion(); Integer congestion = abnormalCrossStats.getCongestion();
Integer spillover = abnormalCrossStats.getSpillover(); Integer spillover = abnormalCrossStats.getSpillover();
for (AbnormalCrossListVO abnormalCrossListVO : abnormalCrossListVOList) { for (AbnormalCrossListVO abnormalCrossListVO : abnormalCrossListVOList) {
Integer realtimeStatus = abnormalCrossListVO.getRealtimeStatus(); Integer realtimeStatus = abnormalCrossListVO.getRealtimeStatus();
if (realtimeStatus == 1) { if (realtimeStatus == 0) {
normal += 1;
} else if (realtimeStatus == 1) {
unbalance += 1; unbalance += 1;
} else if (realtimeStatus == 2) { } else if (realtimeStatus == 2) {
congestion += 1; congestion += 1;
...@@ -301,6 +306,7 @@ public class TrendServiceImpl implements TrendService { ...@@ -301,6 +306,7 @@ public class TrendServiceImpl implements TrendService {
spillover += 1; spillover += 1;
} }
} }
abnormalCrossStats.setNormal(normal);
abnormalCrossStats.setUnbalance(unbalance); abnormalCrossStats.setUnbalance(unbalance);
abnormalCrossStats.setCongestion(congestion); abnormalCrossStats.setCongestion(congestion);
abnormalCrossStats.setSpillover(spillover); abnormalCrossStats.setSpillover(spillover);
......
...@@ -17,7 +17,7 @@ import java.util.List; ...@@ -17,7 +17,7 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
@ApiModel(value = "AbnormalCrossListVO", description = "问题路口详情") @ApiModel(value = "AbnormalCrossListVO", description = "问题路口详情")
public class AbnormalCrossDetailVO { public class AbnormalCrossDetailVO {
@ApiModelProperty(value = "路口状态:1失衡;2拥堵;3溢出") @ApiModelProperty(value = "路口状态:0正常;1失衡;2拥堵;3溢出")
private Integer crossStatus; private Integer crossStatus;
@ApiModelProperty(value = "最大排队") @ApiModelProperty(value = "最大排队")
private Double crossQueueLength; private Double crossQueueLength;
......
...@@ -24,7 +24,7 @@ public class AbnormalCrossListVO { ...@@ -24,7 +24,7 @@ public class AbnormalCrossListVO {
private String congestionDirs; private String congestionDirs;
@ApiModelProperty(value = "溢出方向 如 1,2,3") @ApiModelProperty(value = "溢出方向 如 1,2,3")
private String spilloverDirs; private String spilloverDirs;
@ApiModelProperty(value = "路口状态 1失衡 2拥堵 3溢出") @ApiModelProperty(value = "路口状态 0正常 1失衡 2拥堵 3溢出")
private Integer realtimeStatus; private Integer realtimeStatus;
@ApiModelProperty(value = "开始时间 格式 08:20:23") @ApiModelProperty(value = "开始时间 格式 08:20:23")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "HH:mm:ss", timezone = "GMT+8")
......
...@@ -13,6 +13,8 @@ import lombok.NoArgsConstructor; ...@@ -13,6 +13,8 @@ import lombok.NoArgsConstructor;
@Data @Data
@ApiModel(value = "AbnormalCrossStats", description = "问题路口统计信息") @ApiModel(value = "AbnormalCrossStats", description = "问题路口统计信息")
public class AbnormalCrossStats { public class AbnormalCrossStats {
@ApiModelProperty(value = "正常数量")
private Integer normal = 0;
@ApiModelProperty(value = "失衡数量") @ApiModelProperty(value = "失衡数量")
private Integer unbalance = 0; private Integer unbalance = 0;
@ApiModelProperty(value = "拥堵数量") @ApiModelProperty(value = "拥堵数量")
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
and t1.type = #{type} and t1.type = #{type}
</if> </if>
<if test="status == null"> <if test="status == null">
and t1.status in (1, 2, 3) and t1.status in (0, 1, 2, 3)
</if> </if>
</where> </where>
</select> </select>
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
from t_cross_dir_data_hist from t_cross_dir_data_hist
where cross_id = #{crossId} and in_out_type = 1 where cross_id = #{crossId} and in_out_type = 1
and batch_time <![CDATA[ >= ]]> #{preSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds}
and batch_time <![CDATA[ <= ]]> #{afterSeconds}
order by batch_time order by batch_time
</select> </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