添加投递状态

This commit is contained in:
zk
2026-03-20 20:22:40 +08:00
parent c75ad337a5
commit b5611a0f6c
2 changed files with 26 additions and 4 deletions
@@ -48,6 +48,9 @@ public class JobDto {
/** 是否收藏 */
private Boolean isFavorite;
/** 投递状态(null=未投递,0=已投递 1=面试中 2=有Offer 3=未通过 4=已结束) */
private Integer applicationStatus;
/** 匹配总分(0-90 */
private Integer matchScore;
@@ -22,9 +22,9 @@ import java.util.stream.Collectors;
/**
* 岗位服务
* <p>主要功能:岗位列表查询、岗位详情查询、岗位收藏管理、岗位不感兴趣管理、匹配度计算</p>
* <p>主要功能:岗位列表查询、岗位详情查询、岗位收藏管理、岗位不感兴趣管理、岗位投递管理、匹配度计算</p>
* <p>依赖服务:JobMatchService(匹配度计算)</p>
* <p>使用的表:bg_job、bg_company、bg_user_job_dislike、bg_user_job_favorite、bg_job_region、bg_china_regions_code、bg_job_category、bg_industry</p>
* <p>使用的表:bg_job、bg_company、bg_user_job_dislike、bg_user_job_favorite、bg_user_job_application、bg_job_region、bg_china_regions_code、bg_job_category、bg_industry</p>
*
* @author zk
*/
@@ -56,6 +56,9 @@ public class JobService {
@Autowired
private JobRegionRelationMapper jobRegionRelationMapper;
@Autowired
private UserJobApplicationMapper userJobApplicationMapper;
@Autowired
private JobMatchService jobMatchService;
@@ -96,14 +99,18 @@ public class JobService {
List<Long> jobIds = page.getRecords().stream().map(JobListItemVo::getId).collect(Collectors.toList());
Map<Long, Boolean> favoriteMap = getFavoriteMap(userId, jobIds);
// 8. 批量计算匹配度
// 8. 查询投递状态
Map<Long, Integer> applicationMap = getApplicationStatusMap(userId, jobIds);
// 9. 批量计算匹配度
Map<Long, Map<String, Integer>> matchScoreMap = jobMatchService.batchCalculateMatchScore(page.getRecords(), userId);
// 9. 组装返回数据
// 10. 组装返回数据
List<JobDto> dtoList = page.getRecords().stream().map(vo -> {
JobDto dto = new JobDto();
BeanUtils.copyProperties(vo, dto);
dto.setIsFavorite(favoriteMap.getOrDefault(vo.getId(), false));
dto.setApplicationStatus(applicationMap.get(vo.getId()));
Map<String, Integer> scoreMap = matchScoreMap.get(vo.getId());
if (scoreMap != null) {
JobMatchScoreDto matchScore = new JobMatchScoreDto(scoreMap.get("industryScore"), scoreMap.get("skillScore"), scoreMap.get("experienceScore"));
@@ -167,6 +174,18 @@ public class JobService {
return favorites.stream().collect(Collectors.toMap(UserJobFavorite::getJobId, f -> true));
}
/**
* 查询投递状态Map
* <p>批量查询用户对岗位的投递状态</p>
*/
private Map<Long, Integer> getApplicationStatusMap(Long userId, List<Long> jobIds) {
if (jobIds == null || jobIds.isEmpty()) {
return Collections.emptyMap();
}
List<UserJobApplication> applications = userJobApplicationMapper.selectList(new LambdaQueryWrapper<UserJobApplication>().eq(UserJobApplication::getUserId, userId).in(UserJobApplication::getJobId, jobIds));
return applications.stream().collect(Collectors.toMap(UserJobApplication::getJobId, UserJobApplication::getStatus));
}
/**
* 查询岗位详情