Skip to content

Commit e7d129b

Browse files
authored
Merge pull request #57 from Boyuan-IT-Club/Red_Moon
暂定面试时间为27、28日,添加一个指定面试时间生成面试时间槽的函数
2 parents ceb1ed1 + c4e84b0 commit e7d129b

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

src/main/java/club/boyuan/official/service/impl/InterviewAssignmentServiceImpl.java

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ public InterviewAssignmentResultDTO assignInterviews(Integer cycleId) {
7474
Map<Integer, List<String>> userPreferredTimes = getUserPreferredTimes(resumes, interviewTimeField.getFieldId());
7575
Map<Integer, List<String>> userPreferredDepartments = getUserPreferredDepartments(resumes, expectedDepartmentsField.getFieldId());
7676

77-
// 初始化各部门面试时间槽
78-
List<LocalDateTime> timeSlots = generateTimeSlots(cycle.getStartDate(), cycle.getEndDate());
77+
// 初始化各部门面试时间槽 (将Day1设置为9月27日,Day2设置为9月28日)
78+
LocalDate day1 = LocalDate.of(2025, 9, 27);
79+
LocalDate day2 = LocalDate.of(2025, 9, 28);
80+
List<LocalDateTime> timeSlots = generateTimeSlotsForSpecificDays(day1, day2);
7981
Map<String, Map<LocalDateTime, Boolean>> departmentSlotAvailability = initializeDepartmentSlotAvailability(timeSlots, userPreferredDepartments);
8082

8183
// 分配面试时间
@@ -200,7 +202,30 @@ private Map<Integer, List<String>> getUserPreferredDepartments(List<Resume> resu
200202
}
201203

202204
/**
203-
* 生成面试时间槽
205+
* 为特定日期生成面试时间槽 (Day1为9月27日,Day2为9月28日)
206+
*/
207+
private List<LocalDateTime> generateTimeSlotsForSpecificDays(LocalDate day1, LocalDate day2) {
208+
List<LocalDateTime> timeSlots = new ArrayList<>();
209+
210+
// 为指定的两天生成面试时间槽
211+
LocalDate[] dates = {day1, day2};
212+
for (LocalDate date : dates) {
213+
// 生成上午时间段 (9:00-11:00)
214+
for (LocalTime time = MORNING_START; time.isBefore(MORNING_END); time = time.plusMinutes(INTERVIEW_DURATION)) {
215+
timeSlots.add(LocalDateTime.of(date, time));
216+
}
217+
218+
// 生成下午时间段 (13:00-17:00)
219+
for (LocalTime time = AFTERNOON_START; time.isBefore(AFTERNOON_END); time = time.plusMinutes(INTERVIEW_DURATION)) {
220+
timeSlots.add(LocalDateTime.of(date, time));
221+
}
222+
}
223+
224+
return timeSlots;
225+
}
226+
227+
/**
228+
* 生成面试时间槽(原始方法,基于招募周期)
204229
*/
205230
private List<LocalDateTime> generateTimeSlots(LocalDate startDate, LocalDate endDate) {
206231
List<LocalDateTime> timeSlots = new ArrayList<>();
@@ -246,7 +271,7 @@ private Map<String, Map<LocalDateTime, Boolean>> initializeDepartmentSlotAvailab
246271
}
247272

248273
// 默认添加一些常见部门
249-
String[] defaultDepartments = {"技术部", "产品部", "设计部", "运营部"};
274+
String[] defaultDepartments = {"技术部", "媒体部", "项目部", "综合部"};
250275
for (String department : defaultDepartments) {
251276
if (!departmentSlotAvailability.containsKey(department)) {
252277
Map<LocalDateTime, Boolean> slotAvailability = new HashMap<>();

0 commit comments

Comments
 (0)