(improvement) (semantic) support metric data batch download (#358)

Co-authored-by: jolunoluo
This commit is contained in:
LXW
2023-11-10 16:35:17 +08:00
committed by GitHub
parent e537b738e4
commit 8ed7e91221
14 changed files with 589 additions and 67 deletions

View File

@@ -6,9 +6,12 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import com.tencent.supersonic.common.pojo.Constants;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@@ -126,4 +129,24 @@ public class DateUtils {
return !timeString.equals("00:00:00");
}
public static List<String> getDateList(String startDateStr, String endDateStr, String period) {
LocalDate startDate = LocalDate.parse(startDateStr);
LocalDate endDate = LocalDate.parse(endDateStr);
List<String> datesInRange = new ArrayList<>();
LocalDate currentDate = startDate;
while (!currentDate.isAfter(endDate)) {
datesInRange.add(currentDate.format(DateTimeFormatter.ISO_DATE));
if (Constants.MONTH.equals(period)) {
currentDate = currentDate.plusMonths(1);
} else if (Constants.WEEK.equals(period)) {
currentDate = currentDate.plusWeeks(1);
} else {
currentDate = currentDate.plusDays(1);
}
}
return datesInRange;
}
}