日计划下载,月报下载

This commit is contained in:
cwchen 2025-12-22 09:41:06 +08:00
parent 12376f7c48
commit 9ba46feeb5
1 changed files with 6 additions and 10 deletions

View File

@ -43,17 +43,13 @@ public class DownloadController {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate start = LocalDate.parse(startDate, formatter);
LocalDate end = LocalDate.parse(endDate, formatter);
boolean isSameYear = start.getYear() == end.getYear();
if (isSameYear) {
// 计算天数差绝对值防止传反
long daysDiff = Math.abs(ChronoUnit.DAYS.between(start, end));
if (daysDiff <= 31) {
downloadService.downloadExcelDayPlanStatistics(request, response, dto);
} else {
throw new ServiceException("当前仅支持导出间隔31天内的统计数据请修改日期范围。");
}
// boolean isSameYear = start.getYear() == end.getYear();
// 计算天数差绝对值防止传反
long daysDiff = Math.abs(ChronoUnit.DAYS.between(start, end));
if (daysDiff <= 31) {
downloadService.downloadExcelDayPlanStatistics(request, response, dto);
} else {
throw new ServiceException("当前仅支持导出同一年内的统计数据,请修改日期范围。");
throw new ServiceException("当前仅支持导出间隔31天内的统计数据请修改日期范围。");
}
}