Skip to content

Commit 1c0c499

Browse files
committed
优化了一键分配面试时间地点的接口,使其能对应面试时段表中的时间自动分配
1 parent 7472046 commit 1c0c499

13 files changed

+1782
-19
lines changed

mvnw

100644100755
File mode changed.

pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@
9797
<optional>true</optional>
9898
</dependency>
9999

100+
<!--swagger依赖-->
101+
<dependency>
102+
<groupId>org.springdoc</groupId>
103+
<artifactId>springdoc-openapi-ui</artifactId>
104+
<version>1.6.14</version>
105+
</dependency>
106+
100107
<dependency>
101108
<groupId>org.springframework.boot</groupId>
102109
<artifactId>spring-boot-starter-mail</artifactId>

src/main/java/club/boyuan/official/controller/InterviewResultController.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,18 @@ public ResponseEntity<ResponseMessage<InterviewResult>> update(@PathVariable Int
7777
.body(ResponseMessage.error(400, "更新面试结果失败"));
7878
}
7979
}
80+
81+
//根据resultId获取面试结果
82+
@GetMapping("/get/{resultId}")
83+
public ResponseEntity<ResponseMessage<InterviewResult>> get(@PathVariable Integer resultId) {
84+
try {
85+
log.info("获取面试结果");
86+
InterviewResult result = interviewResultService.getById(resultId);
87+
return ResponseEntity.ok(ResponseMessage.success(result));
88+
} catch (Exception e) {
89+
log.error("获取面试结果失败", e);
90+
return ResponseEntity.badRequest()
91+
.body(ResponseMessage.error(400, "获取面试结果失败"));
92+
}
93+
}
8094
}
Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
package club.boyuan.official.controller;
22

3-
4-
import org.springframework.web.bind.annotation.RequestMapping;
5-
6-
import org.springframework.web.bind.annotation.RestController;
3+
import club.boyuan.official.dto.AutoAssignInterviewResponseDTO;
4+
import club.boyuan.official.dto.ResponseMessage;
5+
import club.boyuan.official.service.IInterviewScheduleService;
6+
import jakarta.validation.Valid;
7+
import lombok.AllArgsConstructor;
8+
import lombok.extern.slf4j.Slf4j;
9+
import org.springframework.http.ResponseEntity;
10+
import org.springframework.security.access.prepost.PreAuthorize;
11+
import org.springframework.web.bind.annotation.*;
712

813
/**
914
* <p>
@@ -13,8 +18,33 @@
1318
* @author dhy
1419
* @since 2026-01-28
1520
*/
21+
@Slf4j
1622
@RestController
17-
@RequestMapping("/interview-schedule")
23+
@RequestMapping("/api/interview/schedule")
24+
@AllArgsConstructor
1825
public class InterviewScheduleController {
1926

20-
}
27+
private final IInterviewScheduleService interviewScheduleService;
28+
29+
/**
30+
* 一键分配面试成员面试时间地点(按招募周期)- 路径参数版本
31+
*
32+
* @param cycleId 招募周期ID
33+
* @return 分配结果
34+
*/
35+
@PostMapping("/auto-assign/{cycleId}")
36+
@PreAuthorize("hasAuthority(('resume:audit'))")
37+
public ResponseEntity<ResponseMessage<AutoAssignInterviewResponseDTO>> autoAssignInterviewsByCycleId(
38+
@PathVariable Integer cycleId) {
39+
try {
40+
log.info("开始一键分配面试,招募周期ID: {}", cycleId);
41+
AutoAssignInterviewResponseDTO result = interviewScheduleService.autoAssignInterviews(cycleId);
42+
log.info("一键分配面试完成,已分配 {} 人", result.getAssignedCount());
43+
return ResponseEntity.ok(ResponseMessage.success(result));
44+
} catch (Exception e) {
45+
log.error("一键分配面试失败,招募周期ID: {}", cycleId, e);
46+
return ResponseEntity.badRequest()
47+
.body(ResponseMessage.error(400, "分配失败: " + e.getMessage()));
48+
}
49+
}
50+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package club.boyuan.official.dto;
2+
3+
import lombok.AllArgsConstructor;
4+
import lombok.Data;
5+
import lombok.NoArgsConstructor;
6+
7+
import java.time.LocalDate;
8+
import java.time.LocalTime;
9+
10+
@Data
11+
@AllArgsConstructor
12+
@NoArgsConstructor
13+
public class SlotTimeDTO {
14+
private LocalDate date;
15+
private LocalTime startTime;
16+
private LocalTime endTime;
17+
18+
}

src/main/java/club/boyuan/official/service/IInterviewScheduleService.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package club.boyuan.official.service;
22

3+
import club.boyuan.official.dto.AutoAssignInterviewResponseDTO;
34
import club.boyuan.official.entity.InterviewSchedule;
45
import com.baomidou.mybatisplus.extension.service.IService;
56

@@ -13,4 +14,11 @@
1314
*/
1415
public interface IInterviewScheduleService extends IService<InterviewSchedule> {
1516

17+
/**
18+
* 一键分配面试成员面试时间地点(按招募周期)
19+
*
20+
* @param cycleId 分配请求参数
21+
* @return 分配结果
22+
*/
23+
AutoAssignInterviewResponseDTO autoAssignInterviews(Integer cycleId);
1624
}

