Explorar el Código

匹配功能优化

yuxy hace 6 horas
padre
commit
d529ed66f2

+ 10 - 11
service/randomMatch/src/main/java/com/zhentao/service/MatchService.java

@@ -122,8 +122,8 @@ public class MatchService {
                 continue;
             }
             
-            // 根据匹配模式进行额外筛选
-            if (!shouldMatchByMode(userData, od, matchMode)) {
+            // 精准模式下进行额外筛选,智能模式不筛选
+            if ("precise".equalsIgnoreCase(matchMode) && !shouldMatchByMode(userData, od, matchMode)) {
                 continue;
             }
             
@@ -209,16 +209,15 @@ public class MatchService {
                 // 计算匹配分数
                 double score = MatchingAlgorithmUtils.calculateMatchScore(userData, otherData);
                 
-                // 根据匹配模式进行额外筛选(但不阻断匹配)
-                boolean matchesModeRequirements = shouldMatchByMode(userData, otherData, matchMode);
-                // 精准模式下,如果不符合条件,降低分数但不完全排除
-                if (!matchesModeRequirements && "precise".equalsIgnoreCase(matchMode)) {
-                    // 精准模式下不符合条件的用户,分数打折
-                    score = score * 0.7;
-                } else if (!matchesModeRequirements) {
-                    // 其他模式下不符合条件直接跳过
-                    continue;
+                // 精准模式下进行额外筛选
+                if ("precise".equalsIgnoreCase(matchMode)) {
+                    boolean matchesModeRequirements = shouldMatchByMode(userData, otherData, matchMode);
+                    // 如果不符合精准模式条件,降低分数但不完全排除
+                    if (!matchesModeRequirements) {
+                        score = score * 0.7;
+                    }
                 }
+                // 智能模式和其他模式不进行额外筛选,接受所有用户
                 
                 scores.put(otherUserId, score);