mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-15 14:36:47 +00:00
(improvement) (semantic) support metric data batch download (#358)
Co-authored-by: jolunoluo
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user