yumeng пре 1 година
родитељ
комит
4df6d28f86

+ 7 - 11
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/controller/BytedanceController.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.job.bytedance.controller;
 
 import cn.com.ctop.job.bytedance.data.service.IAdminAdvertiserListService;
+import cn.com.ctop.job.bytedance.data.service.IBytedanceAccountReportService;
 import cn.com.ctop.job.bytedance.data.service.IBytedanceProductReportService;
 import cn.com.ctop.job.bytedance.data.utils.Check;
 import com.alibaba.fastjson.JSONObject;
@@ -35,22 +36,17 @@ public class BytedanceController {
     @Autowired
     private IAdminAdvertiserListService adminAdvertiserListService;
 
+    @Autowired
+    private IBytedanceAccountReportService accountReportService;
+
 
-    @GetMapping("/getChannel")
+    @GetMapping("/accountReport")
     public void getChannel(String param) {
         String[] s = param.split("_");
         Long advertiserId = Long.valueOf(s[0]);
         String accessToken = s[1];
-        Integer pageSize = 100;
-        log.info("刷新管家账户下账户列表开始,AdminAdvertiserId:{}", advertiserId);
-        JSONObject totalJson = adminAdvertiserListService.getBytedanceAccountListTotal(advertiserId, advertiserId, accessToken, 1, pageSize);
-        if (!Check.isNull(totalJson)) {
-            Integer totalPage = totalJson.getInteger("totalPage");
-            if (totalPage != 0) {
-                JSONObject result = adminAdvertiserListService.bytedanceAdvertiserThreadPool(totalPage, pageSize, advertiserId, advertiserId, accessToken);
-                log.info("字节多线程获取账户返回结果:{}", result);
-            }
-        }
+        accountReportService.getBytedanceAccountDaily(advertiserId, accessToken, "2025-03-27", "2025-03-27", 1, 1);
+        accountReportService.getBytedanceAccountHour(advertiserId, accessToken, "2025-03-27", "2025-03-27", 1, 1);
     }
 
     @GetMapping("/productData")

+ 357 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceAdvertiserReportDaily.java

@@ -0,0 +1,357 @@
+package cn.com.ctop.job.bytedance.data.entity;
+
+import java.math.BigDecimal;
+
+
+/**
+ * 【请填写功能名称】对象 bytedance_advertiser_report_hour
+ *
+ * @author ruoyi
+ * @date 2025-03-27
+ */
+public class BytedanceAdvertiserReportDaily {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 广告主ID
+     */
+    private Long advertiserId;
+
+    /**
+     * 数据起始时间
+     */
+    private Integer statTimeDay;
+
+
+    /**
+     * 应用下载数据-付费金额
+     */
+    private BigDecimal statPayAmount;
+
+    /**
+     * 展现数据-总花费
+     */
+    private BigDecimal statCost;
+
+    /**
+     * 应用下载数据–激活数
+     */
+    private Long active;
+
+    /**
+     * 应用下载数据-注册数
+     */
+    private Long eventRegister;
+
+    /**
+     * 下载完成数
+     */
+    private Long downloadFinishCnt;
+
+    /**
+     * 次留人数
+     */
+    private Long attributionNextDayOpenCnt;
+
+    /**
+     * 关键行为数
+     */
+    private Long gameAddiction;
+
+    /**
+     * 激活当日在APP内的付费金额
+     */
+    private BigDecimal attributionGameInAppLtv1day;
+
+    /**
+     * 媒体|深度转化数(计费时间)
+     */
+    private Long attributionDeepConvertCnt;
+
+    /**
+     * 付费次数
+     */
+    private Long gamePayCount;
+
+    /**
+     * 转化数据-转化数
+     */
+    private Long convertCnt;
+
+    /**
+     * 展现数据-展示数
+     */
+    private Long showCnt;
+
+    /**
+     * 首次付费数
+     */
+    private Long activePay;
+
+    /**
+     * 展现数据-点击数
+     */
+    private Long clickCnt;
+
+    /**
+     * 展现数据-点击数
+     */
+    private Long clickStartCnt;
+
+    /**
+     * 媒体|转化数(计费时间)
+     */
+    private Long attributionConvertCnt;
+
+    /**
+     * 转化数据-深度转化数
+     */
+    private Long deepConvertCnt;
+
+    /**
+     * 有效播放数
+     */
+    private Long validPlay;
+
+    /**
+     * 计费当日付费金额
+     */
+    private BigDecimal attributionBillingGameInAppLtv1day;
+
+    /**
+     * 当日LTV
+     */
+    private BigDecimal attributionMicroGame0dLtv;
+
+    /**
+     * 7日LTV
+     */
+    private BigDecimal attributionMicroGame7dLtv;
+
+    /**
+     * 3日LTV
+     */
+    private BigDecimal attributionMicroGame3dLtv;
+
+    public Long getAdvertiserId() {
+        return advertiserId;
+    }
+
+    public void setAdvertiserId(Long advertiserId) {
+        this.advertiserId = advertiserId;
+    }
+
+    public Integer getStatTimeDay() {
+        return statTimeDay;
+    }
+
+    public void setStatTimeDay(Integer statTimeDay) {
+        this.statTimeDay = statTimeDay;
+    }
+
+    public BigDecimal getStatPayAmount() {
+        return statPayAmount;
+    }
+
+    public void setStatPayAmount(BigDecimal statPayAmount) {
+        this.statPayAmount = statPayAmount;
+    }
+
+    public BigDecimal getStatCost() {
+        return statCost;
+    }
+
+    public void setStatCost(BigDecimal statCost) {
+        this.statCost = statCost;
+    }
+
+    public Long getActive() {
+        return active;
+    }
+
+    public void setActive(Long active) {
+        this.active = active;
+    }
+
+    public Long getEventRegister() {
+        return eventRegister;
+    }
+
+    public void setEventRegister(Long eventRegister) {
+        this.eventRegister = eventRegister;
+    }
+
+    public Long getDownloadFinishCnt() {
+        return downloadFinishCnt;
+    }
+
+    public void setDownloadFinishCnt(Long downloadFinishCnt) {
+        this.downloadFinishCnt = downloadFinishCnt;
+    }
+
+    public Long getAttributionNextDayOpenCnt() {
+        return attributionNextDayOpenCnt;
+    }
+
+    public void setAttributionNextDayOpenCnt(Long attributionNextDayOpenCnt) {
+        this.attributionNextDayOpenCnt = attributionNextDayOpenCnt;
+    }
+
+    public Long getGameAddiction() {
+        return gameAddiction;
+    }
+
+    public void setGameAddiction(Long gameAddiction) {
+        this.gameAddiction = gameAddiction;
+    }
+
+    public BigDecimal getAttributionGameInAppLtv1day() {
+        return attributionGameInAppLtv1day;
+    }
+
+    public void setAttributionGameInAppLtv1day(BigDecimal attributionGameInAppLtv1day) {
+        this.attributionGameInAppLtv1day = attributionGameInAppLtv1day;
+    }
+
+    public Long getAttributionDeepConvertCnt() {
+        return attributionDeepConvertCnt;
+    }
+
+    public void setAttributionDeepConvertCnt(Long attributionDeepConvertCnt) {
+        this.attributionDeepConvertCnt = attributionDeepConvertCnt;
+    }
+
+    public Long getGamePayCount() {
+        return gamePayCount;
+    }
+
+    public void setGamePayCount(Long gamePayCount) {
+        this.gamePayCount = gamePayCount;
+    }
+
+    public Long getConvertCnt() {
+        return convertCnt;
+    }
+
+    public void setConvertCnt(Long convertCnt) {
+        this.convertCnt = convertCnt;
+    }
+
+    public Long getShowCnt() {
+        return showCnt;
+    }
+
+    public void setShowCnt(Long showCnt) {
+        this.showCnt = showCnt;
+    }
+
+    public Long getActivePay() {
+        return activePay;
+    }
+
+    public void setActivePay(Long activePay) {
+        this.activePay = activePay;
+    }
+
+    public Long getClickCnt() {
+        return clickCnt;
+    }
+
+    public void setClickCnt(Long clickCnt) {
+        this.clickCnt = clickCnt;
+    }
+
+    public Long getClickStartCnt() {
+        return clickStartCnt;
+    }
+
+    public void setClickStartCnt(Long clickStartCnt) {
+        this.clickStartCnt = clickStartCnt;
+    }
+
+    public Long getAttributionConvertCnt() {
+        return attributionConvertCnt;
+    }
+
+    public void setAttributionConvertCnt(Long attributionConvertCnt) {
+        this.attributionConvertCnt = attributionConvertCnt;
+    }
+
+    public Long getDeepConvertCnt() {
+        return deepConvertCnt;
+    }
+
+    public void setDeepConvertCnt(Long deepConvertCnt) {
+        this.deepConvertCnt = deepConvertCnt;
+    }
+
+    public Long getValidPlay() {
+        return validPlay;
+    }
+
+    public void setValidPlay(Long validPlay) {
+        this.validPlay = validPlay;
+    }
+
+    public BigDecimal getAttributionBillingGameInAppLtv1day() {
+        return attributionBillingGameInAppLtv1day;
+    }
+
+    public void setAttributionBillingGameInAppLtv1day(BigDecimal attributionBillingGameInAppLtv1day) {
+        this.attributionBillingGameInAppLtv1day = attributionBillingGameInAppLtv1day;
+    }
+
+    public BigDecimal getAttributionMicroGame0dLtv() {
+        return attributionMicroGame0dLtv;
+    }
+
+    public void setAttributionMicroGame0dLtv(BigDecimal attributionMicroGame0dLtv) {
+        this.attributionMicroGame0dLtv = attributionMicroGame0dLtv;
+    }
+
+    public BigDecimal getAttributionMicroGame7dLtv() {
+        return attributionMicroGame7dLtv;
+    }
+
+    public void setAttributionMicroGame7dLtv(BigDecimal attributionMicroGame7dLtv) {
+        this.attributionMicroGame7dLtv = attributionMicroGame7dLtv;
+    }
+
+    public BigDecimal getAttributionMicroGame3dLtv() {
+        return attributionMicroGame3dLtv;
+    }
+
+    public void setAttributionMicroGame3dLtv(BigDecimal attributionMicroGame3dLtv) {
+        this.attributionMicroGame3dLtv = attributionMicroGame3dLtv;
+    }
+
+    @Override
+    public String toString() {
+        return "BytedanceAdvertiserReportDaily{" +
+                "advertiserId=" + advertiserId +
+                ", statTimeDay=" + statTimeDay +
+                ", statPayAmount=" + statPayAmount +
+                ", statCost=" + statCost +
+                ", active=" + active +
+                ", eventRegister=" + eventRegister +
+                ", downloadFinishCnt=" + downloadFinishCnt +
+                ", attributionNextDayOpenCnt=" + attributionNextDayOpenCnt +
+                ", gameAddiction=" + gameAddiction +
+                ", attributionGameInAppLtv1day=" + attributionGameInAppLtv1day +
+                ", attributionDeepConvertCnt=" + attributionDeepConvertCnt +
+                ", gamePayCount=" + gamePayCount +
+                ", convertCnt=" + convertCnt +
+                ", showCnt=" + showCnt +
+                ", activePay=" + activePay +
+                ", clickCnt=" + clickCnt +
+                ", clickStartCnt=" + clickStartCnt +
+                ", attributionConvertCnt=" + attributionConvertCnt +
+                ", deepConvertCnt=" + deepConvertCnt +
+                ", validPlay=" + validPlay +
+                ", attributionBillingGameInAppLtv1day=" + attributionBillingGameInAppLtv1day +
+                ", attributionMicroGame0dLtv=" + attributionMicroGame0dLtv +
+                ", attributionMicroGame7dLtv=" + attributionMicroGame7dLtv +
+                ", attributionMicroGame3dLtv=" + attributionMicroGame3dLtv +
+                '}';
+    }
+}

+ 370 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/entity/BytedanceAdvertiserReportHour.java

@@ -0,0 +1,370 @@
+package cn.com.ctop.job.bytedance.data.entity;
+
+import java.math.BigDecimal;
+
+
+/**
+ * 【请填写功能名称】对象 bytedance_advertiser_report_hour
+ *
+ * @author ruoyi
+ * @date 2025-03-27
+ */
+public class BytedanceAdvertiserReportHour {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 广告主ID
+     */
+    private Long advertiserId;
+
+    /**
+     * 数据起始时间
+     */
+    private Integer statTimeDay;
+
+    /**
+     * 小时
+     */
+    private Integer hour;
+
+    /**
+     * 应用下载数据-付费金额
+     */
+    private BigDecimal statPayAmount;
+
+    /**
+     * 展现数据-总花费
+     */
+    private BigDecimal statCost;
+
+    /**
+     * 应用下载数据–激活数
+     */
+    private Long active;
+
+    /**
+     * 应用下载数据-注册数
+     */
+    private Long eventRegister;
+
+    /**
+     * 下载完成数
+     */
+    private Long downloadFinishCnt;
+
+    /**
+     * 次留人数
+     */
+    private Long attributionNextDayOpenCnt;
+
+    /**
+     * 关键行为数
+     */
+    private Long gameAddiction;
+
+    /**
+     * 激活当日在APP内的付费金额
+     */
+    private BigDecimal attributionGameInAppLtv1day;
+
+    /**
+     * 媒体|深度转化数(计费时间)
+     */
+    private Long attributionDeepConvertCnt;
+
+    /**
+     * 付费次数
+     */
+    private Long gamePayCount;
+
+    /**
+     * 转化数据-转化数
+     */
+    private Long convertCnt;
+
+    /**
+     * 展现数据-展示数
+     */
+    private Long showCnt;
+
+    /**
+     * 首次付费数
+     */
+    private Long activePay;
+
+    /**
+     * 展现数据-点击数
+     */
+    private Long clickCnt;
+
+    /**
+     * 展现数据-点击数
+     */
+    private Long clickStartCnt;
+
+    /**
+     * 媒体|转化数(计费时间)
+     */
+    private Long attributionConvertCnt;
+
+    /**
+     * 转化数据-深度转化数
+     */
+    private Long deepConvertCnt;
+
+    /**
+     * 有效播放数
+     */
+    private Long validPlay;
+
+    /**
+     * 计费当日付费金额
+     */
+    private BigDecimal attributionBillingGameInAppLtv1day;
+
+    /**
+     * 当日LTV
+     */
+    private BigDecimal attributionMicroGame0dLtv;
+
+    /**
+     * 7日LTV
+     */
+    private BigDecimal attributionMicroGame7dLtv;
+
+    /**
+     * 3日LTV
+     */
+    private BigDecimal attributionMicroGame3dLtv;
+
+    public Long getAdvertiserId() {
+        return advertiserId;
+    }
+
+    public void setAdvertiserId(Long advertiserId) {
+        this.advertiserId = advertiserId;
+    }
+
+    public Integer getStatTimeDay() {
+        return statTimeDay;
+    }
+
+    public void setStatTimeDay(Integer statTimeDay) {
+        this.statTimeDay = statTimeDay;
+    }
+
+    public Integer getHour() {
+        return hour;
+    }
+
+    public void setHour(Integer hour) {
+        this.hour = hour;
+    }
+
+    public BigDecimal getStatPayAmount() {
+        return statPayAmount;
+    }
+
+    public void setStatPayAmount(BigDecimal statPayAmount) {
+        this.statPayAmount = statPayAmount;
+    }
+
+    public BigDecimal getStatCost() {
+        return statCost;
+    }
+
+    public void setStatCost(BigDecimal statCost) {
+        this.statCost = statCost;
+    }
+
+    public Long getActive() {
+        return active;
+    }
+
+    public void setActive(Long active) {
+        this.active = active;
+    }
+
+    public Long getEventRegister() {
+        return eventRegister;
+    }
+
+    public void setEventRegister(Long eventRegister) {
+        this.eventRegister = eventRegister;
+    }
+
+    public Long getDownloadFinishCnt() {
+        return downloadFinishCnt;
+    }
+
+    public void setDownloadFinishCnt(Long downloadFinishCnt) {
+        this.downloadFinishCnt = downloadFinishCnt;
+    }
+
+    public Long getAttributionNextDayOpenCnt() {
+        return attributionNextDayOpenCnt;
+    }
+
+    public void setAttributionNextDayOpenCnt(Long attributionNextDayOpenCnt) {
+        this.attributionNextDayOpenCnt = attributionNextDayOpenCnt;
+    }
+
+    public Long getGameAddiction() {
+        return gameAddiction;
+    }
+
+    public void setGameAddiction(Long gameAddiction) {
+        this.gameAddiction = gameAddiction;
+    }
+
+    public BigDecimal getAttributionGameInAppLtv1day() {
+        return attributionGameInAppLtv1day;
+    }
+
+    public void setAttributionGameInAppLtv1day(BigDecimal attributionGameInAppLtv1day) {
+        this.attributionGameInAppLtv1day = attributionGameInAppLtv1day;
+    }
+
+    public Long getAttributionDeepConvertCnt() {
+        return attributionDeepConvertCnt;
+    }
+
+    public void setAttributionDeepConvertCnt(Long attributionDeepConvertCnt) {
+        this.attributionDeepConvertCnt = attributionDeepConvertCnt;
+    }
+
+    public Long getGamePayCount() {
+        return gamePayCount;
+    }
+
+    public void setGamePayCount(Long gamePayCount) {
+        this.gamePayCount = gamePayCount;
+    }
+
+    public Long getConvertCnt() {
+        return convertCnt;
+    }
+
+    public void setConvertCnt(Long convertCnt) {
+        this.convertCnt = convertCnt;
+    }
+
+    public Long getShowCnt() {
+        return showCnt;
+    }
+
+    public void setShowCnt(Long showCnt) {
+        this.showCnt = showCnt;
+    }
+
+    public Long getActivePay() {
+        return activePay;
+    }
+
+    public void setActivePay(Long activePay) {
+        this.activePay = activePay;
+    }
+
+    public Long getClickCnt() {
+        return clickCnt;
+    }
+
+    public void setClickCnt(Long clickCnt) {
+        this.clickCnt = clickCnt;
+    }
+
+    public Long getClickStartCnt() {
+        return clickStartCnt;
+    }
+
+    public void setClickStartCnt(Long clickStartCnt) {
+        this.clickStartCnt = clickStartCnt;
+    }
+
+    public Long getAttributionConvertCnt() {
+        return attributionConvertCnt;
+    }
+
+    public void setAttributionConvertCnt(Long attributionConvertCnt) {
+        this.attributionConvertCnt = attributionConvertCnt;
+    }
+
+    public Long getDeepConvertCnt() {
+        return deepConvertCnt;
+    }
+
+    public void setDeepConvertCnt(Long deepConvertCnt) {
+        this.deepConvertCnt = deepConvertCnt;
+    }
+
+    public Long getValidPlay() {
+        return validPlay;
+    }
+
+    public void setValidPlay(Long validPlay) {
+        this.validPlay = validPlay;
+    }
+
+    public BigDecimal getAttributionBillingGameInAppLtv1day() {
+        return attributionBillingGameInAppLtv1day;
+    }
+
+    public void setAttributionBillingGameInAppLtv1day(BigDecimal attributionBillingGameInAppLtv1day) {
+        this.attributionBillingGameInAppLtv1day = attributionBillingGameInAppLtv1day;
+    }
+
+    public BigDecimal getAttributionMicroGame0dLtv() {
+        return attributionMicroGame0dLtv;
+    }
+
+    public void setAttributionMicroGame0dLtv(BigDecimal attributionMicroGame0dLtv) {
+        this.attributionMicroGame0dLtv = attributionMicroGame0dLtv;
+    }
+
+    public BigDecimal getAttributionMicroGame7dLtv() {
+        return attributionMicroGame7dLtv;
+    }
+
+    public void setAttributionMicroGame7dLtv(BigDecimal attributionMicroGame7dLtv) {
+        this.attributionMicroGame7dLtv = attributionMicroGame7dLtv;
+    }
+
+    public BigDecimal getAttributionMicroGame3dLtv() {
+        return attributionMicroGame3dLtv;
+    }
+
+    public void setAttributionMicroGame3dLtv(BigDecimal attributionMicroGame3dLtv) {
+        this.attributionMicroGame3dLtv = attributionMicroGame3dLtv;
+    }
+
+    @Override
+    public String toString() {
+        return "BytedanceAdvertiserReportHour{" +
+                "advertiserId=" + advertiserId +
+                ", statTimeDay=" + statTimeDay +
+                ", hour=" + hour +
+                ", statPayAmount=" + statPayAmount +
+                ", statCost=" + statCost +
+                ", active=" + active +
+                ", eventRegister=" + eventRegister +
+                ", downloadFinishCnt=" + downloadFinishCnt +
+                ", attributionNextDayOpenCnt=" + attributionNextDayOpenCnt +
+                ", gameAddiction=" + gameAddiction +
+                ", attributionGameInAppLtv1day=" + attributionGameInAppLtv1day +
+                ", attributionDeepConvertCnt=" + attributionDeepConvertCnt +
+                ", gamePayCount=" + gamePayCount +
+                ", convertCnt=" + convertCnt +
+                ", showCnt=" + showCnt +
+                ", activePay=" + activePay +
+                ", clickCnt=" + clickCnt +
+                ", clickStartCnt=" + clickStartCnt +
+                ", attributionConvertCnt=" + attributionConvertCnt +
+                ", deepConvertCnt=" + deepConvertCnt +
+                ", validPlay=" + validPlay +
+                ", attributionBillingGameInAppLtv1day=" + attributionBillingGameInAppLtv1day +
+                ", attributionMicroGame0dLtv=" + attributionMicroGame0dLtv +
+                ", attributionMicroGame7dLtv=" + attributionMicroGame7dLtv +
+                ", attributionMicroGame3dLtv=" + attributionMicroGame3dLtv +
+                '}';
+    }
+}

+ 18 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceAccountReportMapper.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.job.bytedance.data.mapper;
+
+import cn.com.ctop.job.bytedance.data.entity.BytedanceAdvertiserReportDaily;
+import cn.com.ctop.job.bytedance.data.entity.BytedanceAdvertiserReportHour;
+import cn.com.ctop.job.bytedance.data.entity.BytedanceErrorLog;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface BytedanceAccountReportMapper {
+    void replaceAccountReportHour(@Param("list") List<BytedanceAdvertiserReportHour> hours);
+
+    void deleteInfoByErrorId(@Param("errorId") Long errorId);
+
+    void replaceAccountReportDaily(@Param("list") List<BytedanceAdvertiserReportDaily> dailyList);
+
+    void replaceErrorInfo(BytedanceErrorLog errorInfo);
+}

+ 147 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/BytedanceAccountReportMapper.xml

@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="cn.com.ctop.job.bytedance.data.mapper.BytedanceAccountReportMapper">
+
+    <insert id="replaceAccountReportHour">
+        replace into media_api.bytedance_advertiser_report_hour (
+        advertiser_id,
+        stat_time_day,
+        `hour`,
+        stat_pay_amount,
+        stat_cost,
+        `active`,
+        event_register,
+        download_finish_cnt,
+        attribution_next_day_open_cnt,
+        game_addiction,
+        attribution_game_in_app_ltv_1day,
+        attribution_deep_convert_cnt,
+        game_pay_count,
+        convert_cnt,
+        show_cnt,
+        active_pay,
+        click_cnt,
+        click_start_cnt,
+        attribution_convert_cnt,
+        deep_convert_cnt,
+        valid_play,
+        attribution_billing_game_in_app_ltv_1day,
+        attribution_micro_game_0d_ltv,
+        attribution_micro_game_3d_ltv,
+        attribution_micro_game_7d_ltv
+        )
+        values
+        <foreach collection="list" item="item" separator=",">
+            (
+            #{item.advertiserId},
+            #{item.statTimeDay},
+            #{item.hour},
+            #{item.statPayAmount},
+            #{item.statCost},
+            #{item.active},
+            #{item.eventRegister},
+            #{item.downloadFinishCnt},
+            #{item.attributionNextDayOpenCnt},
+            #{item.gameAddiction},
+            #{item.attributionGameInAppLtv1day},
+            #{item.attributionDeepConvertCnt},
+            #{item.gamePayCount},
+            #{item.convertCnt},
+            #{item.showCnt},
+            #{item.activePay},
+            #{item.clickCnt},
+            #{item.clickStartCnt},
+            #{item.attributionConvertCnt},
+            #{item.deepConvertCnt},
+            #{item.validPlay},
+            #{item.attributionBillingGameInAppLtv1day},
+            #{item.attributionMicroGame0dLtv},
+            #{item.attributionMicroGame3dLtv},
+            #{item.attributionMicroGame7dLtv}
+            )
+        </foreach>
+    </insert>
+    <insert id="replaceAccountReportDaily">
+        replace into media_api.bytedance_advertiser_report_daily (
+        advertiser_id,
+        stat_time_day,
+        stat_pay_amount,
+        stat_cost,
+        `active`,
+        event_register,
+        download_finish_cnt,
+        attribution_next_day_open_cnt,
+        game_addiction,
+        attribution_game_in_app_ltv_1day,
+        attribution_deep_convert_cnt,
+        game_pay_count,
+        convert_cnt,
+        show_cnt,
+        active_pay,
+        click_cnt,
+        click_start_cnt,
+        attribution_convert_cnt,
+        deep_convert_cnt,
+        valid_play,
+        attribution_billing_game_in_app_ltv_1day,
+        attribution_micro_game_0d_ltv,
+        attribution_micro_game_3d_ltv,
+        attribution_micro_game_7d_ltv
+        )
+        values
+        <foreach collection="list" item="item" separator=",">
+            (
+            #{item.advertiserId},
+            #{item.statTimeDay},
+            #{item.statPayAmount},
+            #{item.statCost},
+            #{item.active},
+            #{item.eventRegister},
+            #{item.downloadFinishCnt},
+            #{item.attributionNextDayOpenCnt},
+            #{item.gameAddiction},
+            #{item.attributionGameInAppLtv1day},
+            #{item.attributionDeepConvertCnt},
+            #{item.gamePayCount},
+            #{item.convertCnt},
+            #{item.showCnt},
+            #{item.activePay},
+            #{item.clickCnt},
+            #{item.clickStartCnt},
+            #{item.attributionConvertCnt},
+            #{item.deepConvertCnt},
+            #{item.validPlay},
+            #{item.attributionBillingGameInAppLtv1day},
+            #{item.attributionMicroGame0dLtv},
+            #{item.attributionMicroGame3dLtv},
+            #{item.attributionMicroGame7dLtv}
+            )
+        </foreach>
+
+    </insert>
+    <insert id="replaceErrorInfo" parameterType="cn.com.ctop.job.bytedance.data.entity.BytedanceErrorLog">
+        replace into media_api.bytedance_error_log
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="advertiserId != null">advertiser_id,</if>
+            <if test="startDate != null">start_date,</if>
+            <if test="endDate != null">end_date,</if>
+            <if test="dataDimension != null">data_dimension,</if>
+            <if test="dataType != null">data_type,</if>
+
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="advertiserId != null">#{advertiserId},</if>
+            <if test="startDate != null">#{startDate},</if>
+            <if test="endDate != null">#{endDate},</if>
+            <if test="dataDimension != null">#{dataDimension},</if>
+            <if test="dataType != null">#{dataType},</if>
+
+        </trim>
+
+    </insert>
+    <delete id="deleteInfoByErrorId" parameterType="java.lang.Long">
+        DELETE
+        FROM bytedance_error_log
+        WHERE id = #{errorId}
+    </delete>
+</mapper>

+ 11 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IBytedanceAccountReportService.java

@@ -0,0 +1,11 @@
+package cn.com.ctop.job.bytedance.data.service;
+
+public interface IBytedanceAccountReportService {
+    void getBytedanceRetryAccountHourReport(Long errorId, Long advertiserId, String accessToken, String startDate, String endDate, Integer page,Integer isSend);
+
+    void getBytedanceRetryAccountDailyReport(Long errorId, Long advertiserId, String accessToken, String startDate, String endDate, Integer page,Integer isSend);
+
+    void getBytedanceAccountHour(Long advertiserId, String accessToken, String startDate, String ebdDate, Integer page, Integer isLog);
+
+    void getBytedanceAccountDaily(Long advertiserId, String accessToken, String startDate, String ebdDate, Integer page, Integer isLog);
+}

+ 341 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceAccountReportServiceImpl.java

@@ -0,0 +1,341 @@
+package cn.com.ctop.job.bytedance.data.service.impl;
+
+import cn.com.ctop.job.bytedance.data.entity.BytedanceAdvertiserReportDaily;
+import cn.com.ctop.job.bytedance.data.entity.BytedanceAdvertiserReportHour;
+import cn.com.ctop.job.bytedance.data.entity.BytedanceErrorLog;
+import cn.com.ctop.job.bytedance.data.mapper.BytedanceAccountReportMapper;
+import cn.com.ctop.job.bytedance.data.service.IBytedanceAccountReportService;
+import cn.com.ctop.job.bytedance.data.utils.AlertUtils;
+import cn.com.ctop.job.bytedance.data.utils.Check;
+import cn.com.ctop.job.bytedance.data.utils.FieldsConfig;
+import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+@Slf4j
+public class BytedanceAccountReportServiceImpl implements IBytedanceAccountReportService {
+    @Autowired
+    private BytedanceAccountReportMapper accountReportMapper;
+    @Override
+    public void getBytedanceRetryAccountHourReport(Long errorId, Long advertiserId, String accessToken, String startDate, String endDate, Integer page, Integer isSend) {
+        try {
+            String url = "https://api.oceanengine.com/open_api/v3.0/report/custom/get/";
+            Map<String, Object> paramsMap = new HashMap<>();
+            paramsMap.put("advertiser_id", advertiserId);
+            paramsMap.put("start_time", startDate);
+            paramsMap.put("end_time", endDate);
+            paramsMap.put("data_topic", "BASIC_DATA");
+            paramsMap.put("metrics", FieldsConfig.getMetrics());
+            paramsMap.put("dimensions", FieldsConfig.getAccountHourDimensions());
+            paramsMap.put("order_by", new JSONArray());
+            paramsMap.put("filters", new JSONArray());
+            paramsMap.put("page", page);
+            paramsMap.put("page_size", 100);
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", accessToken);
+            headers.put("Content-Type", "application/json;charset=UTF-8");
+            String s = HttpUtils.httpGet(url, paramsMap, headers);
+            JSONObject result = JSONObject.parseObject(s);
+            if (Check.isNull(result)) {
+                log.info("账户id:{},日期:{},广告时报(账户粒度)请求结果返回为空", advertiserId, startDate);
+                return;
+            }
+            List<BytedanceAdvertiserReportHour> hours = new ArrayList<>();
+            Integer code = result.getInteger("code");
+            if (code == 0) {
+                JSONObject data = result.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    JSONArray rows = data.getJSONArray("rows");
+                    if (!Check.isNull(rows)) {
+                        for (int i = 0; i < rows.size(); i++) {
+                            JSONObject rowJson = rows.getJSONObject(i);
+                            JSONObject metricsJson = rowJson.getJSONObject("metrics");
+                            JSONObject dimensionsJson = rowJson.getJSONObject("dimensions");
+                            Integer statTimeDay = Integer.valueOf(dimensionsJson.getString("stat_time_day").replace("-", ""));
+                            Integer hour = Integer.valueOf(dimensionsJson.getString("stat_time_hour").substring(11, 13));
+                            BytedanceAdvertiserReportHour advertiserReportHour = JSONObject.parseObject(metricsJson.toJSONString(), BytedanceAdvertiserReportHour.class);
+                            advertiserReportHour.setAdvertiserId(advertiserId);
+                            advertiserReportHour.setStatTimeDay(statTimeDay);
+                            advertiserReportHour.setHour(hour);
+                            hours.add(advertiserReportHour);
+                        }
+                    }
+                }
+            } else {
+                log.info("账户id:{},日期:{}广告时报(账户粒度)请求结果为空", advertiserId, startDate);
+                return;
+
+            }
+            if (!Check.isNull(hours)) {
+                accountReportMapper.replaceAccountReportHour(hours);
+            }
+            if (hours.size() >= 100) {
+                try {
+                    Thread.sleep(200L);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+                getBytedanceRetryAccountHourReport(errorId, advertiserId, accessToken, startDate, endDate, page + 1, isSend);
+            } else {
+                log.info("账户ID:{},日期:{},广告时报(账户粒度)数据请求成功", advertiserId, startDate);
+                accountReportMapper.deleteInfoByErrorId(errorId);
+                if (isSend == 1) {
+                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "hour", 1);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void getBytedanceRetryAccountDailyReport(Long errorId, Long advertiserId, String accessToken, String startDate, String endDate, Integer page, Integer isSend) {
+        try {
+            String url = "https://api.oceanengine.com/open_api/v3.0/report/custom/get/";
+            Map<String, Object> paramsMap = new HashMap<>();
+            paramsMap.put("advertiser_id", advertiserId);
+            paramsMap.put("start_time", startDate);
+            paramsMap.put("end_time", endDate);
+            paramsMap.put("data_topic", "BASIC_DATA");
+            paramsMap.put("metrics", FieldsConfig.getMetrics());
+            paramsMap.put("dimensions", FieldsConfig.getAccountDailyDimensions());
+            paramsMap.put("order_by", new JSONArray());
+            paramsMap.put("filters", new JSONArray());
+            paramsMap.put("page", page);
+            paramsMap.put("page_size", 100);
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", accessToken);
+            headers.put("Content-Type", "application/json;charset=UTF-8");
+            String s = HttpUtils.httpGet(url, paramsMap, headers);
+            JSONObject result = JSONObject.parseObject(s);
+            if (Check.isNull(result)) {
+                log.info("账户id:{},日期:{},广告时报(账户粒度)请求结果返回为空", advertiserId, startDate);
+                return;
+            }
+            List<BytedanceAdvertiserReportDaily> dailyList = new ArrayList<>();
+            Integer code = result.getInteger("code");
+            if (code == 0) {
+                JSONObject data = result.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    JSONArray rows = data.getJSONArray("rows");
+                    if (!Check.isNull(rows)) {
+                        for (int i = 0; i < rows.size(); i++) {
+                            JSONObject rowJson = rows.getJSONObject(i);
+                            JSONObject metricsJson = rowJson.getJSONObject("metrics");
+                            JSONObject dimensionsJson = rowJson.getJSONObject("dimensions");
+                            Integer statTimeDay = Integer.valueOf(dimensionsJson.getString("stat_time_day").replace("-", ""));
+                            BytedanceAdvertiserReportDaily advertiserReportDaily = JSONObject.parseObject(metricsJson.toJSONString(), BytedanceAdvertiserReportDaily.class);
+                            advertiserReportDaily.setAdvertiserId(advertiserId);
+                            advertiserReportDaily.setStatTimeDay(statTimeDay);
+                            dailyList.add(advertiserReportDaily);
+                        }
+                    }
+                }
+            } else {
+                log.info("账户id:{},日期:{}广告时报(账户粒度)请求结果为空", advertiserId, startDate);
+                return;
+
+            }
+            if (!Check.isNull(dailyList)) {
+                accountReportMapper.replaceAccountReportDaily(dailyList);
+            }
+            if (dailyList.size() >= 100) {
+                try {
+                    Thread.sleep(200L);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+                getBytedanceRetryAccountDailyReport(errorId, advertiserId, accessToken, startDate, endDate, page + 1, isSend);
+            } else {
+                log.info("账户ID:{},日期:{},广告时报(账户粒度)数据请求成功", advertiserId, startDate);
+                accountReportMapper.deleteInfoByErrorId(errorId);
+                if (isSend == 1) {
+                    AlertUtils.sendMessage(advertiserId, startDate, endDate, 1, "hour", 1);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void getBytedanceAccountHour(Long advertiserId, String accessToken, String startDate, String endDate, Integer page, Integer isLog) {
+        try {
+            String url = "https://api.oceanengine.com/open_api/v3.0/report/custom/get/";
+            Map<String, Object> paramsMap = new HashMap<>();
+            paramsMap.put("advertiser_id", advertiserId);
+            paramsMap.put("start_time", startDate);
+            paramsMap.put("end_time", endDate);
+            paramsMap.put("data_topic", "BASIC_DATA");
+            paramsMap.put("metrics", FieldsConfig.getMetrics());
+            paramsMap.put("dimensions", FieldsConfig.getAccountHourDimensions());
+            paramsMap.put("order_by", new JSONArray());
+            paramsMap.put("filters", new JSONArray());
+            paramsMap.put("page", page);
+            paramsMap.put("page_size", 100);
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", accessToken);
+            String s = HttpUtils.httpGet(url, paramsMap, headers);
+            JSONObject result = JSONObject.parseObject(s);
+            if (Check.isNull(result)) {
+                log.info("账户id:{},日期:{},广告时报(账户粒度)请求结果返回为空", advertiserId, startDate);
+                if (isLog == 1) {
+                    BytedanceErrorLog errorInfo = new BytedanceErrorLog();
+                    errorInfo.setAdvertiserId(advertiserId);
+                    errorInfo.setStartDate(startDate);
+                    errorInfo.setEndDate(endDate);
+                    errorInfo.setDataDimension("account");
+                    errorInfo.setDataType("hour");
+                    accountReportMapper.replaceErrorInfo(errorInfo);
+                }
+                return;
+            }
+            List<BytedanceAdvertiserReportHour> hours = new ArrayList<>();
+            Integer code = result.getInteger("code");
+            if (code == 0) {
+                JSONObject data = result.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    JSONArray rows = data.getJSONArray("rows");
+                    if (!Check.isNull(rows)) {
+                        for (int i = 0; i < rows.size(); i++) {
+                            JSONObject rowJson = rows.getJSONObject(i);
+                            JSONObject metricsJson = rowJson.getJSONObject("metrics");
+                            JSONObject dimensionsJson = rowJson.getJSONObject("dimensions");
+                            Integer statTimeDay = Integer.valueOf(dimensionsJson.getString("stat_time_day").replace("-", ""));
+                            Integer hour = Integer.valueOf(dimensionsJson.getString("stat_time_hour").substring(11, 13));
+                            BytedanceAdvertiserReportHour advertiserReportHour = JSONObject.parseObject(metricsJson.toJSONString(), BytedanceAdvertiserReportHour.class);
+                            advertiserReportHour.setAdvertiserId(advertiserId);
+                            advertiserReportHour.setStatTimeDay(statTimeDay);
+                            advertiserReportHour.setHour(hour);
+                            hours.add(advertiserReportHour);
+                        }
+                    } else {
+                        log.info("账户id:{},日期:{}广告时报(账户粒度)请求结果为空", advertiserId, startDate);
+                        return;
+                    }
+                }
+            } else {
+                log.info("账户id:{},日期:{}广告时报(账户粒度)请求结果失败,返回数据:{}", advertiserId, startDate, result);
+                if (isLog == 1) {
+                    BytedanceErrorLog errorInfo = new BytedanceErrorLog();
+                    errorInfo.setAdvertiserId(advertiserId);
+                    errorInfo.setStartDate(startDate);
+                    errorInfo.setEndDate(endDate);
+                    errorInfo.setDataDimension("account");
+                    errorInfo.setDataType("hour");
+                    accountReportMapper.replaceErrorInfo(errorInfo);
+                }
+                return;
+            }
+            if (!Check.isNull(hours)) {
+                accountReportMapper.replaceAccountReportHour(hours);
+            }
+            if (hours.size() >= 100) {
+                try {
+                    Thread.sleep(200L);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+                getBytedanceAccountHour(advertiserId, accessToken, startDate, endDate, page + 1, isLog);
+            } else {
+                log.info("账户ID:{},日期:{},广告时报(账户粒度)数据请求成功", advertiserId, startDate);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void getBytedanceAccountDaily(Long advertiserId, String accessToken, String startDate, String endDate, Integer page, Integer isLog) {
+        try {
+            String url = "https://api.oceanengine.com/open_api/v3.0/report/custom/get/";
+            Map<String, Object> paramsMap = new HashMap<>();
+            paramsMap.put("advertiser_id", advertiserId);
+            paramsMap.put("start_time", startDate);
+            paramsMap.put("end_time", endDate);
+            paramsMap.put("data_topic", "BASIC_DATA");
+            paramsMap.put("metrics", FieldsConfig.getMetrics());
+            paramsMap.put("dimensions", FieldsConfig.getAccountDailyDimensions());
+            paramsMap.put("order_by", new JSONArray());
+            paramsMap.put("filters", new JSONArray());
+            paramsMap.put("page", page);
+            paramsMap.put("page_size", 100);
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", accessToken);
+            String s = HttpUtils.httpGet(url, paramsMap, headers);
+            JSONObject result = JSONObject.parseObject(s);
+            if (Check.isNull(result)) {
+                log.info("账户id:{},日期:{},广告时报(账户粒度)请求结果返回为空", advertiserId, startDate);
+                if (isLog == 1) {
+                    BytedanceErrorLog errorInfo = new BytedanceErrorLog();
+                    errorInfo.setAdvertiserId(advertiserId);
+                    errorInfo.setStartDate(startDate);
+                    errorInfo.setEndDate(endDate);
+                    errorInfo.setDataDimension("account");
+                    errorInfo.setDataType("daily");
+                    accountReportMapper.replaceErrorInfo(errorInfo);
+                }
+                return;
+            }
+            List<BytedanceAdvertiserReportDaily> dailyList = new ArrayList<>();
+            Integer code = result.getInteger("code");
+            if (code == 0) {
+                JSONObject data = result.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    JSONArray rows = data.getJSONArray("rows");
+                    if (!Check.isNull(rows)) {
+                        for (int i = 0; i < rows.size(); i++) {
+                            JSONObject rowJson = rows.getJSONObject(i);
+                            JSONObject metricsJson = rowJson.getJSONObject("metrics");
+                            JSONObject dimensionsJson = rowJson.getJSONObject("dimensions");
+                            Integer statTimeDay = Integer.valueOf(dimensionsJson.getString("stat_time_day").replace("-", ""));
+                            BytedanceAdvertiserReportDaily advertiserReportDaily = JSONObject.parseObject(metricsJson.toJSONString(), BytedanceAdvertiserReportDaily.class);
+                            advertiserReportDaily.setAdvertiserId(advertiserId);
+                            advertiserReportDaily.setStatTimeDay(statTimeDay);
+                            dailyList.add(advertiserReportDaily);
+                        }
+                    } else {
+                        log.info("账户id:{},日期:{},广告日报(账户粒度)请求结果为空", advertiserId, startDate);
+                        return;
+                    }
+                }
+            } else {
+                log.info("账户id:{},日期:{},广告日报(账户粒度)请求结果失败,返回数据:{}", advertiserId, startDate, result);
+                if (isLog == 1) {
+                    BytedanceErrorLog errorInfo = new BytedanceErrorLog();
+                    errorInfo.setAdvertiserId(advertiserId);
+                    errorInfo.setStartDate(startDate);
+                    errorInfo.setEndDate(endDate);
+                    errorInfo.setDataDimension("account");
+                    errorInfo.setDataType("daily");
+                    accountReportMapper.replaceErrorInfo(errorInfo);
+                }
+                return;
+            }
+            if (!Check.isNull(dailyList)) {
+                accountReportMapper.replaceAccountReportDaily(dailyList);
+            }
+            if (dailyList.size() >= 100) {
+                try {
+                    Thread.sleep(200L);
+                } catch (InterruptedException e) {
+                    throw new RuntimeException(e);
+                }
+                getBytedanceAccountHour(advertiserId, accessToken, startDate, endDate, page + 1, isLog);
+            } else {
+                log.info("账户ID:{},日期:{},广告日报(账户粒度)数据请求成功", advertiserId, startDate);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 12 - 12
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedancePromoterReportServiceImpl.java

@@ -40,8 +40,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             paramsMap.put("start_time", startDate);
             paramsMap.put("end_time", endDate);
             paramsMap.put("data_topic", "BASIC_DATA");
-            paramsMap.put("metrics", FieldsConfig.getpromoterMetrics());
-            paramsMap.put("dimensions", FieldsConfig.getpromoterHoutDimensions());
+            paramsMap.put("metrics", FieldsConfig.getMetrics());
+            paramsMap.put("dimensions", FieldsConfig.getPromoterHourDimensions());
             paramsMap.put("order_by", new JSONArray());
             paramsMap.put("filters", new JSONArray());
             paramsMap.put("page", page);
@@ -94,7 +94,7 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             }
             if (hours.size() >= 100) {
                 try {
-                    Thread.sleep(500L);
+                    Thread.sleep(200L);
                 } catch (InterruptedException e) {
                     throw new RuntimeException(e);
                 }
@@ -121,8 +121,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             paramsMap.put("start_time", startDate);
             paramsMap.put("end_time", endDate);
             paramsMap.put("data_topic", "BASIC_DATA");
-            paramsMap.put("metrics", FieldsConfig.getpromoterMetrics());
-            paramsMap.put("dimensions", FieldsConfig.getpromoterDailyDimensions());
+            paramsMap.put("metrics", FieldsConfig.getMetrics());
+            paramsMap.put("dimensions", FieldsConfig.getPromoterDailyDimensions());
             paramsMap.put("order_by", new JSONArray());
             paramsMap.put("filters", new JSONArray());
             paramsMap.put("page", page);
@@ -174,7 +174,7 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             }
             if (promoterReportDailies.size() >= 100) {
                 try {
-                    Thread.sleep(500L);
+                    Thread.sleep(200L);
                 } catch (InterruptedException e) {
                     throw new RuntimeException(e);
                 }
@@ -206,8 +206,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             paramsMap.put("start_time", startDate);
             paramsMap.put("end_time", endDate);
             paramsMap.put("data_topic", "BASIC_DATA");
-            paramsMap.put("metrics", FieldsConfig.getpromoterMetrics());
-            paramsMap.put("dimensions", FieldsConfig.getpromoterHoutDimensions());
+            paramsMap.put("metrics", FieldsConfig.getMetrics());
+            paramsMap.put("dimensions", FieldsConfig.getPromoterHourDimensions());
             paramsMap.put("order_by", new JSONArray());
             paramsMap.put("filters", new JSONArray());
             paramsMap.put("page", page);
@@ -278,7 +278,7 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             }
             if (hours.size() >= 100) {
                 try {
-                    Thread.sleep(500L);
+                    Thread.sleep(200L);
                 } catch (InterruptedException e) {
                     throw new RuntimeException(e);
                 }
@@ -300,8 +300,8 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             paramsMap.put("start_time", startDate);
             paramsMap.put("end_time", endDate);
             paramsMap.put("data_topic", "BASIC_DATA");
-            paramsMap.put("metrics", FieldsConfig.getpromoterMetrics());
-            paramsMap.put("dimensions", FieldsConfig.getpromoterDailyDimensions());
+            paramsMap.put("metrics", FieldsConfig.getMetrics());
+            paramsMap.put("dimensions", FieldsConfig.getPromoterDailyDimensions());
             paramsMap.put("order_by", new JSONArray());
             paramsMap.put("filters", new JSONArray());
             paramsMap.put("page", page);
@@ -370,7 +370,7 @@ public class BytedancePromoterReportServiceImpl implements IBytedancePromoterRep
             }
             if (promoterReportDailies.size() >= 100) {
                 try {
-                    Thread.sleep(500L);
+                    Thread.sleep(200L);
                 } catch (InterruptedException e) {
                     throw new RuntimeException(e);
                 }

+ 34 - 18
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/utils/FieldsConfig.java

@@ -4,31 +4,47 @@ import com.alibaba.fastjson.JSONArray;
 
 public class FieldsConfig {
 
+    public static JSONArray getAccountHourDimensions() {
+        JSONArray hourDimensions = new JSONArray();
+        hourDimensions.add("stat_time_day");
+        hourDimensions.add("stat_time_hour");
 
-    public static JSONArray getpromoterHoutDimensions() {
-        JSONArray houtDimensions = new JSONArray();
-        houtDimensions.add("stat_time_day");
-        houtDimensions.add("stat_time_hour");
-        houtDimensions.add("cdp_project_id");
-        houtDimensions.add("cdp_project_name");
-        houtDimensions.add("cdp_promotion_id");
-        houtDimensions.add("cdp_promotion_name");
-        return houtDimensions;
+        return hourDimensions;
 
     }
 
-    public static JSONArray getpromoterDailyDimensions() {
-        JSONArray houtDimensions = new JSONArray();
-        houtDimensions.add("stat_time_day");
-        houtDimensions.add("cdp_project_id");
-        houtDimensions.add("cdp_project_name");
-        houtDimensions.add("cdp_promotion_id");
-        houtDimensions.add("cdp_promotion_name");
-        return houtDimensions;
+    public static JSONArray getAccountDailyDimensions() {
+        JSONArray dailyDimensions = new JSONArray();
+        dailyDimensions.add("stat_time_day");
+        return dailyDimensions;
+
+    }
+
+
+    public static JSONArray getPromoterHourDimensions() {
+        JSONArray hourDimensions = new JSONArray();
+        hourDimensions.add("stat_time_day");
+        hourDimensions.add("stat_time_hour");
+        hourDimensions.add("cdp_project_id");
+        hourDimensions.add("cdp_project_name");
+        hourDimensions.add("cdp_promotion_id");
+        hourDimensions.add("cdp_promotion_name");
+        return hourDimensions;
+
+    }
+
+    public static JSONArray getPromoterDailyDimensions() {
+        JSONArray hourDimensions = new JSONArray();
+        hourDimensions.add("stat_time_day");
+        hourDimensions.add("cdp_project_id");
+        hourDimensions.add("cdp_project_name");
+        hourDimensions.add("cdp_promotion_id");
+        hourDimensions.add("cdp_promotion_name");
+        return hourDimensions;
 
     }
 
-    public static JSONArray getpromoterMetrics() {
+    public static JSONArray getMetrics() {
         JSONArray metricslds = new JSONArray();
         metricslds.add("stat_pay_amount");
         metricslds.add("stat_cost");

+ 91 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAccountReportJob.java

@@ -0,0 +1,91 @@
+package cn.com.ctop.job.bytedance.handler;
+
+
+import cn.com.ctop.job.bytedance.data.service.IBytedanceAccountReportService;
+import cn.com.ctop.job.bytedance.data.service.IBytedanceProductReportService;
+import cn.com.ctop.job.bytedance.data.service.IBytedancePromoterReportService;
+import cn.com.ctop.job.bytedance.data.service.IChannelService;
+import cn.com.ctop.job.bytedance.data.utils.Check;
+import cn.com.ctop.job.bytedance.data.utils.DateUtils;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+
+/**
+ * 广告主定时任务
+ *
+ * @throws Exception
+ */
+@Slf4j
+@Component
+public class BytedanceAccountReportJob {
+    @Autowired
+    private IBytedanceAccountReportService accountReportService;
+
+
+    private static ExecutorService hourExecutorService = Executors.newFixedThreadPool(2);
+
+
+
+
+    /**
+     * 账户时报
+     *
+     * @throws Exception
+     */
+
+    @XxlJob("yesHourAccountReport")
+    public void yesHourAccountReport() throws Exception {
+        String param = XxlJobHelper.getJobParam(); // 执行参数
+        if (Check.isNull(param)) {
+            log.error("入参为空");
+            return;
+        }
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String date = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        String[] s = param.split("_");
+        Long advertiserId = Long.valueOf(s[0]);
+        String accessToken = s[1];
+        hourExecutorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                accountReportService.getBytedanceAccountHour(advertiserId, accessToken, nowDate, nowDate, 1, 1);
+            }
+        });
+    }
+
+
+    /**
+     * 账户日报
+     * @throws Exception
+     */
+    @XxlJob("yesDailyAccountReport")
+    public void yesDailyAccountReport() throws Exception {
+        String param = XxlJobHelper.getJobParam(); // 执行参数
+        if (Check.isNull(param)) {
+            log.error("入参为空");
+            return;
+        }
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String date = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        String[] s = param.split("_");
+        Long advertiserId = Long.valueOf(s[0]);
+        String accessToken = s[1];
+        hourExecutorService.submit(new Runnable() {
+            @Override
+            public void run() {
+                accountReportService.getBytedanceAccountDaily(advertiserId, accessToken, nowDate, nowDate, 1, 1);
+            }
+        });
+    }
+
+
+}

+ 0 - 56
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedancePromoterReportJob.java

@@ -44,61 +44,6 @@ public class BytedancePromoterReportJob {
     private static ExecutorService productDailyRetrExecutor = Executors.newFixedThreadPool(2);
 
 
-    @XxlJob("promoterReport")
-    public void promoterReport() throws Exception {
-        List<JSONObject> accountList = promoterReportService.getAccountList();
-        if (!Check.isNull(accountList)) {
-            for (int i = 0; i < accountList.size(); i++) {
-                JSONObject jsonObject = accountList.get(i);
-                Long id = jsonObject.getLong("id");
-                Long advertiserId = jsonObject.getLong("advertiserId");
-                String startDate = jsonObject.getString("startDate");
-                String endDate = jsonObject.getString("endDate");
-                String dataDimension = jsonObject.getString("dataDimension");
-                String dataType = jsonObject.getString("dataType");
-                String accessToken = jsonObject.getString("accessToken");
-                Integer isSend = jsonObject.getInteger("isSend");
-
-                if ("promoter".equals(dataDimension)) {
-                    if (dataType.equals("hour")) { // 广告时报
-                        hourRetrExecutorService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                if (!Check.isNull(accessToken)) {
-                                    promoterReportService.getBytedanceRetryPromoterHourReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
-                                }
-                            }
-                        });
-                    }
-                    if (dataType.equals("daily")) { // 广告日报
-                        dailyRetrExecutorService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                if (!Check.isNull(accessToken)) {
-                                    promoterReportService.getBytedancePromoterRetryDailyReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
-
-                                }
-                            }
-                        });
-                    }
-                } else if ("product".equals(dataDimension)) {
-                    productDailyRetrExecutor.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            if (!Check.isNull(accessToken)) {
-                                productReportService.getBytedanceProductDailyReport(advertiserId, accessToken, startDate, endDate, 1, id, null, isSend);
-                            }
-                        }
-                    });
-                }
-            }
-
-        } else {
-            log.info("重试列表为空");
-        }
-
-    }
-
     /**
      * 番茄数据拉取
      *
@@ -131,7 +76,6 @@ public class BytedancePromoterReportJob {
         String[] s = param.split("_");
         Long advertiserId = Long.valueOf(s[0]);
         String accessToken = s[1];
-
         hourExecutorService.submit(new Runnable() {
             @Override
             public void run() {

+ 129 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceReportRetryJob.java

@@ -0,0 +1,129 @@
+package cn.com.ctop.job.bytedance.handler;
+
+
+import cn.com.ctop.job.bytedance.data.service.IBytedanceAccountReportService;
+import cn.com.ctop.job.bytedance.data.service.IBytedanceProductReportService;
+import cn.com.ctop.job.bytedance.data.service.IBytedancePromoterReportService;
+import cn.com.ctop.job.bytedance.data.service.IChannelService;
+import cn.com.ctop.job.bytedance.data.utils.Check;
+import cn.com.ctop.job.bytedance.data.utils.DateUtils;
+import com.alibaba.fastjson.JSONObject;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+
+/**
+ * 广告主定时任务
+ *
+ * @throws Exception
+ */
+@Slf4j
+@Component
+public class BytedanceReportRetryJob {
+    @Autowired
+    private IBytedanceProductReportService productReportService;
+
+    @Autowired
+    private IBytedancePromoterReportService promoterReportService;
+
+    @Autowired
+    private IBytedanceAccountReportService accountReportService;
+
+
+    private static ExecutorService hourAccountRetrExecutorService = Executors.newFixedThreadPool(2);
+    private static ExecutorService dailyAccountRetrExecutorService = Executors.newFixedThreadPool(2);
+
+    private static ExecutorService dailyPromoterRetrExecutorService = Executors.newFixedThreadPool(2);
+    private static ExecutorService hourPromoterRetrExecutorService = Executors.newFixedThreadPool(2);
+
+    private static ExecutorService productDailyRetrExecutor = Executors.newFixedThreadPool(2);
+
+
+    @XxlJob("retryReport")
+    public void promoterReport() throws Exception {
+        List<JSONObject> accountList = promoterReportService.getAccountList();
+        if (!Check.isNull(accountList)) {
+            for (int i = 0; i < accountList.size(); i++) {
+                JSONObject jsonObject = accountList.get(i);
+                Long id = jsonObject.getLong("id");
+                Long advertiserId = jsonObject.getLong("advertiserId");
+                String startDate = jsonObject.getString("startDate");
+                String endDate = jsonObject.getString("endDate");
+                String dataDimension = jsonObject.getString("dataDimension");
+                String dataType = jsonObject.getString("dataType");
+                String accessToken = jsonObject.getString("accessToken");
+                Integer isSend = jsonObject.getInteger("isSend");
+                if ("promoter".equals(dataDimension)) {
+                    if (dataType.equals("hour")) { // 广告时报
+                        hourPromoterRetrExecutorService.submit(new Runnable() {
+                            @Override
+                            public void run() {
+                                if (!Check.isNull(accessToken)) {
+                                    promoterReportService.getBytedanceRetryPromoterHourReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
+                                }
+                            }
+                        });
+                    }
+                    if (dataType.equals("daily")) { // 广告日报
+                        dailyPromoterRetrExecutorService.submit(new Runnable() {
+                            @Override
+                            public void run() {
+                                if (!Check.isNull(accessToken)) {
+                                    promoterReportService.getBytedancePromoterRetryDailyReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
+
+                                }
+                            }
+                        });
+                    }
+                } else if ("product".equals(dataDimension)) {
+                    productDailyRetrExecutor.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            if (!Check.isNull(accessToken)) {
+                                productReportService.getBytedanceProductDailyReport(advertiserId, accessToken, startDate, endDate, 1, id, null, isSend);
+                            }
+                        }
+                    });
+                } else if ("account".equals(dataDimension)) {
+                    if (dataType.equals("hour")) { // 账户时报
+                        hourAccountRetrExecutorService.submit(new Runnable() {
+                            @Override
+                            public void run() {
+                                if (!Check.isNull(accessToken)) {
+                                    accountReportService.getBytedanceRetryAccountHourReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
+                                }
+                            }
+                        });
+                    }
+
+                    if (dataType.equals("daily")) { // 账户日
+                        dailyAccountRetrExecutorService.submit(new Runnable() {
+                            @Override
+                            public void run() {
+                                if (!Check.isNull(accessToken)) {
+                                    accountReportService.getBytedanceRetryAccountDailyReport(id, advertiserId, accessToken, startDate, endDate, 1, isSend);
+                                }
+                            }
+                        });
+                    }
+
+                }
+
+
+            }
+
+        } else {
+            log.info("重试列表为空");
+        }
+
+    }
+
+
+}