新增数据统计页面
This commit was merged in pull request #47.
This commit is contained in:
@@ -67,7 +67,12 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>5.2.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Fix commons-compress version for POI compatibility -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Gym Modules -->
|
||||
|
||||
+6
@@ -59,6 +59,12 @@ public class DataStatistics {
|
||||
public static final String WEEK = "WEEK";
|
||||
/** 月统计 */
|
||||
public static final String MONTH = "MONTH";
|
||||
/** 近30天 */
|
||||
public static final String LAST_30_DAYS = "LAST_30_DAYS";
|
||||
/** 近90天 */
|
||||
public static final String LAST_90_DAYS = "LAST_90_DAYS";
|
||||
/** 今年 */
|
||||
public static final String YEAR = "YEAR";
|
||||
|
||||
private PeriodType() {}
|
||||
}
|
||||
|
||||
+19
-6
@@ -458,13 +458,16 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
|
||||
String periodType = query.getPeriodType();
|
||||
|
||||
if (DataStatistics.PeriodType.WEEK.equals(periodType)) {
|
||||
// 周统计:本周一
|
||||
return today.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).atStartOfDay();
|
||||
} else if (DataStatistics.PeriodType.MONTH.equals(periodType)) {
|
||||
// 月统计:本月第一天
|
||||
return today.withDayOfMonth(1).atStartOfDay();
|
||||
} else if (DataStatistics.PeriodType.LAST_30_DAYS.equals(periodType)) {
|
||||
return today.minusDays(29).atStartOfDay();
|
||||
} else if (DataStatistics.PeriodType.LAST_90_DAYS.equals(periodType)) {
|
||||
return today.minusDays(89).atStartOfDay();
|
||||
} else if (DataStatistics.PeriodType.YEAR.equals(periodType)) {
|
||||
return today.withDayOfYear(1).atStartOfDay();
|
||||
} else {
|
||||
// 日统计:当天零点
|
||||
return today.atStartOfDay();
|
||||
}
|
||||
}
|
||||
@@ -478,13 +481,14 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
|
||||
String periodType = query.getPeriodType();
|
||||
|
||||
if (DataStatistics.PeriodType.WEEK.equals(periodType)) {
|
||||
// 周统计:本周日 23:59:59
|
||||
return today.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY)).atTime(23, 59, 59);
|
||||
} else if (DataStatistics.PeriodType.MONTH.equals(periodType)) {
|
||||
// 月统计:本月最后一天 23:59:59
|
||||
return today.with(TemporalAdjusters.lastDayOfMonth()).atTime(23, 59, 59);
|
||||
} else if (DataStatistics.PeriodType.LAST_30_DAYS.equals(periodType)
|
||||
|| DataStatistics.PeriodType.LAST_90_DAYS.equals(periodType)
|
||||
|| DataStatistics.PeriodType.YEAR.equals(periodType)) {
|
||||
return LocalDateTime.now();
|
||||
} else {
|
||||
// 日统计:当前时间
|
||||
return LocalDateTime.now();
|
||||
}
|
||||
}
|
||||
@@ -503,6 +507,15 @@ public class DataStatisticsServiceImpl implements IDataStatisticsService {
|
||||
} else if (DataStatistics.PeriodType.MONTH.equals(periodType)) {
|
||||
startTime = date.withDayOfMonth(1).atStartOfDay();
|
||||
endTime = date.with(TemporalAdjusters.lastDayOfMonth()).atTime(23, 59, 59);
|
||||
} else if (DataStatistics.PeriodType.LAST_30_DAYS.equals(periodType)) {
|
||||
startTime = date.minusDays(29).atStartOfDay();
|
||||
endTime = date.atTime(23, 59, 59);
|
||||
} else if (DataStatistics.PeriodType.LAST_90_DAYS.equals(periodType)) {
|
||||
startTime = date.minusDays(89).atStartOfDay();
|
||||
endTime = date.atTime(23, 59, 59);
|
||||
} else if (DataStatistics.PeriodType.YEAR.equals(periodType)) {
|
||||
startTime = date.withDayOfYear(1).atStartOfDay();
|
||||
endTime = date.atTime(23, 59, 59);
|
||||
} else {
|
||||
startTime = date.atStartOfDay();
|
||||
endTime = date.plusDays(1).atStartOfDay();
|
||||
|
||||
Reference in New Issue
Block a user