소스 검색

Merge branch 'feature_20260511' of algorithm/recommend-server into master

zhaohaipeng 1 주 전
부모
커밋
a82d0122ae

+ 5 - 1
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/recall/strategy/YearReturnCate2RecallStrategy.java

@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
 import org.apache.commons.lang3.tuple.MutablePair;
 import org.apache.commons.lang3.tuple.Pair;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -96,7 +97,10 @@ public class YearReturnCate2RecallStrategy implements RecallStrategy {
         }
 
         for (int i = 0; i < actVidSeq.size(); i++) {
-            long videoIdL = Long.parseLong(actVidSeq.get(i));
+            long videoIdL = NumberUtils.toLong(actVidSeq.get(i), -1);
+            if (videoIdL <= 0){
+                continue;
+            }
             String type = actTypeSeq.get(i);
             if (!"click".equals(type)) {
                 continue;

+ 5 - 1
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/recall/strategy/YearShareCate1RecallStrategy.java

@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -109,7 +110,10 @@ public class YearShareCate1RecallStrategy implements RecallStrategy {
         }
 
         for (int i = 0; i < actVidSeq.size(); i++) {
-            long videoIdL = Long.parseLong(actVidSeq.get(i));
+            long videoIdL = NumberUtils.toLong(actVidSeq.get(i), -1);
+            if (videoIdL <= 0){
+                continue;
+            }
             String type = actTypeSeq.get(i);
             if (!"share".equals(type)) {
                 continue;

+ 5 - 1
recommend-server-service/src/main/java/com/tzld/piaoquan/recommend/server/service/recall/strategy/YearShareCate2RecallStrategy.java

@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.math.NumberUtils;
 import org.apache.commons.lang3.tuple.Pair;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
@@ -108,7 +109,10 @@ public class YearShareCate2RecallStrategy implements RecallStrategy {
         }
 
         for (int i = 0; i < actVidSeq.size(); i++) {
-            long videoIdL = Long.parseLong(actVidSeq.get(i));
+            long videoIdL = NumberUtils.toLong(actVidSeq.get(i), -1);
+            if (videoIdL <= 0){
+                continue;
+            }
             String type = actTypeSeq.get(i);
             if (!"share".equals(type)) {
                 continue;