|
|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.aliyun.odps.data.Record;
|
|
|
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.ContentPositionEnum;
|
|
|
@@ -45,6 +46,7 @@ import com.tzld.longarticle.recommend.server.service.recommend.score.ScoreStrate
|
|
|
import com.tzld.longarticle.recommend.server.util.DateUtils;
|
|
|
import com.tzld.longarticle.recommend.server.util.MapBuilder;
|
|
|
import com.tzld.longarticle.recommend.server.util.Md5Util;
|
|
|
+import com.tzld.longarticle.recommend.server.util.OdpsUtil;
|
|
|
import com.tzld.longarticle.recommend.server.util.feishu.FeiShu;
|
|
|
import com.tzld.longarticle.recommend.server.util.feishu.FeishuMessageSender;
|
|
|
import com.xxl.job.core.biz.model.ReturnT;
|
|
|
@@ -4473,7 +4475,7 @@ public class DataDashboardService {
|
|
|
List<LongArticlesSupplyAndDemandExport> exportList = new ArrayList<>();
|
|
|
dateStrList = Lists.reverse(dateStrList);
|
|
|
for (String dateStr : dateStrList) {
|
|
|
- exportList.addAll(buildContentSupplyAndDemandExport(dateStr));
|
|
|
+ exportList.addAll(buildContentSupplyAndDemandExport(dateStr, null));
|
|
|
}
|
|
|
if (CollectionUtil.isEmpty(exportList)) {
|
|
|
return;
|
|
|
@@ -4510,7 +4512,7 @@ public class DataDashboardService {
|
|
|
2, styles, null, null);
|
|
|
}
|
|
|
|
|
|
- private List<LongArticlesSupplyAndDemandExport> buildContentSupplyAndDemandExport(String dateStr) {
|
|
|
+ private List<LongArticlesSupplyAndDemandExport> buildContentSupplyAndDemandExport(String dateStr, List<String> filterAccountList) {
|
|
|
List<LongArticlesSupplyAndDemandExport> result = new ArrayList<>();
|
|
|
Long start = DateUtils.getStartOfDay(dateStr, "yyyyMMdd") * 1000;
|
|
|
Long end = start + 86400000;
|
|
|
@@ -4626,6 +4628,11 @@ public class DataDashboardService {
|
|
|
long totalFansCount = 0L;
|
|
|
|
|
|
for (DatastatSortStrategy item : firstLevelSortList) {
|
|
|
+ // 账号过滤
|
|
|
+ if (CollectionUtil.isNotEmpty(filterAccountList) && !filterAccountList.contains(item.getAccountName())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
// 获取品类
|
|
|
String category = item.getCategory();
|
|
|
if (!categoryExportMap.containsKey(category)) {
|
|
|
@@ -4775,4 +4782,70 @@ public class DataDashboardService {
|
|
|
|
|
|
return sumExport;
|
|
|
}
|
|
|
+
|
|
|
+ @XxlJob("contentSupplyAndDemandDashBoardGzhTouliuJob")
|
|
|
+ public ReturnT<String> contentSupplyAndDemandDashBoardGzhTouliuJob(String param) {
|
|
|
+ List<String> dateStrList = DateUtils.getBeforeDays(null, null, 1);
|
|
|
+ contentSupplyAndDemandDashBoardGzhTouliu(dateStrList);
|
|
|
+ return ReturnT.SUCCESS;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void contentSupplyAndDemandDashBoardGzhTouliu(String dateStr) {
|
|
|
+ if (!StringUtils.hasText(dateStr)) {
|
|
|
+ dateStr = DateUtils.getBeforeDaysDateStr("yyyyMMdd", 1);
|
|
|
+ }
|
|
|
+ contentSupplyAndDemandDashBoardGzhTouliu(Collections.singletonList(dateStr));
|
|
|
+ }
|
|
|
+
|
|
|
+ public void contentSupplyAndDemandDashBoardGzhTouliu(List<String> dateStrList) {
|
|
|
+ List<LongArticlesSupplyAndDemandExport> exportList = new ArrayList<>();
|
|
|
+ dateStrList = Lists.reverse(dateStrList);
|
|
|
+
|
|
|
+ // 查询所有公众号投流账号
|
|
|
+ String accountMapSql = "SELECT account_id, account_name from loghubods.feishu_wechat_mp_account_base where account_status = '开';";
|
|
|
+ List<Record> accountList = OdpsUtil.getOdpsData(accountMapSql);
|
|
|
+ List<String> touliuAccountList = new ArrayList<>();
|
|
|
+ if (CollectionUtils.isNotEmpty(accountList)) {
|
|
|
+ for (Record record : accountList) {
|
|
|
+ String accountName = record.getString(1);
|
|
|
+ touliuAccountList.add(accountName);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String dateStr : dateStrList) {
|
|
|
+ exportList.addAll(buildContentSupplyAndDemandExport(dateStr, touliuAccountList));
|
|
|
+ }
|
|
|
+ if (CollectionUtil.isEmpty(exportList)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ int rowNum = exportList.size();
|
|
|
+ List<List<Object>> rows = new ArrayList<>();
|
|
|
+ Field[] fields = LongArticlesSupplyAndDemandExport.class.getDeclaredFields();
|
|
|
+ for (LongArticlesSupplyAndDemandExport datum : exportList) {
|
|
|
+ List<Object> rowDatas = new ArrayList<>();
|
|
|
+ rows.add(rowDatas);
|
|
|
+
|
|
|
+ for (Field field : fields) {
|
|
|
+ field.setAccessible(true);
|
|
|
+ try {
|
|
|
+ rowDatas.add(field.get(datum));
|
|
|
+ } catch (IllegalAccessException e) {
|
|
|
+ log.error("获取值出错:{}", field.getName());
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Pair<String, String>> styles = Arrays
|
|
|
+ .asList(
|
|
|
+ Pair.of("E", "0.00%"),
|
|
|
+ Pair.of("G", "0.00%"),
|
|
|
+ Pair.of("K", "0.00%"),
|
|
|
+ Pair.of("M", "0.00%"),
|
|
|
+ Pair.of("N", "0.00%"),
|
|
|
+ Pair.of("O", "0.00%")
|
|
|
+ );
|
|
|
+ doSendFeishuSheet(FeiShu.requestPQAccessToken(), dateStrList, "FD47w23TaiITHSkKCmqcM85FnBd", "DhIku2", rowNum, rows,
|
|
|
+ 2, styles, null, null);
|
|
|
+ }
|
|
|
}
|