|
@@ -3,14 +3,13 @@ package com.tzld.longarticle.recommend.server.service.recommend;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.tzld.longarticle.recommend.server.common.CostMonitor;
|
|
import com.tzld.longarticle.recommend.server.common.CostMonitor;
|
|
|
-import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleTypeEnum;
|
|
|
|
|
|
|
+import com.tzld.longarticle.recommend.server.common.constant.SceneConstants;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.aigc.PushTypeEnum;
|
|
import com.tzld.longarticle.recommend.server.common.enums.aigc.PushTypeEnum;
|
|
|
|
|
+import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleTypeEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.recommend.RankStrategyEnum;
|
|
import com.tzld.longarticle.recommend.server.common.enums.recommend.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.mapper.crawler.ArticleUserGroupMapper;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.Content;
|
|
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.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.entity.crawler.PublishSortLog;
|
|
|
import com.tzld.longarticle.recommend.server.model.param.RecommendParam;
|
|
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.param.RecommendRequest;
|
|
@@ -20,9 +19,7 @@ import com.tzld.longarticle.recommend.server.model.vo.RecommendResponse;
|
|
|
import com.tzld.longarticle.recommend.server.model.vo.RecommendWithUserGroupResponse;
|
|
import com.tzld.longarticle.recommend.server.model.vo.RecommendWithUserGroupResponse;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.AccountAvgInfoRepository;
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.AccountAvgInfoRepository;
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.ArticleRepository;
|
|
|
-import com.tzld.longarticle.recommend.server.repository.crawler.PublishContentSortLogRepository;
|
|
|
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.PublishSortLogRepository;
|
|
import com.tzld.longarticle.recommend.server.repository.crawler.PublishSortLogRepository;
|
|
|
-import com.tzld.longarticle.recommend.server.common.constant.SceneConstants;
|
|
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.config.AccountIndexAvgViewCountService;
|
|
import com.tzld.longarticle.recommend.server.service.recommend.config.AccountIndexAvgViewCountService;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.rank.RankParam;
|
|
import com.tzld.longarticle.recommend.server.service.recommend.rank.RankParam;
|
|
|
import com.tzld.longarticle.recommend.server.service.recommend.rank.RankResult;
|
|
import com.tzld.longarticle.recommend.server.service.recommend.rank.RankResult;
|
|
@@ -62,8 +59,6 @@ public class RecommendService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private RankService rankService;
|
|
private RankService rankService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private PublishContentSortLogRepository publishContentSortLogRepository;
|
|
|
|
|
- @Autowired
|
|
|
|
|
private PublishSortLogRepository publishSortLogRepository;
|
|
private PublishSortLogRepository publishSortLogRepository;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
AccountIndexAvgViewCountService accountIndexAvgViewCountService;
|
|
AccountIndexAvgViewCountService accountIndexAvgViewCountService;
|
|
@@ -72,8 +67,6 @@ public class RecommendService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ArticleUserGroupMapper articleUserGroupMapper;
|
|
private ArticleUserGroupMapper articleUserGroupMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- private AigcBaseMapper aigcBaseMapper;
|
|
|
|
|
- @Autowired
|
|
|
|
|
private ArticleRepository articleRepository;
|
|
private ArticleRepository articleRepository;
|
|
|
|
|
|
|
|
@ApolloJsonValue("${accountStrategyConfig:{}}")
|
|
@ApolloJsonValue("${accountStrategyConfig:{}}")
|
|
@@ -282,21 +275,6 @@ public class RecommendService {
|
|
|
if (!ArticleTypeEnum.QUNFA.getVal().equals(param.getType())) {
|
|
if (!ArticleTypeEnum.QUNFA.getVal().equals(param.getType())) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- switch (param.getScene()) {
|
|
|
|
|
- case FWH_COLD_START:
|
|
|
|
|
- break;
|
|
|
|
|
- default:
|
|
|
|
|
- PublishContentSortLog log = new PublishContentSortLog();
|
|
|
|
|
- log.setGhId(param.getGhId());
|
|
|
|
|
- log.setAccountName(param.getAccountName());
|
|
|
|
|
- log.setStrategy(param.getStrategy());
|
|
|
|
|
- List<String> publishContentIds = rankResult.getContents().stream().map(Content::getId).collect(Collectors.toList());
|
|
|
|
|
- log.setPublishContentId(JSONObject.toJSONString(publishContentIds));
|
|
|
|
|
- log.setCreateTimestamp(System.currentTimeMillis());
|
|
|
|
|
- publishContentSortLogRepository.save(log);
|
|
|
|
|
- break;
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
String dateStr = DateUtils.getCurrentDateStr("yyyyMMdd");
|
|
String dateStr = DateUtils.getCurrentDateStr("yyyyMMdd");
|
|
|
List<PublishSortLog> publishSortLogSaveList = new ArrayList<>();
|
|
List<PublishSortLog> publishSortLogSaveList = new ArrayList<>();
|
|
|
List<AccountAvgInfo> avgInfoList = accountAvgInfoRepository.getAllByGhIdEqualsAndStatusEquals(param.getGhId(), 1);
|
|
List<AccountAvgInfo> avgInfoList = accountAvgInfoRepository.getAllByGhIdEqualsAndStatusEquals(param.getGhId(), 1);
|
|
@@ -313,7 +291,9 @@ public class RecommendService {
|
|
|
sortLog.setDateStr(dateStr);
|
|
sortLog.setDateStr(dateStr);
|
|
|
sortLog.setGhId(param.getGhId());
|
|
sortLog.setGhId(param.getGhId());
|
|
|
sortLog.setAccountName(param.getAccountName());
|
|
sortLog.setAccountName(param.getAccountName());
|
|
|
|
|
+ sortLog.setPublishContentId(content.getId());
|
|
|
sortLog.setCrawlerChannelContentId(content.getCrawlerChannelContentId());
|
|
sortLog.setCrawlerChannelContentId(content.getCrawlerChannelContentId());
|
|
|
|
|
+ sortLog.setSourceId(content.getSourceId());
|
|
|
sortLog.setTitle(content.getTitle());
|
|
sortLog.setTitle(content.getTitle());
|
|
|
sortLog.setIndex(i);
|
|
sortLog.setIndex(i);
|
|
|
sortLog.setIndexAvgCount(accountIndexAvgViewCountService.getAvgReadCountByDB(avgInfoList, param.getGhId(), i));
|
|
sortLog.setIndexAvgCount(accountIndexAvgViewCountService.getAvgReadCountByDB(avgInfoList, param.getGhId(), i));
|