| 
					
				 | 
			
			
				@@ -2,7 +2,13 @@ package com.tzld.longarticle.recommend.server.service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.common.enums.RankStrategyEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.mapper.crawler.ArticleUserGroupMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.dto.Content; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.model.entity.crawler.PublishContentSortLog; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.tzld.longarticle.recommend.server.model.entity.crawler.PublishSortLog; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.param.RecommendParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.param.RecommendRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.model.vo.ArticleSortResponseData; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -12,10 +18,6 @@ import com.tzld.longarticle.recommend.server.model.vo.RecommendWithUserGroupResp 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.repository.crawler.AccountAvgInfoRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.repository.crawler.PublishContentSortLogRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.repository.crawler.PublishSortLogRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.tzld.longarticle.recommend.server.model.entity.crawler.PublishContentSortLog; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.tzld.longarticle.recommend.server.model.entity.crawler.PublishSortLog; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.tzld.longarticle.recommend.server.mapper.crawler.ArticleUserGroupMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.service.rank.RankParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.service.rank.RankResult; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.longarticle.recommend.server.service.rank.RankService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -63,6 +65,8 @@ public class RecommendService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     AccountAvgInfoRepository accountAvgInfoRepository; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private ArticleUserGroupMapper articleUserGroupMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private AigcBaseMapper aigcBaseMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @ApolloJsonValue("${accountStrategyConfig:{}}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private Map<String, String> accountStrategyConfigMap; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -75,20 +79,30 @@ public class RecommendService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         RecommendParam param = genRecommendParam(request, SceneConstants.DEFAULT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log.info("genRecommendParam {}", JSONUtils.toJson(param)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 获取账号排序设置 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String strategyConfig = accountStrategyConfigMap.get(request.getAccountName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (StringUtils.hasText(strategyConfig) && !request.isParamStrategy()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            param.setStrategy(strategyConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        setStrategy(request, param); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         RecallResult recallResult = recallService.recall(convertToRecallParam(param)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         RankResult rankResult = rankService.rank(convertToRankParam(param, recallResult)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //log.info("rankResult {}", JSONUtils.toJson(rankResult)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         saveSortLog(param, rankResult); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return buildRecommendResponse(recallResult, rankResult, param.getPublishNum()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void setStrategy(RecommendRequest request, RecommendParam param) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String strategyConfig = accountStrategyConfigMap.get(request.getAccountName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (StringUtils.hasText(strategyConfig) && !request.isParamStrategy()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            param.setStrategy(strategyConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (DateUtils.getCurrentHour() >= 19) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Integer pushType = aigcBaseMapper.getPublishPlanPushType(request.getPlanId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (Objects.equals(2, pushType)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                param.setStrategy(RankStrategyEnum.late_Strategy.getStrategy()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public RecommendWithUserGroupResponse recommend4FwhColdStart(RecommendRequest request) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         RecommendParam param = genRecommendParam(request, FWH_COLD_START); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -99,10 +113,8 @@ public class RecommendService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             param.setStrategy(strategyConfig); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         RecallResult recallResult = recallService.recall(convertToRecallParam(param)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //log.info("recallResult {}", JSONUtils.toJson(recallResult)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         RankResult rankResult = rankService.rank(convertToRankParam(param, recallResult)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //log.info("rankResult {}", JSONUtils.toJson(rankResult)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         saveSortLog(param, rankResult); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |