From 78e151d4eee6f24d5cef95a953f9e06f29b958e9 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 1 May 2024 01:44:07 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BC=98=E5=8C=96=E3=80=91=E9=99=8D?= =?UTF-8?q?=E4=BD=8E=20JDK=2021=20=E6=9C=80=E4=BD=8E=E5=88=B0=2017=20?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../common/util/date/LocalDateTimeUtils.java | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 6106623ac..290bc9dd3 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ 2.0.1-snapshot - 21 + 17 ${java.version} ${java.version} 3.2.2 diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java index acc93ad8c..c3b3b53fb 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java @@ -227,27 +227,27 @@ public class LocalDateTimeUtils { // 2. 循环,生成时间范围 List timeRanges = new ArrayList<>(); switch (intervalEnum) { - case DateIntervalEnum.DAY: + case DAY: while (startTime.isBefore(endTime)) { timeRanges.add(new LocalDateTime[]{startTime, startTime.plusDays(1).minusNanos(1)}); startTime = startTime.plusDays(1); } break; - case DateIntervalEnum.WEEK: + case WEEK: while (startTime.isBefore(endTime)) { LocalDateTime endOfWeek = startTime.with(DayOfWeek.SUNDAY).plusDays(1).minusNanos(1); timeRanges.add(new LocalDateTime[]{startTime, endOfWeek}); startTime = endOfWeek.plusNanos(1); } break; - case DateIntervalEnum.MONTH: + case MONTH: while (startTime.isBefore(endTime)) { LocalDateTime endOfMonth = startTime.with(TemporalAdjusters.lastDayOfMonth()).plusDays(1).minusNanos(1); timeRanges.add(new LocalDateTime[]{startTime, endOfMonth}); startTime = endOfMonth.plusNanos(1); } break; - case DateIntervalEnum.QUARTER: + case QUARTER: while (startTime.isBefore(endTime)) { int quarterOfYear = getQuarterOfYear(startTime); LocalDateTime quarterEnd = quarterOfYear == 4 @@ -257,7 +257,7 @@ public class LocalDateTimeUtils { startTime = quarterEnd.plusNanos(1); } break; - case DateIntervalEnum.YEAR: + case YEAR: while (startTime.isBefore(endTime)) { LocalDateTime endOfYear = startTime.with(TemporalAdjusters.lastDayOfYear()).plusDays(1).minusNanos(1); timeRanges.add(new LocalDateTime[]{startTime, endOfYear}); @@ -290,16 +290,16 @@ public class LocalDateTimeUtils { // 2. 循环,生成时间范围 switch (intervalEnum) { - case DateIntervalEnum.DAY: + case DAY: return LocalDateTimeUtil.format(startTime, DatePattern.NORM_DATE_PATTERN); - case DateIntervalEnum.WEEK: + case WEEK: return LocalDateTimeUtil.format(startTime, DatePattern.NORM_DATE_PATTERN) + StrUtil.format("(第 {} 周)", LocalDateTimeUtil.weekOfYear(startTime)); - case DateIntervalEnum.MONTH: + case MONTH: return LocalDateTimeUtil.format(startTime, DatePattern.NORM_MONTH_PATTERN); - case DateIntervalEnum.QUARTER: + case QUARTER: return StrUtil.format("{}-Q{}", startTime.getYear(), getQuarterOfYear(startTime)); - case DateIntervalEnum.YEAR: + case YEAR: return LocalDateTimeUtil.format(startTime, DatePattern.NORM_YEAR_PATTERN); default: throw new IllegalArgumentException("Invalid interval: " + interval);