diff --git a/manager/src/main/java/org/jiayunet/service/JobMatchService.java b/manager/src/main/java/org/jiayunet/service/JobMatchService.java
index 68179d2..2b9d666 100644
--- a/manager/src/main/java/org/jiayunet/service/JobMatchService.java
+++ b/manager/src/main/java/org/jiayunet/service/JobMatchService.java
@@ -148,37 +148,34 @@ public class JobMatchService {
/**
* 计算方向适配得分 fitScore(百分制)
*
基于 AI 推荐的岗位方向/行业方向与岗位实际类型/公司行业做层级匹配
- * fitScore = 岗位类型分×70% + 行业分×30%
- * 用户未做过 AI 分析(无 AI 推荐方向)时返回 0
+ * fitScore = min(100, 岗位类型分×0.9 + 行业分×0.6):两项加法叠加,均强相关时溢出封顶 100
+ * 用户未做过 AI 分析(无任何 AI 推荐方向)时返回中性分 40(方向未知,疑罪从无)
*/
private int calculateFitScore(JobListItemVo job, List aiCategoryIds, List aiIndustryIds,
Map categoryMap, Map industryMap) {
boolean noCategory = aiCategoryIds == null || aiCategoryIds.isEmpty();
boolean noIndustry = aiIndustryIds == null || aiIndustryIds.isEmpty();
- // 无任何 AI 推荐方向 → 不参与加分
+ // 无任何 AI 推荐方向 → 方向未知,给中性分
if (noCategory && noIndustry) {
- return 0;
+ return 40;
}
- int categoryScore = calculateCategoryFit(aiCategoryIds, job.getCategoryId(), categoryMap);
- int industryScore = calculateIndustryFit(aiIndustryIds, job.getCompanyIndustryId(), industryMap);
+ double categoryContribution = noCategory ? 0 : calculateCategoryFit(aiCategoryIds, job.getCategoryId(), categoryMap) * 0.9;
+ double industryContribution = noIndustry ? 0 : calculateIndustryFit(aiIndustryIds, job.getCompanyIndustryId(), industryMap) * 0.6;
- return (int) Math.round(categoryScore * 0.7 + industryScore * 0.3);
+ return Math.min(100, (int) Math.round(categoryContribution + industryContribution));
}
/**
* 计算岗位类型方向匹配分(三级树,取 AI 推荐中的最高分)
- * 同三级→100,同二级→70,同一级→30,否则→0
+ * 同三级→100,同二级→90,同一级→85,不相关→10(保底)
*/
private int calculateCategoryFit(List aiCategoryIds, Long jobCategoryId, Map categoryMap) {
- if (aiCategoryIds == null || aiCategoryIds.isEmpty() || jobCategoryId == null) {
- return 0;
- }
- JobCategory jobCategory = categoryMap.get(jobCategoryId);
+ JobCategory jobCategory = jobCategoryId == null ? null : categoryMap.get(jobCategoryId);
if (jobCategory == null) {
- return 0;
+ return 10;
}
- int maxScore = 0;
+ int maxScore = 10;
for (Long aiId : aiCategoryIds) {
JobCategory aiCategory = categoryMap.get(aiId);
if (aiCategory == null) continue;
@@ -186,11 +183,11 @@ public class JobMatchService {
if (aiCategory.getId().equals(jobCategory.getId())) {
score = 100;
} else if (aiCategory.getParentId() != null && aiCategory.getParentId().equals(jobCategory.getParentId())) {
- score = 70;
+ score = 90;
} else if (aiCategory.getRootId() != null && aiCategory.getRootId().equals(jobCategory.getRootId())) {
- score = 30;
+ score = 85;
} else {
- score = 0;
+ score = 10;
}
maxScore = Math.max(maxScore, score);
if (maxScore == 100) return 100;
@@ -200,17 +197,14 @@ public class JobMatchService {
/**
* 计算行业方向匹配分(两级树,取 AI 推荐中的最高分)
- * 同二级→100,同一级→60,否则→0
+ * 同二级→100,同一级→90,不相关→10(保底)
*/
private int calculateIndustryFit(List aiIndustryIds, Long companyIndustryId, Map industryMap) {
- if (aiIndustryIds == null || aiIndustryIds.isEmpty() || companyIndustryId == null) {
- return 0;
- }
- Industry companyIndustry = industryMap.get(companyIndustryId);
+ Industry companyIndustry = companyIndustryId == null ? null : industryMap.get(companyIndustryId);
if (companyIndustry == null) {
- return 0;
+ return 10;
}
- int maxScore = 0;
+ int maxScore = 10;
for (Long aiId : aiIndustryIds) {
Industry aiIndustry = industryMap.get(aiId);
if (aiIndustry == null) continue;
@@ -218,9 +212,9 @@ public class JobMatchService {
if (aiIndustry.getId().equals(companyIndustry.getId())) {
score = 100;
} else if (aiIndustry.getParentId() != null && aiIndustry.getParentId().equals(companyIndustry.getParentId())) {
- score = 60;
+ score = 90;
} else {
- score = 0;
+ score = 10;
}
maxScore = Math.max(maxScore, score);
if (maxScore == 100) return 100;