src/main/java/club/boyuan/official/service/IInterviewSlotService.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import com.baomidou.mybatisplus.extension.service.IService;
88
import jakarta.validation.Valid;
99

10+
import java.util.List;
11+
1012
/**
1113
* <p>
1214
* 面试时段配置表 服务类
@@ -22,4 +24,19 @@ public interface IInterviewSlotService extends IService<InterviewSlot> {
2224
InterviewSlot updateInterviewSlot(Integer slotId, UpdateInterviewSlotDTO requestDTO);
2325

2426
GetInterviewSlotListResponseDTO listInterviewSlots(Integer cycleId, String interviewDate, String startTime, String location, Integer status, Integer interviewType, Integer page, Integer size);
27+
28+
/**
29+
* 根据招募周期ID获取可用的面试时间槽
30+
* @param cycleId 招募周期ID
31+
* @return 可用的面试时间槽列表
32+
*/
33+
List<InterviewSlot> getAvailableSlotsByCycleId(Integer cycleId);
34+
35+
/**
36+
* 根据招募周期ID获取所有面试时间槽(包括已占用的)
37+
* @param cycleId 招募周期ID
38+
* @return 所有面试时间槽列表
39+
*/
40+
List<InterviewSlot> getAllSlotsByCycleId(Integer cycleId);
41+
2542
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
package club.boyuan.official.service;
2+
3+
import club.boyuan.official.entity.Resume;
4+
import club.boyuan.official.entity.ResumeFieldDefinition;
5+
6+
import java.util.List;
7+
import java.util.Map;
8+
9+
/**
10+
* 简历数据服务接口
11+
* 专门处理简历字段定义和字段值解析相关功能
12+
*/
13+
public interface ResumeDataService {
14+
15+
/**
16+
* 获取指定周期的面试时间字段定义
17+
* @param cycleId 招募周期ID
18+
* @return 面试时间字段定义,未找到返回null
19+
*/
20+
ResumeFieldDefinition getInterviewTimeFieldDefinition(Integer cycleId);
21+
22+
/**
23+
* 获取指定周期的期望部门字段定义
24+
* @param cycleId 招募周期ID
25+
* @return 期望部门字段定义,未找到返回null
26+
*/
27+
ResumeFieldDefinition getExpectedDepartmentsFieldDefinition(Integer cycleId);
28+
29+
/**
30+
* 批量获取用户面试时间偏好
31+
* @param resumes 简历列表
32+
* @param fieldId 时间字段ID
33+
* @return Map<用户ID, 时间偏好列表>
34+
*/
35+
Map<Integer, List<String>> getUserPreferredTimes(List<Resume> resumes, Integer fieldId);
36+
37+
/**
38+
* 批量获取用户期望部门
39+
* @param resumes 简历列表
40+
* @param fieldId 部门字段ID
41+
* @return Map<用户ID, 部门偏好列表>
42+
*/
43+
Map<Integer, List<String>> getUserPreferredDepartments(List<Resume> resumes, Integer fieldId);
44+
45+
/**
46+
* 从简历中获取姓名字段值
47+
* @param resume 简历对象
48+
* @return 姓名字段值
49+
*/
50+
String getResumeName(Resume resume);
51+
52+
/**
53+
* 从简历中获取邮箱字段值
54+
* @param resume 简历对象
55+
* @return 邮箱字段值
56+
*/
57+
String getResumeEmail(Resume resume);
58+
59+
/**
60+
* 从简历中获取专业字段值
61+
* @param resume 简历对象
62+
* @return 专业字段值
63+
*/
64+
String getResumeMajor(Resume resume);
65+
66+
/**
67+
* 从简历中获取年级字段值
68+
* @param resume 简历对象
69+
* @return 年级字段值
70+
*/
71+
String getResumeGrade(Resume resume);
72+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class InterviewAssignmentServiceImpl implements IInterviewAssignmentServi
4949
private static final int INTERVIEW_DURATION = 10; // 面试时长10分钟
5050

5151
@Override
52-
public InterviewAssignmentResultDTO assignInterviews(Integer cycleId) {
52+
public InterviewAssignmentResultDTO assignInterviews(Integer cycleId) {
5353
logger.info("开始为招募周期ID {} 分配面试时间", cycleId);
5454

5555
// 获取招募周期信息

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ public InterviewResult update(Integer resultId, InterviewResultSaveDTO interview
118118
//从 Spring Security 获取userId
119119
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
120120
Integer userId = null;
121-
122121
if (authentication != null) {
123122
Object principal = authentication.getPrincipal();
124123

@@ -134,7 +133,6 @@ public InterviewResult update(Integer resultId, InterviewResultSaveDTO interview
134133
userId = user != null ? user.getUserId() : null;
135134
}
136135
}
137-
138136
if (userId != null) {
139137
interviewResult.setDecisionBy(userId);
140138
}

0 commit comments

Comments
 (0)