|
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import com.tzld.longarticle.recommend.server.common.enums.StatusEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.recommend.AccountBusinessTypeEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.recommend.ArticleTypeEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.recommend.ContentPoolEnum;
|
|
@@ -97,21 +98,43 @@ public class DataDashboardService {
|
|
|
|
|
|
public void export(String beginDate, String endDate) {
|
|
|
List<String> dateStrList = DateUtils.getBeforeDays(beginDate, endDate, 5);
|
|
|
- exportFeishuNewSortStrategy(dateStrList, sheetToken, "7d4e12");
|
|
|
+ exportFeishuNewSortStrategy(dateStrList, ArticleTypeEnum.QUNFA.getVal(), StatusEnum.ZERO.getCode(),
|
|
|
+ sheetToken, "7d4e12");
|
|
|
}
|
|
|
|
|
|
@XxlJob("scheduledExport")
|
|
|
public ReturnT<String> scheduledExport(String param) {
|
|
|
List<String> dateStrList = DateUtils.getBeforeDays(null, null, 5);
|
|
|
- exportFeishuNewSortStrategy(dateStrList, sheetToken, "7d4e12");
|
|
|
+ exportFeishuNewSortStrategy(dateStrList, ArticleTypeEnum.QUNFA.getVal(), StatusEnum.ZERO.getCode(),
|
|
|
+ sheetToken, "7d4e12");
|
|
|
return ReturnT.SUCCESS;
|
|
|
}
|
|
|
|
|
|
+ public void exportWuXianLiu(String beginDate, String endDate) {
|
|
|
+ List<String> dateStrList = DateUtils.getBeforeDays(beginDate, endDate, 5);
|
|
|
+ exportFeishuNewSortStrategy(dateStrList, ArticleTypeEnum.WUXIANLIU.getVal(), StatusEnum.ONE.getCode(),
|
|
|
+ sheetToken, "Ucycvw");
|
|
|
+ }
|
|
|
|
|
|
- private void exportFeishuNewSortStrategy(List<String> dateStrList, String sheetToken, String sheetId) {
|
|
|
+ @XxlJob("scheduledExportWuXianLiu")
|
|
|
+ public ReturnT<String> scheduledExportWuXianLiu(String param) {
|
|
|
+ List<String> dateStrList = DateUtils.getBeforeDays(null, null, 5);
|
|
|
+ exportFeishuNewSortStrategy(dateStrList, ArticleTypeEnum.WUXIANLIU.getVal(), StatusEnum.ONE.getCode(),
|
|
|
+ sheetToken, "Ucycvw");
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void exportFeishuNewSortStrategy(List<String> dateStrList, String articleType, Integer filter,
|
|
|
+ String sheetToken, String sheetId) {
|
|
|
String minDate = dateStrList.stream().min(String::compareTo).orElse("");
|
|
|
String maxDate = dateStrList.stream().max(String::compareTo).orElse("");
|
|
|
- List<NewSortStrategyExport> newContentsYesData = newSortStrategyData(minDate, maxDate);
|
|
|
+ List<NewSortStrategyExport> newContentsYesData = newSortStrategyData(minDate, maxDate, articleType);
|
|
|
+ if (CollectionUtil.isNotEmpty(newContentsYesData) && filter == StatusEnum.ONE.getCode()) {
|
|
|
+ newContentsYesData = newContentsYesData.stream()
|
|
|
+ .filter(o -> Objects.nonNull(o.getPublishMiniProgramNum()) && o.getPublishMiniProgramNum() > 0)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ }
|
|
|
if (CollectionUtil.isEmpty(newContentsYesData)) {
|
|
|
return;
|
|
|
}
|
|
@@ -154,7 +177,7 @@ public class DataDashboardService {
|
|
|
doSendFeishuSheet(dateStrList, sheetToken, sheetId, rowNum, rows, 2, styles);
|
|
|
}
|
|
|
|
|
|
- private List<NewSortStrategyExport> newSortStrategyData(String beginDate, String endDate) {
|
|
|
+ private List<NewSortStrategyExport> newSortStrategyData(String beginDate, String endDate, String articleType) {
|
|
|
long beginTimestamp = DateUtils.dateStrToTimestamp(beginDate, "yyyyMMdd");
|
|
|
long endTimestamp = DateUtils.dateStrToTimestamp(endDate, "yyyyMMdd") + 86400;
|
|
|
List<AccountAvgInfo> accountAvgInfoList = accountAvgInfoRepository.findAll();
|
|
@@ -162,7 +185,7 @@ public class DataDashboardService {
|
|
|
List<String> ghIds = accountAvgInfoList.stream().map(AccountAvgInfo::getGhId).distinct().collect(Collectors.toList());
|
|
|
|
|
|
List<Article> articleList = articleRepository.getByGhIdInAndPublishTimestampBetweenAndTypeEquals(ghIds,
|
|
|
- beginTimestamp, endTimestamp, ArticleTypeEnum.QUNFA.getVal());
|
|
|
+ beginTimestamp, endTimestamp, articleType);
|
|
|
Map<String, Map<String, Map<Integer, Article>>> articleMap = articleList.stream().collect(Collectors.groupingBy(Article::getGhId,
|
|
|
Collectors.groupingBy(Article::getAppMsgId, Collectors.toMap(Article::getItemIndex, o -> o))));
|
|
|
log.info("newSortStrategyData articleList finish");
|
|
@@ -296,7 +319,7 @@ public class DataDashboardService {
|
|
|
List<Article> hisArticleList = new ArrayList<>();
|
|
|
List<List<String>> titleMd5Partition = Lists.partition(new ArrayList<>(titleMd5List), 1000);
|
|
|
for (List<String> titleMd5s : titleMd5Partition) {
|
|
|
- hisArticleList.addAll(articleRepository.getByTitleMd5InAndTypeEqualsAndStatusEquals(titleMd5s, ArticleTypeEnum.QUNFA.getVal(), 1));
|
|
|
+ hisArticleList.addAll(articleRepository.getByTitleMd5InAndTypeEqualsAndStatusEquals(titleMd5s, articleType, 1));
|
|
|
}
|
|
|
log.info("newSortStrategyData hisArticleList finish");
|
|
|
Map<String, List<Article>> hisArticleMap = hisArticleList.stream().collect(Collectors.groupingBy(Article::getTitle));
|