|
@@ -547,7 +547,7 @@ public class IotStaticController {
|
|
|
abc.put("createTime", e.getCreateTime());
|
|
|
return abc;
|
|
|
}).collect(Collectors.toList());
|
|
|
- Map<String, Long> fillMap = countRecordsByDate(fills, 7);
|
|
|
+ LinkedHashMap<String, Long> fillMap = countRecordsByDate(fills, 7);
|
|
|
LinkedList<Object> xAxis = new LinkedList<>();
|
|
|
LinkedList<Object> fillData = new LinkedList<>();
|
|
|
fillMap.forEach( (k,v)->{
|
|
@@ -624,13 +624,13 @@ public class IotStaticController {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public static Map<String, Long> countRecordsByDate(List<Map<String, Object>> records, int days) {
|
|
|
+ public static LinkedHashMap<String, Long> countRecordsByDate(List<Map<String, Object>> records, int days) {
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
LocalDate today = LocalDate.now();
|
|
|
|
|
|
// 生成近七天的日期列表
|
|
|
- Map<String, Long> dateMap = new HashMap<>();
|
|
|
- for (int i = 0; i < days; i++) {
|
|
|
+ LinkedHashMap<String, Long> dateMap = new LinkedHashMap<>();
|
|
|
+ for (int i = days-1; i >= 0; i--) {
|
|
|
LocalDate date = today.minusDays(i);
|
|
|
dateMap.put(date.format(formatter), 0L);
|
|
|
}
|