Commit e890b951 authored by hanbing's avatar hanbing

[add] 绿波评价-底部曲线图指标入参改为指标名称

parent 96119270
...@@ -27,8 +27,8 @@ public class BottomCurveBO { ...@@ -27,8 +27,8 @@ public class BottomCurveBO {
@ApiModelProperty(value = "时间粒度(分钟)") @ApiModelProperty(value = "时间粒度(分钟)")
private Integer minutes; private Integer minutes;
@ApiModelProperty(value = "指标编号") @ApiModelProperty(value = "指标名称")
private String metricCode; private String metricName;
@ApiModelProperty(value = "开始时间 格式 yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "开始时间 格式 yyyy-MM-dd HH:mm:ss")
@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")
......
...@@ -107,10 +107,11 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService { ...@@ -107,10 +107,11 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
Integer scope = bo.getScope(); Integer scope = bo.getScope();
List<String> scopeList = bo.getScopeList(); List<String> scopeList = bo.getScopeList();
Integer minutes = bo.getMinutes(); Integer minutes = bo.getMinutes();
String metricCode = bo.getMetricCode(); String metricName = bo.getMetricName();
Date startTime = bo.getStartTime(); Date startTime = bo.getStartTime();
Date endTime = bo.getEndTime(); Date endTime = bo.getEndTime();
String metricCode = StrategyAndMetricsEnum.Metrics.getCodeByName(metricName);
if (scope != 1 && Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.LOAD_BALANCE.getCode())) { if (scope != 1 && Objects.equals(metricCode, StrategyAndMetricsEnum.Metrics.LOAD_BALANCE.getCode())) {
throw new RuntimeException("只有路口级别可选择负载均衡度"); throw new RuntimeException("只有路口级别可选择负载均衡度");
} }
......
...@@ -84,6 +84,15 @@ public class StrategyAndMetricsEnum { ...@@ -84,6 +84,15 @@ public class StrategyAndMetricsEnum {
return null; return null;
} }
public static String getCodeByName(String name) {
for (Metrics value : Metrics.values()) {
if (value.description.equals(name)) {
return value.code;
}
}
return null;
}
public static Metrics getEnumByCode(String code) { public static Metrics getEnumByCode(String code) {
for (Metrics value : Metrics.values()) { for (Metrics value : Metrics.values()) {
if (value.code.equals(code)) { if (value.code.equals(code)) {
......
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