Commit cbf4195a authored by zhoushiguang's avatar zhoushiguang

停车次数保留2位小数

parent e8fcdaac
......@@ -231,82 +231,82 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
.mapToDouble(CrossDataHistPOExt::getNoStopRate)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_RATE.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getOneStopRate)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getCode())) {
double v = filteredList.stream()
.mapToInt(CrossDataHistPOExt::getDelayTime)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.MAX_QUEUE_LENGTH.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getQueueLength)
.max()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_TIMES.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getStopTimes)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
vo.setValue(round);
double round = (double) (Math.round(v));
vo.setValue(v);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_SPEED.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getSpeed)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.GREEN_LIGHT_EFFICIENCY.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getGreenLightEfficiency)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.SATURATION.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getSturation)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.LOAD_BALANCE.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getLoadBalance)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.EFFUSION_RATE.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getEffusionRate)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.EMPTY_PHASE.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getEmptyPhase)
.sum();
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.FLOW.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDataHistPOExt::getFlow)
.sum();
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
}
// 排序用
......@@ -364,62 +364,62 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
.mapToDouble(CrossDirDataHistPO::getNoStopRate)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_RATE.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getOneStopRate)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getCode())) {
double v = filteredList.stream()
.mapToInt(CrossDirDataHistPO::getDelayTime)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.MAX_QUEUE_LENGTH.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getQueueLength)
.max()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_TIMES.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getStopTimes)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
vo.setValue(round);
double round = (double) (Math.round(v));
vo.setValue(v);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_SPEED.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getSpeed)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.GREEN_LIGHT_EFFICIENCY.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getGreenLightEfficiency)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.SATURATION.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getSturation)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.FLOW.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossDirDataHistPO::getFlow)
.sum();
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
}
// 排序用
......@@ -479,62 +479,62 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
.mapToDouble(CrossTurnDataHistPO::getNoStopRate)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_RATE.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getOneStopRate)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getCode())) {
double v = filteredList.stream()
.mapToInt(CrossTurnDataHistPO::getDelayTime)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.MAX_QUEUE_LENGTH.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getQueueLength)
.max()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_TIMES.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getStopTimes)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
vo.setValue(round);
double round = (double) (Math.round(v));
vo.setValue(v);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_SPEED.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getSpeed)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.GREEN_LIGHT_EFFICIENCY.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getGreenLightEfficiency)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.SATURATION.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getSturation)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.FLOW.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossTurnDataHistPO::getFlow)
.sum();
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
}
// 排序用
......@@ -599,62 +599,62 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
.mapToDouble(CrossLaneDataHistPOExt::getNoStopRate)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_RATE.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getOneStopRate)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getCode())) {
double v = filteredList.stream()
.mapToInt(CrossLaneDataHistPOExt::getDelayTime)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.MAX_QUEUE_LENGTH.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getQueueLength)
.max()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.STOP_TIMES.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getStopTimes)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
vo.setValue(round);
double round = (double) (Math.round(v));
vo.setValue(v);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.AVERAGE_SPEED.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getSpeed)
.average()
.orElse(0.0);
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.GREEN_LIGHT_EFFICIENCY.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getGreenLightEfficiency)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.SATURATION.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getSturation)
.average()
.orElse(0.0);
int round = (int) (Math.round(v * 100));
double round = (double) (Math.round(v * 100));
vo.setValue(round);
} else if (Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.FLOW.getCode())) {
double v = filteredList.stream()
.mapToDouble(CrossLaneDataHistPOExt::getFlow)
.sum();
int round = (int) (Math.round(v));
double round = (double) (Math.round(v));
vo.setValue(round);
}
// 排序用
......@@ -1622,7 +1622,7 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
.mapToDouble(CrossDirDataHistPOExt::getStopTimes)
.average()
.orElse(0.0);
dirValue = (int) Math.round(average);
//dirValue = (int) Math.round(average);
} else if (Objects.equals(metricName, StrategyAndMetricsEnum.Metrics.AVERAGE_DELAY.getDescription())) {
double average = crossDirDataHistPOList.stream()
.mapToDouble(CrossDirDataHistPOExt::getDelayTime)
......
......@@ -20,7 +20,7 @@ public class MainlineEvaluateBottomCurveVO {
private String scopeName;
@ApiModelProperty(value = "数值")
private Integer value;
private Double value;
@ApiModelProperty(value = "指标时间戳")
private Long metricTimeStamp;
......
......@@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
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.ApiModelProperty;
import lombok.Data;
import net.wanji.databus.config.DoubleToTwoDecimalPlacesSerializer;
import org.omg.CORBA.UNKNOWN;
import java.util.Date;
......@@ -121,6 +123,7 @@ public class CrossDataRealtimePO {
* 停车次数(次)
*/
@ApiModelProperty(value = "停车次数(次)", notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double stopTimes;
/**
* 延误时间(秒)
......
......@@ -3,9 +3,11 @@ package net.wanji.databus.po;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.databus.config.DoubleToTwoDecimalPlacesSerializer;
import java.util.Date;
......@@ -46,6 +48,7 @@ public class CrossDirDataRealtimePO {
@ApiModelProperty(name = "排队长度(米)",notes = "")
public Double queueLength;
@ApiModelProperty(name = "停车次数",notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
public Double stopTimes;
@ApiModelProperty(name = "延误时间",notes = "")
public Integer delayTime;
......
......@@ -2,9 +2,11 @@ package net.wanji.databus.po;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.databus.config.DoubleToTwoDecimalPlacesSerializer;
import java.util.Date;
......@@ -31,6 +33,7 @@ public class CrossLaneDataRealTimePO {
@ApiModelProperty(name = "排队长度(米)",notes = "")
private Double queueLength;
@ApiModelProperty(name = "停车次数",notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
private Double stopTimes;
@ApiModelProperty(name = "延误时间",notes = "")
private Integer delayTime;
......
......@@ -3,9 +3,11 @@ package net.wanji.databus.po;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.wanji.databus.config.DoubleToTwoDecimalPlacesSerializer;
import java.util.Date;
......@@ -54,6 +56,7 @@ public class CrossTurnDataRealtimePO {
public Double queueLength ;
/** 停车次数(次) */
@ApiModelProperty(name = "停车次数(次)",notes = "")
@JsonSerialize(using = DoubleToTwoDecimalPlacesSerializer.class)
public Double stopTimes ;
/** 延误时间(秒) */
@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