|
@@ -1,5 +1,6 @@
|
|
|
package com.tzld.piaoquan.recommend.server.service;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.google.common.base.Stopwatch;
|
|
|
import com.google.common.base.Strings;
|
|
@@ -7,6 +8,9 @@ import com.google.common.cache.CacheBuilder;
|
|
|
import com.google.common.cache.CacheLoader;
|
|
|
import com.google.common.cache.LoadingCache;
|
|
|
import com.tzld.piaoquan.recommend.server.common.RedisKeyConstants;
|
|
|
+import com.tzld.piaoquan.recommend.server.feign.GrowthManagerFeign;
|
|
|
+import com.tzld.piaoquan.recommend.server.feign.model.CommonResponse;
|
|
|
+import com.tzld.piaoquan.recommend.server.feign.model.VideoCharacteristicInfo;
|
|
|
import com.tzld.piaoquan.recommend.server.gen.common.Result;
|
|
|
import com.tzld.piaoquan.recommend.server.gen.recommend.*;
|
|
|
import com.tzld.piaoquan.recommend.server.model.MachineInfo;
|
|
@@ -71,12 +75,17 @@ public class RecommendService {
|
|
|
@Autowired
|
|
|
private FeatureService featureService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private GrowthManagerFeign growthManagerFeign;
|
|
|
+
|
|
|
private ThreadLocal<Map<String, Object>> timerLogMapTL = ThreadLocal.withInitial(HashMap::new);
|
|
|
|
|
|
@Value("${risk.video.filter.switch:true}")
|
|
|
private boolean riskVideoFilterSwitch;
|
|
|
@ApolloJsonValue("${risk.scene:[]}")
|
|
|
private Set<Long> riskScenes;
|
|
|
+ @ApolloJsonValue("${creative.info.feature.channel.name:[公众号代运营-即转]}")
|
|
|
+ private Set<String> creativeInfoFeatureChannelNameSet;
|
|
|
|
|
|
public static final String channelGroupPrefix = "alg_recsys_user_channel_group";
|
|
|
|
|
@@ -387,6 +396,10 @@ public class RecommendService {
|
|
|
param.setRecommendType(recommendType);
|
|
|
param.setRequestVideoId(request.getRequestVideoId());
|
|
|
param.setCurrentPageSource(request.getCurrentPageSource());
|
|
|
+
|
|
|
+ Map<String, String> creativeInfoFeature = this.getCreativeInfoFeature(request.getRootSourceId(), channelName, request.getUserShareDepth());
|
|
|
+ param.setCreativeInfoFeature(creativeInfoFeature);
|
|
|
+
|
|
|
return param;
|
|
|
}
|
|
|
|
|
@@ -472,6 +485,7 @@ public class RecommendService {
|
|
|
recallParam.setRecommendType(param.getRecommendType());
|
|
|
recallParam.setRequestVideoId(param.getRequestVideoId());
|
|
|
recallParam.setCurrentPageSource(param.getCurrentPageSource());
|
|
|
+ recallParam.setCreativeInfoFeature(param.getCreativeInfoFeature());
|
|
|
return recallParam;
|
|
|
}
|
|
|
|
|
@@ -503,6 +517,7 @@ public class RecommendService {
|
|
|
rankParam.setRecommendType(param.getRecommendType());
|
|
|
rankParam.setRequestVideoId(param.getRequestVideoId());
|
|
|
rankParam.setCurrentPageSource(param.getCurrentPageSource());
|
|
|
+ rankParam.setCreativeInfoFeature(param.getCreativeInfoFeature());
|
|
|
return rankParam;
|
|
|
}
|
|
|
|
|
@@ -614,4 +629,29 @@ public class RecommendService {
|
|
|
}
|
|
|
return rtShareList;
|
|
|
}
|
|
|
+
|
|
|
+ private Map<String, String> getCreativeInfoFeature(String rootSourceId, String channelName, int userShareDepth) {
|
|
|
+ Map<String, String> feature = new HashMap<>();
|
|
|
+ if (CollectionUtils.isEmpty(creativeInfoFeatureChannelNameSet) || StringUtils.isEmpty(channelName) || userShareDepth != 0) {
|
|
|
+ return feature;
|
|
|
+ }
|
|
|
+ if (!creativeInfoFeatureChannelNameSet.contains(channelName)) {
|
|
|
+ return feature;
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ CommonResponse<VideoCharacteristicInfo> videoCharacteristic = growthManagerFeign.getVideoCharacteristic(rootSourceId);
|
|
|
+ if (videoCharacteristic.getCode() == 0) {
|
|
|
+ VideoCharacteristicInfo data = videoCharacteristic.getData();
|
|
|
+ feature.put("ghId", data.getGhId());
|
|
|
+ feature.put("name", data.getName());
|
|
|
+ feature.put("videoId", data.getVideoId());
|
|
|
+ feature.put("title", data.getTitle());
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("getCreativeInfoFeature rootSourceId: {} \n", rootSourceId, e);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return feature;
|
|
|
+ }
|
|
|
}
|