public static LocalDate addBusinessDays(LocalDate startDate, Integer interval, Integer totalTimes, boolean needWeekend) {
System.out.println("使用时间: " + startDate);
totalTimes--;
int countInterval = interval;
//计数
int add = 0;
while (add < totalTimes) {
startDate = startDate.plusDays(1);
//如果不需要周末
if (!needWeekend) {
if (startDate.getDayOfWeek() == DayOfWeek.SATURDAY) {
if (countInterval > 1) {
countInterval--;
}
} else if (startDate.getDayOfWeek() == DayOfWeek.SUNDAY) {
if (countInterval > 0) {
countInterval--;
}
} else {
countInterval -= 1;
}
} else {
countInterval -= 1;
}
if (countInterval < 0) {
countInterval = interval;
add++;
System.out.println("使用时间: " + startDate);
}
}
return startDate;
}