Commit 2e08fe83 authored by hanbing's avatar hanbing

[update] 微观大数据平台-信号评价曲线图跨天时间排序

parent 9dde2e74
...@@ -652,16 +652,41 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService { ...@@ -652,16 +652,41 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
int round = (int) (Math.round(v)); int round = (int) (Math.round(v));
vo.setValue(round); vo.setValue(round);
} }
// 排序用
metricTimeStamp(vo, filteredList);
res.add(vo); res.add(vo);
} }
} }
} }
res.sort(Comparator.comparing(MainlineEvaluateBottomCurveVO::getMetricTime)); res.sort(Comparator.comparing(MainlineEvaluateBottomCurveVO::getMetricTimeStamp));
return res; return res;
} }
private void metricTimeStamp(MainlineEvaluateBottomCurveVO vo, List<CrossLaneDataHistPOExt> filteredList) {
CrossLaneDataHistPOExt po = filteredList.get(0);
if (po != null) {
Integer batchTime = po.getBatchTime();
String metricTime = vo.getMetricTime();
long batchTimeMillis = batchTime * 1000L;
Date batchDate = new Date(batchTimeMillis);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); // Set timezone to UTC
String datePart = dateFormat.format(batchDate);
String combinedDateTime = datePart + " " + metricTime;
SimpleDateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
Date finalDate = dateTimeFormat.parse(combinedDateTime);
long metricTimeStamp = finalDate.getTime();
vo.setMetricTimeStamp(metricTimeStamp);
} catch (Exception e) {
e.printStackTrace();
}
}
}
/** /**
* Rounds the given date to the nearest previous 5-minute interval. * Rounds the given date to the nearest previous 5-minute interval.
* *
......
...@@ -21,4 +21,7 @@ public class MainlineEvaluateBottomCurveVO { ...@@ -21,4 +21,7 @@ public class MainlineEvaluateBottomCurveVO {
@ApiModelProperty(value = "数值") @ApiModelProperty(value = "数值")
private Integer value; private Integer value;
@ApiModelProperty(value = "指标时间戳")
private Long metricTimeStamp;
} }
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