Commit 6c6fedb1 authored by zhouleilei's avatar zhouleilei

Merge remote-tracking branch 'origin/master'

parents aab7826e b326c6f9
...@@ -18,6 +18,11 @@ ...@@ -18,6 +18,11 @@
</properties> </properties>
<dependencies> <dependencies>
<!--客户端负载均衡loadbalancer-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.github.xiaoymin</groupId> <groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId> <artifactId>knife4j-spring-boot-starter</artifactId>
......
...@@ -16,8 +16,9 @@ public enum EventStatusEnum { ...@@ -16,8 +16,9 @@ public enum EventStatusEnum {
ZERO(0, "未处理"), ZERO(0, "未处理"),
ONE(1, "分析中"), ONE(1, "分析中"),
TWO(2, "优化中"), TWO(2, "优化中"),
THREE(3, "优化中"), THREE(3, "优化完"),
FOUR(4, "已结束"); // 信控没有已结束,优化完
FOUR(4, "优化完");
private Integer code; private Integer code;
private String desc; private String desc;
......
...@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.JsonSerializer; ...@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
/** /**
...@@ -17,7 +18,9 @@ public class Double2TwoDecimalPlacesSerializer extends JsonSerializer<Double> { ...@@ -17,7 +18,9 @@ public class Double2TwoDecimalPlacesSerializer extends JsonSerializer<Double> {
@Override @Override
public void serialize(Double value, JsonGenerator gen, SerializerProvider serializers) throws IOException { public void serialize(Double value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
if (value != null) { if (value != null) {
String formattedValue = df.format(value); // 将 Double 转换为 BigDecimal,避免浮点数精度问题
BigDecimal bd = BigDecimal.valueOf(value).setScale(2, BigDecimal.ROUND_HALF_UP);
String formattedValue = df.format(bd.doubleValue());
gen.writeString(formattedValue); gen.writeString(formattedValue);
} else { } else {
gen.writeNull(); gen.writeNull();
......
...@@ -95,9 +95,9 @@ public class CrossIndexServiceImpl implements CrossIndexService { ...@@ -95,9 +95,9 @@ public class CrossIndexServiceImpl implements CrossIndexService {
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
for (StrategyCrossResultEntity entity : list) { for (StrategyCrossResultEntity entity : list) {
CrossOptResult crossOptResult = new CrossOptResult(); CrossOptResult crossOptResult = new CrossOptResult();
Date date = DateUtil.parse(entity.getIssueTime(), "yyyy-MM-dd HH:mm:ss"); Date date = entity.getIssueTime();
//Date date = DateUtil.parse(entity.getIssueTime(), "yyyy-MM-dd HH:mm:ss");
crossOptResult.setTimeStamp(date); crossOptResult.setTimeStamp(date);
String timingPlan = entity.getTimingPlan();
Integer countDown = entity.getCountDown(); Integer countDown = entity.getCountDown();
if (entity.getCurrentAlgo() == 2) { if (entity.getCurrentAlgo() == 2) {
countDown = 5; countDown = 5;
...@@ -130,9 +130,18 @@ public class CrossIndexServiceImpl implements CrossIndexService { ...@@ -130,9 +130,18 @@ public class CrossIndexServiceImpl implements CrossIndexService {
aiOptResultVO.setStrategy(currentAlgo); aiOptResultVO.setStrategy(currentAlgo);
// 失衡 均衡调控,其他效率提升 // 失衡 均衡调控,其他效率提升
aiOptResultVO.setOptMethod(Objects.equals(1, currentAlgo) ? StrategyControlEnum.ONE.getMethod() : StrategyControlEnum.TWO.getMethod()); aiOptResultVO.setOptMethod(Objects.equals(1, currentAlgo) ? StrategyControlEnum.ONE.getMethod() : StrategyControlEnum.TWO.getMethod());
// 失衡 优化中,其他,优化完 // 失衡 优化中,15分钟内,优化中,其他,优化完
Integer optStatus = Objects.equals(1, currentAlgo) ? OptStatusEnum.ONE.getCode() : OptStatusEnum.TWO.getCode(); aiOptResultVO.setOptStatus(OptStatusEnum.TWO.getCode());
aiOptResultVO.setOptStatus(optStatus); if (Objects.equals(1, currentAlgo)) {
Date issueTimeDate = resultEntity.getIssueTime();
//Date issueTimeDate = DateUtils.parseDate(issueTime);
long optTime = issueTimeDate.getTime();
long currentTimeMillis = System.currentTimeMillis();
long offset = currentTimeMillis - optTime;
if (offset <= 15 * 60 * 1000) {
aiOptResultVO.setOptStatus(OptStatusEnum.ONE.getCode());
}
}
aiOptResultVO.setOptStatusName(Objects.equals(1, currentAlgo) ? OptStatusEnum.ONE.getDesc() : OptStatusEnum.TWO.getDesc()); aiOptResultVO.setOptStatusName(Objects.equals(1, currentAlgo) ? OptStatusEnum.ONE.getDesc() : OptStatusEnum.TWO.getDesc());
if (Objects.isNull(currentAlgo)) { if (Objects.isNull(currentAlgo)) {
aiOptResultVO.setOptStatus(-1); aiOptResultVO.setOptStatus(-1);
......
...@@ -231,82 +231,82 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService { ...@@ -231,82 +231,82 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
.mapToDouble(CrossDataHistPOExt::getNoStopRate) .mapToDouble(CrossDataHistPOExt::getNoStopRate)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_RATE.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_RATE.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getOneStopRate) .mapToDouble(CrossDataHistPOExt::getOneStopRate)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToInt(CrossDataHistPOExt::getDelayTime) .mapToInt(CrossDataHistPOExt::getDelayTime)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.MAX_QUEUE_LENGTH.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.MAX_QUEUE_LENGTH.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getQueueLength) .mapToDouble(CrossDataHistPOExt::getQueueLength)
.max() .max()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_TIMES.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_TIMES.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getStopTimes) .mapToDouble(CrossDataHistPOExt::getStopTimes)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(v);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_SPEED.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_SPEED.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getSpeed) .mapToDouble(CrossDataHistPOExt::getSpeed)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.GREEN_LIGHT_EFFICIENCY.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.GREEN_LIGHT_EFFICIENCY.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getGreenLightEfficiency) .mapToDouble(CrossDataHistPOExt::getGreenLightEfficiency)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.SATURATION.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.SATURATION.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getSturation) .mapToDouble(CrossDataHistPOExt::getSturation)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.LOAD_BALANCE.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.LOAD_BALANCE.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getLoadBalance) .mapToDouble(CrossDataHistPOExt::getLoadBalance)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.EFFUSION_RATE.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.EFFUSION_RATE.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getEffusionRate) .mapToDouble(CrossDataHistPOExt::getEffusionRate)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.EMPTY_PHASE.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.EMPTY_PHASE.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getEmptyPhase) .mapToDouble(CrossDataHistPOExt::getEmptyPhase)
.sum(); .sum();
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.FLOW.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.FLOW.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getFlow) .mapToDouble(CrossDataHistPOExt::getFlow)
.sum(); .sum();
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} }
// 排序用 // 排序用
...@@ -364,62 +364,62 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService { ...@@ -364,62 +364,62 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
.mapToDouble(CrossDirDataHistPO::getNoStopRate) .mapToDouble(CrossDirDataHistPO::getNoStopRate)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_RATE.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_RATE.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getOneStopRate) .mapToDouble(CrossDirDataHistPO::getOneStopRate)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToInt(CrossDirDataHistPO::getDelayTime) .mapToInt(CrossDirDataHistPO::getDelayTime)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.MAX_QUEUE_LENGTH.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.MAX_QUEUE_LENGTH.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getQueueLength) .mapToDouble(CrossDirDataHistPO::getQueueLength)
.max() .max()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_TIMES.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_TIMES.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getStopTimes) .mapToDouble(CrossDirDataHistPO::getStopTimes)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(v);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_SPEED.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_SPEED.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getSpeed) .mapToDouble(CrossDirDataHistPO::getSpeed)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.GREEN_LIGHT_EFFICIENCY.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.GREEN_LIGHT_EFFICIENCY.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getGreenLightEfficiency) .mapToDouble(CrossDirDataHistPO::getGreenLightEfficiency)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.SATURATION.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.SATURATION.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getSturation) .mapToDouble(CrossDirDataHistPO::getSturation)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.FLOW.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.FLOW.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getFlow) .mapToDouble(CrossDirDataHistPO::getFlow)
.sum(); .sum();
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} }
// 排序用 // 排序用
...@@ -479,62 +479,62 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService { ...@@ -479,62 +479,62 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
.mapToDouble(CrossTurnDataHistPO::getNoStopRate) .mapToDouble(CrossTurnDataHistPO::getNoStopRate)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_RATE.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_RATE.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getOneStopRate) .mapToDouble(CrossTurnDataHistPO::getOneStopRate)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToInt(CrossTurnDataHistPO::getDelayTime) .mapToInt(CrossTurnDataHistPO::getDelayTime)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.MAX_QUEUE_LENGTH.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.MAX_QUEUE_LENGTH.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getQueueLength) .mapToDouble(CrossTurnDataHistPO::getQueueLength)
.max() .max()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_TIMES.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_TIMES.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getStopTimes) .mapToDouble(CrossTurnDataHistPO::getStopTimes)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(v);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_SPEED.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_SPEED.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getSpeed) .mapToDouble(CrossTurnDataHistPO::getSpeed)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.GREEN_LIGHT_EFFICIENCY.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.GREEN_LIGHT_EFFICIENCY.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getGreenLightEfficiency) .mapToDouble(CrossTurnDataHistPO::getGreenLightEfficiency)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.SATURATION.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.SATURATION.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getSturation) .mapToDouble(CrossTurnDataHistPO::getSturation)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.FLOW.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.FLOW.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getFlow) .mapToDouble(CrossTurnDataHistPO::getFlow)
.sum(); .sum();
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} }
// 排序用 // 排序用
...@@ -599,62 +599,62 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService { ...@@ -599,62 +599,62 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
.mapToDouble(CrossLaneDataHistPOExt::getNoStopRate) .mapToDouble(CrossLaneDataHistPOExt::getNoStopRate)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_RATE.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_RATE.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getOneStopRate) .mapToDouble(CrossLaneDataHistPOExt::getOneStopRate)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToInt(CrossLaneDataHistPOExt::getDelayTime) .mapToInt(CrossLaneDataHistPOExt::getDelayTime)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.MAX_QUEUE_LENGTH.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.MAX_QUEUE_LENGTH.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getQueueLength) .mapToDouble(CrossLaneDataHistPOExt::getQueueLength)
.max() .max()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_TIMES.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_TIMES.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getStopTimes) .mapToDouble(CrossLaneDataHistPOExt::getStopTimes)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(v);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_SPEED.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_SPEED.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getSpeed) .mapToDouble(CrossLaneDataHistPOExt::getSpeed)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.GREEN_LIGHT_EFFICIENCY.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.GREEN_LIGHT_EFFICIENCY.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getGreenLightEfficiency) .mapToDouble(CrossLaneDataHistPOExt::getGreenLightEfficiency)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.SATURATION.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.SATURATION.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getSturation) .mapToDouble(CrossLaneDataHistPOExt::getSturation)
.average() .average()
.orElse(0.0); .orElse(0.0);
int round = (int) (Math.round(v * 100)); double round = (double) (Math.round(v * 100));
vo.setValue(round); vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.FLOW.getCode())) { } else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.FLOW.getCode())) {
double v = filteredList.stream() double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getFlow) .mapToDouble(CrossLaneDataHistPOExt::getFlow)
.sum(); .sum();
int round = (int) (Math.round(v)); double round = (double) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} }
// 排序用 // 排序用
...@@ -1622,7 +1622,7 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService { ...@@ -1622,7 +1622,7 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
.mapToDouble(CrossDirDataHistPOExt::getStopTimes) .mapToDouble(CrossDirDataHistPOExt::getStopTimes)
.average() .average()
.orElse(0.0); .orElse(0.0);
dirValue = (int) Math.round(average); //dirValue = (int) Math.round(average);
} else if (Objects.equals(metricName, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getDescription())) { } else if (Objects.equals(metricName, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getDescription())) {
double average = crossDirDataHistPOList.stream() double average = crossDirDataHistPOList.stream()
.mapToDouble(CrossDirDataHistPOExt::getDelayTime) .mapToDouble(CrossDirDataHistPOExt::getDelayTime)
......
...@@ -6,6 +6,9 @@ import com.baomidou.mybatisplus.annotation.TableId; ...@@ -6,6 +6,9 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import net.wanji.common.utils.tool.DateUtil;
import java.util.Date;
/** /**
* @author duanruiming * @author duanruiming
...@@ -24,10 +27,10 @@ public class StrategyCrossResultEntity { ...@@ -24,10 +27,10 @@ public class StrategyCrossResultEntity {
private Integer currentAlgo; private Integer currentAlgo;
@TableField("request_time") @TableField("request_time")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String requestTime; private Date requestTime;
@TableField("issue_time") @TableField("issue_time")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String issueTime; private Date issueTime;
@TableField("response_code") @TableField("response_code")
private Integer responseCode; private Integer responseCode;
@TableField("timing_plan") @TableField("timing_plan")
......
...@@ -2,6 +2,7 @@ package net.wanji.opt.synthesis.service.impl; ...@@ -2,6 +2,7 @@ package net.wanji.opt.synthesis.service.impl;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.alibaba.excel.util.DateUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
...@@ -189,9 +190,14 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -189,9 +190,14 @@ public class StrategyControlServiceImpl implements StrategyControlService {
List<StrategyControlHistVO> results = new ArrayList<>(); List<StrategyControlHistVO> results = new ArrayList<>();
LocalDate currentDate = LocalDate.now(); LocalDate currentDate = LocalDate.now();
LocalDateTime midnight = currentDate.atStartOfDay(); LocalDateTime midnight = currentDate.atStartOfDay();
try {
// 查询当前绿波历史记录 // 查询当前绿波历史记录
setGreenOptHist(results, midnight, format); setGreenOptHist(results, midnight, format);
setCrossOptHist(results, midnight); setCrossOptHist(results, midnight);
} catch (ParseException e) {
log.error("优化策略查询失败:", e);
JsonViewObject.newInstance().fail("优化策略查询失败");
}
List<StrategyControlHistVO> sorted = results.stream().sorted(Comparator.comparing(StrategyControlHistVO::getOptTime).reversed()).collect(Collectors.toList()); List<StrategyControlHistVO> sorted = results.stream().sorted(Comparator.comparing(StrategyControlHistVO::getOptTime).reversed()).collect(Collectors.toList());
return JsonViewObject.newInstance().success(sorted); return JsonViewObject.newInstance().success(sorted);
} }
...@@ -210,8 +216,14 @@ public class StrategyControlServiceImpl implements StrategyControlService { ...@@ -210,8 +216,14 @@ public class StrategyControlServiceImpl implements StrategyControlService {
histVO.setWkt(coordinateByCrossId.replace("POINT(", "").replace(" ", ",").replace(")", "")); histVO.setWkt(coordinateByCrossId.replace("POINT(", "").replace(" ", ",").replace(")", ""));
histVO.setStrategy(resultEntity.getCurrentAlgo()); histVO.setStrategy(resultEntity.getCurrentAlgo());
histVO.setStrategyName(StrategyCrossAlgoEnum.getDescByCode(resultEntity.getCurrentAlgo())); histVO.setStrategyName(StrategyCrossAlgoEnum.getDescByCode(resultEntity.getCurrentAlgo()));
histVO.setOptTime(resultEntity.getIssueTime()); Date issueTime = resultEntity.getIssueTime();
String format = DateUtils.format(issueTime, "yyyy-MM-dd HH:mm:ss");
histVO.setOptTime(format);
if (resultEntity.getCurrentAlgo() != 1) {
histVO.setResult(Objects.equals(200, resultEntity.getResponseCode()) ? "成功" : "失败"); histVO.setResult(Objects.equals(200, resultEntity.getResponseCode()) ? "成功" : "失败");
} else {
histVO.setResult("成功");
}
results.add(histVO); results.add(histVO);
} }
} }
......
...@@ -20,7 +20,7 @@ public class MainlineEvaluateBottomCurveVO { ...@@ -20,7 +20,7 @@ public class MainlineEvaluateBottomCurveVO {
private String scopeName; private String scopeName;
@ApiModelProperty(value = "数值") @ApiModelProperty(value = "数值")
private Integer value; private Double value;
@ApiModelProperty(value = "指标时间戳") @ApiModelProperty(value = "指标时间戳")
private Long metricTimeStamp; private Long metricTimeStamp;
......
...@@ -105,7 +105,9 @@ public class SignalCommandSyncTask { ...@@ -105,7 +105,9 @@ public class SignalCommandSyncTask {
List<SignalCommandPO> sendList = new ArrayList<>(); List<SignalCommandPO> sendList = new ArrayList<>();
sendList.addAll(insertList); sendList.addAll(insertList);
sendList.addAll(updateList); sendList.addAll(updateList);
if (!CollectionUtils.isEmpty(sendList)) {
sendAlarmKafka(sendList); sendAlarmKafka(sendList);
}
} else { } else {
log.error("从路口灯态缓存获取控制模式在线离线状态为空:{}", crossLightsStatusMap); log.error("从路口灯态缓存获取控制模式在线离线状态为空:{}", crossLightsStatusMap);
} }
......
...@@ -3,8 +3,10 @@ package net.wanji.databus.config; ...@@ -3,8 +3,10 @@ package net.wanji.databus.config;
import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.SerializerProvider;
import net.wanji.common.utils.tool.JacksonUtils;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
/** /**
...@@ -17,7 +19,9 @@ public class DoubleToTwoDecimalPlacesSerializer extends JsonSerializer<Double> { ...@@ -17,7 +19,9 @@ public class DoubleToTwoDecimalPlacesSerializer extends JsonSerializer<Double> {
@Override @Override
public void serialize(Double value, JsonGenerator gen, SerializerProvider serializers) throws IOException { public void serialize(Double value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
if (value != null) { if (value != null) {
String formattedValue = df.format(value); // 将 Double 转换为 BigDecimal,避免浮点数精度问题
BigDecimal bd = BigDecimal.valueOf(value).setScale(2, BigDecimal.ROUND_HALF_UP);
String formattedValue = df.format(bd.doubleValue());
gen.writeString(formattedValue); gen.writeString(formattedValue);
} else { } else {
gen.writeNull(); gen.writeNull();
......
...@@ -4,11 +4,11 @@ import com.alibaba.fastjson.annotation.JSONField; ...@@ -4,11 +4,11 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.omg.CORBA.UNKNOWN; import net.wanji.databus.config.DoubleToTwoDecimalPlacesSerializer;
import java.util.Date; import java.util.Date;
...@@ -39,13 +39,14 @@ public class CrossDataRealtimePO { ...@@ -39,13 +39,14 @@ public class CrossDataRealtimePO {
* 交通指数(1~10) * 交通指数(1~10)
*/ */
@ApiModelProperty(value = "交通指数(1~10)", notes = "") @ApiModelProperty(value = "交通指数(1~10)", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double trafficIndex; private Double trafficIndex;
/** /**
* 开始时间:yyyy-MM-dd HH;mm:ss * 开始时间:yyyy-MM-dd HH;mm:ss
*/ */
@ApiModelProperty(value = "开始时间:yyyy-MM-dd HH:mm:ss", notes = "") @ApiModelProperty(value = "开始时间:yyyy-MM-dd HH:mm:ss", notes = "")
@JSONField(format = "yyyy-MM-dd HH:mm:ss") @JSONField(format = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime; private Date startTime;
@ApiModelProperty(value = "结束时间:yyyy-MM-dd HH:mm:ss", notes = "") @ApiModelProperty(value = "结束时间:yyyy-MM-dd HH:mm:ss", notes = "")
...@@ -71,16 +72,19 @@ public class CrossDataRealtimePO { ...@@ -71,16 +72,19 @@ public class CrossDataRealtimePO {
* 失衡指数 * 失衡指数
*/ */
@ApiModelProperty(value = "失衡指数", notes = "") @ApiModelProperty(value = "失衡指数", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double unbalanceIndex; private Double unbalanceIndex;
/** /**
* 溢出指数 * 溢出指数
*/ */
@ApiModelProperty(value = "溢出指数", notes = "") @ApiModelProperty(value = "溢出指数", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double spilloverIndex; private Double spilloverIndex;
/** /**
* 拥堵指数 * 拥堵指数
*/ */
@ApiModelProperty(value = "拥堵指数", notes = "") @ApiModelProperty(value = "拥堵指数", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double congestionIndex; private Double congestionIndex;
/** /**
* 路口失衡方向:1,2,3... * 路口失衡方向:1,2,3...
...@@ -106,21 +110,25 @@ public class CrossDataRealtimePO { ...@@ -106,21 +110,25 @@ public class CrossDataRealtimePO {
* 交通流率/h * 交通流率/h
*/ */
@ApiModelProperty(value = "交通流率/h", notes = "") @ApiModelProperty(value = "交通流率/h", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double flowRate; private Double flowRate;
/** /**
* 平均速度(km/h) * 平均速度(km/h)
*/ */
@ApiModelProperty(value = "平均速度(km/h)", notes = "") @ApiModelProperty(value = "平均速度(km/h)", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double speed; private Double speed;
/** /**
* 最大排队(米) * 最大排队(米)
*/ */
@ApiModelProperty(value = "最大排队(米)", notes = "") @ApiModelProperty(value = "最大排队(米)", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double queueLength; private Double queueLength;
/** /**
* 停车次数(次) * 停车次数(次)
*/ */
@ApiModelProperty(value = "停车次数(次)", notes = "") @ApiModelProperty(value = "停车次数(次)", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double stopTimes; private Double stopTimes;
/** /**
* 延误时间(秒) * 延误时间(秒)
...@@ -151,11 +159,13 @@ public class CrossDataRealtimePO { ...@@ -151,11 +159,13 @@ public class CrossDataRealtimePO {
* 红灯清空率 * 红灯清空率
*/ */
@ApiModelProperty(value = "红灯清空率", notes = "") @ApiModelProperty(value = "红灯清空率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double clearRate; private Double clearRate;
/** /**
* 负载均衡度 * 负载均衡度
*/ */
@ApiModelProperty(value = "负载均衡度", notes = "") @ApiModelProperty(value = "负载均衡度", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double loadBalance; private Double loadBalance;
/** /**
* 平均未清空车辆数量 * 平均未清空车辆数量
...@@ -166,25 +176,32 @@ public class CrossDataRealtimePO { ...@@ -166,25 +176,32 @@ public class CrossDataRealtimePO {
* 绿灯有效利用率 * 绿灯有效利用率
*/ */
@ApiModelProperty(value = "绿灯有效利用率", notes = "") @ApiModelProperty(value = "绿灯有效利用率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double greenLightEfficiency; private Double greenLightEfficiency;
/** /**
* 溢流率 * 溢流率
*/ */
@ApiModelProperty(value = "溢流率", notes = "") @ApiModelProperty(value = "溢流率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double effusionRate; private Double effusionRate;
@ApiModelProperty(name = "不停车率",notes = "") @ApiModelProperty(name = "不停车率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
public Double noStopRate; public Double noStopRate;
@ApiModelProperty(name = "一次停车率",notes = "") @ApiModelProperty(name = "一次停车率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
public Double oneStopRate; public Double oneStopRate;
@ApiModelProperty(name = "二次停车率",notes = "") @ApiModelProperty(name = "二次停车率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
public Double twoStopRate; public Double twoStopRate;
@ApiModelProperty(name = "三次停车率",notes = "") @ApiModelProperty(name = "三次停车率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
public Double threeStopRate; public Double threeStopRate;
@ApiModelProperty(value = "非机动车流量", notes = "") @ApiModelProperty(value = "非机动车流量", notes = "")
private int nonMotorFlow; private int nonMotorFlow;
@ApiModelProperty(value = "85位速度(km/h)", notes = "") @ApiModelProperty(value = "85位速度(km/h)", notes = "")
@TableField(value = "v_85") @TableField(value = "v_85")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private double v85; private double v85;
@ApiModelProperty(value = "大车流量", notes = "") @ApiModelProperty(value = "大车流量", notes = "")
private int trafficFlowA; private int trafficFlowA;
...@@ -193,10 +210,14 @@ public class CrossDataRealtimePO { ...@@ -193,10 +210,14 @@ public class CrossDataRealtimePO {
@ApiModelProperty(value = "小车流量", notes = "") @ApiModelProperty(value = "小车流量", notes = "")
private int trafficFlowC; private int trafficFlowC;
@ApiModelProperty(value = "时间占有率", notes = "") @ApiModelProperty(value = "时间占有率", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private double timeOccupancy; private double timeOccupancy;
@ApiModelProperty(value = "空间占有率", notes = "平均空间密度(长度占比)") @ApiModelProperty(value = "空间占有率", notes = "平均空间密度(长度占比)")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private double vehicleLengthRatioMean; private double vehicleLengthRatioMean;
/** add 20241123 适配神思数据 */ /**
* add 20241123 适配神思数据
*/
@ApiModelProperty(value = "执行策略 失衡 2拥堵 3溢出 4死锁 5 空放", notes = "") @ApiModelProperty(value = "执行策略 失衡 2拥堵 3溢出 4死锁 5 空放", notes = "")
private Integer strategy; private Integer strategy;
@ApiModelProperty(value = "策略执行持续时间;单位:s", notes = "") @ApiModelProperty(value = "策略执行持续时间;单位:s", notes = "")
......
...@@ -3,9 +3,11 @@ package net.wanji.databus.po; ...@@ -3,9 +3,11 @@ package net.wanji.databus.po;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import net.wanji.databus.config.DoubleToTwoDecimalPlacesSerializer;
import java.util.Date; import java.util.Date;
...@@ -46,6 +48,7 @@ public class CrossDirDataRealtimePO { ...@@ -46,6 +48,7 @@ public class CrossDirDataRealtimePO {
@ApiModelProperty(name = "排队长度(米)",notes = "") @ApiModelProperty(name = "排队长度(米)",notes = "")
public Double queueLength; public Double queueLength;
@ApiModelProperty(name = "停车次数",notes = "") @ApiModelProperty(name = "停车次数",notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
public Double stopTimes; public Double stopTimes;
@ApiModelProperty(name = "延误时间",notes = "") @ApiModelProperty(name = "延误时间",notes = "")
public Integer delayTime; public Integer delayTime;
......
...@@ -2,9 +2,11 @@ package net.wanji.databus.po; ...@@ -2,9 +2,11 @@ package net.wanji.databus.po;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import net.wanji.databus.config.DoubleToTwoDecimalPlacesSerializer;
import java.util.Date; import java.util.Date;
...@@ -31,6 +33,7 @@ public class CrossLaneDataRealTimePO { ...@@ -31,6 +33,7 @@ public class CrossLaneDataRealTimePO {
@ApiModelProperty(name = "排队长度(米)",notes = "") @ApiModelProperty(name = "排队长度(米)",notes = "")
private Double queueLength; private Double queueLength;
@ApiModelProperty(name = "停车次数",notes = "") @ApiModelProperty(name = "停车次数",notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double stopTimes; private Double stopTimes;
@ApiModelProperty(name = "延误时间",notes = "") @ApiModelProperty(name = "延误时间",notes = "")
private Integer delayTime; private Integer delayTime;
......
...@@ -3,9 +3,11 @@ package net.wanji.databus.po; ...@@ -3,9 +3,11 @@ package net.wanji.databus.po;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import net.wanji.databus.config.DoubleToTwoDecimalPlacesSerializer;
import java.util.Date; import java.util.Date;
...@@ -54,6 +56,7 @@ public class CrossTurnDataRealtimePO { ...@@ -54,6 +56,7 @@ public class CrossTurnDataRealtimePO {
public Double queueLength ; public Double queueLength ;
/** 停车次数(次) */ /** 停车次数(次) */
@ApiModelProperty(name = "停车次数(次)",notes = "") @ApiModelProperty(name = "停车次数(次)",notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
public Double stopTimes ; public Double stopTimes ;
/** 延误时间(秒) */ /** 延误时间(秒) */
@ApiModelProperty(name = "延误时间(秒)",notes = "") @ApiModelProperty(name = "延误时间(秒)",notes = "")
......
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