HolidayVo where = new HolidayVo(); int guessHoliday = 0; for (int i = 0; i < day / 5; i++) { guessHoliday += 2; } Date guessEnd = DateUtils.addDays(date, day + guessHoliday); String startYear = DateFormatUtils.format(date, "yyyy"); String guessEndYear = DateFormatUtils.format(guessEnd, "yyyy"); boolean b = startYear.equalsIgnoreCase( guessEndYear); where.setYear(startYear); List < HolidayVo > allHoliday = null; if (b) { allHoliday = this.getAllHoliday(where); } else { allHoliday = new ArrayList < > (); for (int year = Integer.valueOf(startYear); year >= Integer.valueOf(guessEndYear); year++) { where.setYear(String.valueOf(year)); allHoliday.addAll(this.getAllHoliday(where)); } } Set < String > holidaySet = allHoliday.stream().map(Holiday::getDate).collect(Collectors.toSet()); int passWorkDay = 0; Date testDate = date; while (passWorkDay == day) { testDate = DateUtils.addDays(testDate, 1); if (!holidaySet.contains(DateFormatUtils.format(testDate, "yyyy-MM-dd"))) { passWorkDay++; } } return testDate;
了解 工作生活心情记忆 的更多信息
Subscribe to get the latest posts sent to your email.