Commit 9b76d884 authored by hanbing's avatar hanbing

路口级别拥堵划分拥堵等级

parent ecbc6337
......@@ -475,7 +475,7 @@ public class CarTrajectoryIndexMain {
new JdbcStatementBuilder<CongestionResult>() {
@Override
public void accept(PreparedStatement preparedStatement, CongestionResult carRecordInfo) throws SQLException {
preparedStatement.setString(1, "505");
preparedStatement.setString(1, carRecordInfo.getCongestionType());
preparedStatement.setString(2, carRecordInfo.getCrossId());
preparedStatement.setString(3, "5");
preparedStatement.setTimestamp(4, new Timestamp(carRecordInfo.getStartTime()));
......
package com.wanji.indicators.task.trajectory.func;
import com.wanji.indicators.constant.CongestEnum;
import com.wanji.indicators.task.trajectory.CarTrajectoryIndexMain;
import com.wanji.indicators.task.trajectory.pojo.CongestionResult;
import com.wanji.indicators.task.trajectory.pojo.StartDuration;
......@@ -91,6 +92,23 @@ public class MergeCongestionFunction extends ProcessFunction<CongestionResult, C
String crossStateKey = crossId;
if (isCrossCongestion) {
String indexName;
String congestionType;
if (crossIndex <= 2.0) {
indexName = "轻度拥堵";
congestionType = CongestEnum.LIGHT_CONGEST.getType();
} else if (crossIndex <= 3.0) {
indexName = "中度拥堵";
congestionType = CongestEnum.MODERATE_CONGEST.getType();
} else {
indexName = "重度拥堵";
congestionType = CongestEnum.HEAVY_CONGEST.getType();
}
congestionResult.setIndexName(indexName);
congestionResult.setCongestionType(congestionType);
// 保存状态
try {
if (!crossState.contains(crossStateKey)) {
StartDuration startDuration = new StartDuration();
......@@ -116,7 +134,6 @@ public class MergeCongestionFunction extends ProcessFunction<CongestionResult, C
congestionResult.setDuration(durationInt);
crossState.put(crossStateKey, startDuration);
}
congestionResult.setIndexName("拥堵");
} catch (Exception e) {
throw new RuntimeException(e);
}
......
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