浏览代码

添加分版位数据

zhaoxian 1 年之前
父节点
当前提交
13ef57471e

+ 5 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/controller/BytedanceController.java

@@ -108,6 +108,8 @@ public class BytedanceController {
     @Autowired
     private IBytedanceMaterialReportDailyService materialReportDailyService;
     @Autowired
+    private IByteDanceAdvertiserDataService advertiserDataServices;
+    @Autowired
     private IBytedanceProjectService listService;
 
     @GetMapping(value = "/testReport")
@@ -173,10 +175,12 @@ public class BytedanceController {
                             Thread.sleep(500);
 //                            materialReportDailyService.bytedanceDailyMaterialReportJobV3Video(oauthToken, start, yesterda, 1, 100);
 //                            advertiserDataService.getV3AdvertiserConfig(oauthToken);
-                            advertiserDataService.getV3PromotionMaterialReport(oauthToken, yesterda, yesterda, CtopAdConstant.BYTEDANCE_REPORT_V3_TYPE_DAILY);
+//                            advertiserDataService.getV3PromotionMaterialReport(oauthToken, yesterda, yesterda, CtopAdConstant.BYTEDANCE_REPORT_V3_TYPE_DAILY);
 //                            advertiserDataService.getV3AdvertiserReport(oauthToken, nowDate, nowDate, CtopAdConstant.BYTEDANCE_REPORT_V3_TYPE_HOURLY);
 //                            listService.getProjectList(oauthToken, start, yesterda, 1);
 //                            materialReportDailyService.bytedanceDailyMaterialReportJobV3Image(oauthToken, yesterda2, yesterda, 1, 100);
+                            advertiserDataServices.getPositionAdvertiserReport(oauthToken, yesterda, yesterda, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+
                         } catch (Exception e) {
                             e.printStackTrace();
                         }

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

@@ -332,4 +332,7 @@ public class BytedanceAdvertiserReportDaily {
     /*** 付费金额(回传时间)*/
     private BigDecimal statPayAmount;
 
+    private String inventory;
+    private String inventoryName;
+
 }

+ 53 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/enums/InventoryEnum.java

@@ -0,0 +1,53 @@
+package cn.com.ctop.job.bytedance.data.enums;
+
+/**
+ * 素材类型
+ */
+public enum InventoryEnum {
+
+
+    String1("INVENTORY_FEED", "头条信息流(广告投放)"),
+    String2("INVENTORY_TEXT_LINK", "头条文章详情页(已废弃)"),
+    String3("INVENTORY_VIDEO_FEED", "西瓜信息流(广告投放)"),
+    String4("INVENTORY_HOTSOON_FEED", "火山信息流(广告投放)"),
+    String5("INVENTORY_AWEME_FEED", "抖音信息流(广告投放)"),
+    String6("INVENTORY_UNION_SLOT", "穿山甲(广告投放)"),
+    String7("UNION_BOUTIQUE_GAME", "ohayoo精品游戏(广告投放)"),
+    String8("INVENTORY_UNION_SPLASH_SLOT", "穿山甲开屏广告(广告投放)"),
+    String9("INVENTORY_SEARCH", "搜索广告(广告投放)"),
+    String10("INVENTORY_UNIVERSAL", "通投智选(广告投放)"),
+    String11("INVENTORY_BEAUTY", "轻颜相机"),
+    String12("INVENTORY_PIPIXIA", "皮皮虾"),
+    String13("INVENTORY_AUTOMOBILE", "懂车帝"),
+    String14("INVENTORY_STUDY", "好好学习"),
+    String15("INVENTORY_FACE_U", "faceu"),
+    String16("INVENTORY_TOMATO_NOVEL", "番茄小说"),
+    String17("INVENTORY_HOMED_AGGREGATE", "住小帮");
+
+    private String code;
+    private String name;
+
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    private InventoryEnum(String code, String name) {
+        this.code = code;
+        this.name = name;
+    }
+
+    public static String getNameByCode(String code) {
+        for (InventoryEnum material : InventoryEnum.values()) {
+            if (material.getCode().equals(code)) {
+                return material.getName();
+            }
+        }
+        return "-";
+    }
+
+}

+ 2 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/BytedanceAdvertiserReportDailyMapper.java

@@ -21,4 +21,6 @@ public interface BytedanceAdvertiserReportDailyMapper {
     void insertV3PromotionProjectVideo(@Param("list") List<ByteDanceNewMaterialReport> videolist);
 
     void insertV3PromotionProjectImage(@Param("list") List<ByteDanceNewMaterialReport> imageList);
+
+    void insertPosition(@Param("list") List<BytedanceAdvertiserReportDaily> list);
 }

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

@@ -368,6 +368,176 @@
     </insert>
 
 
+    <insert id="insertPosition" parameterType="cn.com.ctop.job.bytedance.data.entity.BytedanceAdvertiserReportDaily">
+        replace into bytedance_advertiser_inventory_report_daily (advertiser_id, stat_datetime, cost,
+        `show`, avg_show_cost, click,
+        avg_click_cost, ctr, `convert`,
+        convert_cost, convert_rate, deep_convert,
+        deep_convert_cost, deep_convert_rate, attribution_convert,
+        attribution_convert_cost, attribution_deep_convert,
+        attribution_deep_convert_cost, download_start,
+        download_start_cost, download_start_rate, download_finish,
+        download_finish_cost, download_finish_rate,
+        click_install, install_finish, install_finish_cost,
+        install_finish_rate, active, active_cost,
+        active_rate, register, active_register_cost,
+        active_register_rate, next_day_open, next_day_open_cost,
+        next_day_open_rate, attribution_next_day_open_cnt,
+        attribution_next_day_open_cost, attribution_next_day_open_rate,
+        game_addiction, game_addiction_cost, game_addiction_rate,
+        pay_count, active_pay_cost, active_pay_rate,
+        loan_completion, loan_completion_cost, loan_completion_rate,
+        pre_loan_credit, pre_loan_credit_cost, loan_credit,
+        loan_credit_cost, loan_credit_rate, in_app_uv,
+        in_app_detail_uv, in_app_cart, in_app_pay,
+        in_app_order, attribution_game_pay_7d_count, attribution_game_pay_7d_cost,
+        attribution_active_pay_7d_per_count, game_pay_cost,
+        game_pay_count, phone, form,
+        map_search, button, `view`,
+        download, qq, lottery,
+        vote, message, redirect,
+        shopping, consult, wechat,
+        phone_confirm, phone_connect, consult_effective,
+        coupon, coupon_single_page, redirect_to_shop,
+        poi_collect, poi_address_click, luban_order_cnt,
+        luban_order_stat_amount, luban_order_roi, luban_live_enter_cnt,
+        live_watch_one_minute_count, luban_live_follow_cnt,
+        live_fans_club_join_cnt, luban_live_comment_cnt,
+        luban_live_share_cnt, luban_live_gift_cnt, luban_live_gift_amount,
+        luban_live_slidecart_click_cnt, luban_live_click_product_cnt,
+        luban_live_pay_order_count, luban_live_pay_order_stat_cost,
+        live_component_click_count, live_component_click_cost,
+        live_component_click_rate, wechat_login_count,
+        attribution_wechat_login_30d_count, wechat_login_cost,
+        attribution_wechat_login_30d_cost, wechat_first_pay_count,
+        attribution_wechat_first_pay_30d_count, wechat_first_pay_cost,
+        attribution_wechat_first_pay_30d_cost, wechat_first_pay_rate,
+        attribution_wechat_first_pay_30d_rate, wechat_pay_amount,
+        attribution_wechat_pay_30d_amount, attribution_wechat_pay_30d_roi,
+        phone_effective, total_play, valid_play,
+        valid_play_cost, valid_play_rate, play_25_feed_break,
+        play_50_feed_break, play_75_feed_break, play_100_feed_break,
+        average_play_time_per_play, play_over_rate, wifi_play_rate,
+        wifi_play, play_duration_sum, advanced_creative_phone_click,
+        advanced_creative_counsel_click, advanced_creative_form_click,
+        advanced_creative_coupon_addition, advanced_creative_form_submit,
+        card_show, `share`, `comment`,
+        `like`, follow, home_visited,
+        ies_challenge_click, ies_music_click, location_click,
+        message_action, click_landing_page, click_shopwindow,
+        click_website, click_download, click_call_dy,
+        submit_certification_count, approval_count,
+        first_rental_order_count, first_order_count, commute_first_pay_count,
+        attribution_active_pay_intra_one_day_count,
+        attribution_active_pay_intra_one_day_cost,
+        attribution_active_pay_intra_one_day_rate,
+        attribution_active_pay_intra_one_day_amount,
+        attribution_active_pay_intra_one_day_roi,
+        stat_pay_amount,
+        inventory,
+        inventory_name
+        )
+        values
+        <foreach collection="list" item="item" separator=",">
+            (#{item.advertiserId,jdbcType=BIGINT}, #{item.statDatetime,jdbcType=INTEGER}, #{item.cost,jdbcType=DECIMAL},
+            #{item.show,jdbcType=BIGINT}, #{item.avgShowCost,jdbcType=DECIMAL}, #{item.click,jdbcType=BIGINT},
+            #{item.avgClickCost,jdbcType=DECIMAL}, #{item.ctr,jdbcType=DECIMAL}, #{item.convert,jdbcType=BIGINT},
+            #{item.convertCost,jdbcType=DECIMAL}, #{item.convertRate,jdbcType=DECIMAL},
+            #{item.deepConvert,jdbcType=BIGINT},
+            #{item.deepConvertCost,jdbcType=DECIMAL}, #{item.deepConvertRate,jdbcType=DECIMAL},
+            #{item.attributionConvert,jdbcType=BIGINT},
+            #{item.attributionConvertCost,jdbcType=DECIMAL}, #{item.attributionDeepConvert,jdbcType=BIGINT},
+            #{item.attributionDeepConvertCost,jdbcType=DECIMAL}, #{item.downloadStart,jdbcType=BIGINT},
+            #{item.downloadStartCost,jdbcType=DECIMAL}, #{item.downloadStartRate,jdbcType=DECIMAL},
+            #{item.downloadFinish,jdbcType=BIGINT},
+            #{item.downloadFinishCost,jdbcType=DECIMAL}, #{item.downloadFinishRate,jdbcType=DECIMAL},
+            #{item.clickInstall,jdbcType=BIGINT}, #{item.installFinish,jdbcType=BIGINT},
+            #{item.installFinishCost,jdbcType=DECIMAL},
+            #{item.installFinishRate,jdbcType=DECIMAL}, #{item.active,jdbcType=BIGINT},
+            #{item.activeCost,jdbcType=DECIMAL},
+            #{item.activeRate,jdbcType=DECIMAL}, #{item.register,jdbcType=DECIMAL},
+            #{item.activeRegisterCost,jdbcType=DECIMAL},
+            #{item.activeRegisterRate,jdbcType=REAL}, #{item.nextDayOpen,jdbcType=BIGINT},
+            #{item.nextDayOpenCost,jdbcType=DECIMAL},
+            #{item.nextDayOpenRate,jdbcType=DECIMAL}, #{item.attributionNextDayOpenCnt,jdbcType=BIGINT},
+            #{item.attributionNextDayOpenCost,jdbcType=DECIMAL}, #{item.attributionNextDayOpenRate,jdbcType=DECIMAL},
+            #{item.gameAddiction,jdbcType=BIGINT}, #{item.gameAddictionCost,jdbcType=DECIMAL},
+            #{item.gameAddictionRate,jdbcType=DECIMAL},
+            #{item.payCount,jdbcType=BIGINT}, #{item.activePayCost,jdbcType=DECIMAL},
+            #{item.activePayRate,jdbcType=DECIMAL},
+            #{item.loanCompletion,jdbcType=BIGINT}, #{item.loanCompletionCost,jdbcType=DECIMAL},
+            #{item.loanCompletionRate,jdbcType=DECIMAL},
+            #{item.preLoanCredit,jdbcType=BIGINT}, #{item.preLoanCreditCost,jdbcType=DECIMAL},
+            #{item.loanCredit,jdbcType=BIGINT},
+            #{item.loanCreditCost,jdbcType=DECIMAL}, #{item.loanCreditRate,jdbcType=DECIMAL},
+            #{item.inAppUv,jdbcType=BIGINT},
+            #{item.inAppDetailUv,jdbcType=BIGINT}, #{item.inAppCart,jdbcType=BIGINT}, #{item.inAppPay,jdbcType=BIGINT},
+            #{item.inAppOrder,jdbcType=BIGINT}, #{item.attributionGamePay7dCount,jdbcType=BIGINT},
+            #{item.attributionGamePay7dCost,jdbcType=DECIMAL},
+            #{item.attributionActivePay7dPerCount,jdbcType=BIGINT}, #{item.gamePayCost,jdbcType=DECIMAL},
+            #{item.gamePayCount,jdbcType=BIGINT}, #{item.phone,jdbcType=BIGINT}, #{item.form,jdbcType=BIGINT},
+            #{item.mapSearch,jdbcType=BIGINT}, #{item.button,jdbcType=BIGINT}, #{item.view,jdbcType=BIGINT},
+            #{item.download,jdbcType=BIGINT}, #{item.qq,jdbcType=BIGINT}, #{item.lottery,jdbcType=BIGINT},
+            #{item.vote,jdbcType=BIGINT}, #{item.message,jdbcType=BIGINT}, #{item.redirect,jdbcType=BIGINT},
+            #{item.shopping,jdbcType=BIGINT}, #{item.consult,jdbcType=BIGINT}, #{item.wechat,jdbcType=BIGINT},
+            #{item.phoneConfirm,jdbcType=BIGINT}, #{item.phoneConnect,jdbcType=BIGINT},
+            #{item.consultEffective,jdbcType=BIGINT},
+            #{item.coupon,jdbcType=BIGINT}, #{item.couponSinglePage,jdbcType=BIGINT},
+            #{item.redirectToShop,jdbcType=BIGINT},
+            #{item.poiCollect,jdbcType=BIGINT}, #{item.poiAddressClick,jdbcType=BIGINT},
+            #{item.lubanOrderCnt,jdbcType=BIGINT},
+            #{item.lubanOrderStatAmount,jdbcType=DECIMAL}, #{item.lubanOrderRoi,jdbcType=DECIMAL},
+            #{item.lubanLiveEnterCnt,jdbcType=BIGINT},
+            #{item.liveWatchOneMinuteCount,jdbcType=BIGINT}, #{item.lubanLiveFollowCnt,jdbcType=BIGINT},
+            #{item.liveFansClubJoinCnt,jdbcType=BIGINT}, #{item.lubanLiveCommentCnt,jdbcType=BIGINT},
+            #{item.lubanLiveShareCnt,jdbcType=BIGINT}, #{item.lubanLiveGiftCnt,jdbcType=BIGINT},
+            #{item.lubanLiveGiftAmount,jdbcType=DECIMAL},
+            #{item.lubanLiveSlidecartClickCnt,jdbcType=BIGINT}, #{item.lubanLiveClickProductCnt,jdbcType=BIGINT},
+            #{item.lubanLivePayOrderCount,jdbcType=BIGINT}, #{item.lubanLivePayOrderStatCost,jdbcType=DECIMAL},
+            #{item.liveComponentClickCount,jdbcType=BIGINT}, #{item.liveComponentClickCost,jdbcType=DECIMAL},
+            #{item.liveComponentClickRate,jdbcType=DECIMAL}, #{item.wechatLoginCount,jdbcType=BIGINT},
+            #{item.attributionWechatLogin30dCount,jdbcType=BIGINT}, #{item.wechatLoginCost,jdbcType=DECIMAL},
+            #{item.attributionWechatLogin30dCost,jdbcType=DECIMAL}, #{item.wechatFirstPayCount,jdbcType=BIGINT},
+            #{item.attributionWechatFirstPay30dCount,jdbcType=BIGINT}, #{item.wechatFirstPayCost,jdbcType=DECIMAL},
+            #{item.attributionWechatFirstPay30dCost,jdbcType=DECIMAL}, #{item.wechatFirstPayRate,jdbcType=DECIMAL},
+            #{item.attributionWechatFirstPay30dRate,jdbcType=DECIMAL}, #{item.wechatPayAmount,jdbcType=DECIMAL},
+            #{item.attributionWechatPay30dAmount,jdbcType=DECIMAL}, #{item.attributionWechatPay30dRoi,jdbcType=DECIMAL},
+            #{item.phoneEffective,jdbcType=BIGINT}, #{item.totalPlay,jdbcType=BIGINT},
+            #{item.validPlay,jdbcType=BIGINT},
+            #{item.validPlayCost,jdbcType=DECIMAL}, #{item.validPlayRate,jdbcType=DECIMAL},
+            #{item.play25FeedBreak,jdbcType=BIGINT},
+            #{item.play50FeedBreak,jdbcType=BIGINT}, #{item.play75FeedBreak,jdbcType=BIGINT},
+            #{item.play100FeedBreak,jdbcType=BIGINT},
+            #{item.averagePlayTimePerPlay,jdbcType=DECIMAL}, #{item.playOverRate,jdbcType=DECIMAL},
+            #{item.wifiPlayRate,jdbcType=DECIMAL},
+            #{item.wifiPlay,jdbcType=BIGINT}, #{item.playDurationSum,jdbcType=BIGINT},
+            #{item.advancedCreativePhoneClick,jdbcType=BIGINT},
+            #{item.advancedCreativeCounselClick,jdbcType=BIGINT}, #{item.advancedCreativeFormClick,jdbcType=BIGINT},
+            #{item.advancedCreativeCouponAddition,jdbcType=BIGINT}, #{item.advancedCreativeFormSubmit,jdbcType=BIGINT},
+            #{item.cardShow,jdbcType=BIGINT}, #{item.share,jdbcType=BIGINT}, #{item.comment,jdbcType=BIGINT},
+            #{item.like,jdbcType=BIGINT}, #{item.follow,jdbcType=BIGINT}, #{item.homeVisited,jdbcType=BIGINT},
+            #{item.iesChallengeClick,jdbcType=BIGINT}, #{item.iesMusicClick,jdbcType=BIGINT},
+            #{item.locationClick,jdbcType=BIGINT},
+            #{item.messageAction,jdbcType=BIGINT}, #{item.clickLandingPage,jdbcType=BIGINT},
+            #{item.clickShopwindow,jdbcType=BIGINT},
+            #{item.clickWebsite,jdbcType=BIGINT}, #{item.clickDownload,jdbcType=BIGINT},
+            #{item.clickCallDy,jdbcType=BIGINT},
+            #{item.submitCertificationCount,jdbcType=BIGINT}, #{item.approvalCount,jdbcType=BIGINT},
+            #{item.firstRentalOrderCount,jdbcType=BIGINT}, #{item.firstOrderCount,jdbcType=BIGINT},
+            #{item.commuteFirstPayCount,jdbcType=BIGINT},
+            #{item.attributionActivePayIntraOneDayCount},
+            #{item.attributionActivePayIntraOneDayCost},
+            #{item.attributionActivePayIntraOneDayRate},
+            #{item.attributionActivePayIntraOneDayAmount},
+            #{item.attributionActivePayIntraOneDayRoi},
+            #{item.statPayAmount},
+            #{item.inventory},
+            #{item.inventoryName}
+            )
+        </foreach>
+    </insert>
+
+
     <insert id="insertV3Project" parameterType="cn.com.ctop.job.bytedance.data.entity.BytedanceV3ProjectReportDaily">
         replace into media_api.bytedance_cdp_project_report_daily (
         advertiser_id,

+ 2 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/IByteDanceAdvertiserDataService.java

@@ -16,6 +16,8 @@ public interface IByteDanceAdvertiserDataService {
 
     void getAdvertiserReport(OauthToken oauthToken, String yesterda, String yesterda1, String bytedanceReportTypeDaily);
 
+    void getPositionAdvertiserReport(OauthToken oauthToken, String yesterda, String yesterda1, String bytedanceReportTypeDaily);
+
     void getAgentReport(OauthToken oauthToken, String yesterda, String yesterda1, String bytedanceReportTypeDaily);
 
     void getV3AdvertiserConfig(OauthToken oauthToken);

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

@@ -16,6 +16,7 @@ import cn.com.ctop.job.bytedance.data.entity.BytedanceV3ProjectReportDaily;
 import cn.com.ctop.job.bytedance.data.entity.BytedanceV3ProjectReportHourly;
 import cn.com.ctop.job.bytedance.data.entity.BytedanceV3PromotionProjectReportDaily;
 import cn.com.ctop.job.bytedance.data.entity.OauthToken;
+import cn.com.ctop.job.bytedance.data.enums.InventoryEnum;
 import cn.com.ctop.job.bytedance.data.mapper.BytedanceAdGetMapper;
 import cn.com.ctop.job.bytedance.data.mapper.BytedanceAdReportDailyMapper;
 import cn.com.ctop.job.bytedance.data.mapper.BytedanceAdReportHourlyMapper;
@@ -499,6 +500,142 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     }
 
     /**
+     * -------------------------------------------------------------------------获取分版位广告主
+     */
+    @Override
+    public void getPositionAdvertiserReport(OauthToken token, String startDate, String endDate, String bytedanceReportTypePl) {
+        var conditions = getReportDTO(token, startDate, endDate, bytedanceReportTypePl);
+        getPositionAdvertiserReportByPage(token, conditions, 1);
+    }
+
+    /**
+     * 获取广告主 分版位信息
+     */
+    private void getPositionAdvertiserReportByPage(OauthToken token, ByteDanceAdvertiserReportDTO conditions, Integer page) {
+
+        List<Object> advertiserAccountList = redisUtil.getList("POSITION_ADVERTISER" + conditions.getStartDate(), null);
+
+        log.info("开始获取广告主账户报表,账户id:{}--时间---{},page:{}", token.getAccountId(), conditions.getStartDate(), page);
+        conditions.setPage(page);
+        SerializeConfig config = new SerializeConfig();
+        config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase;
+        JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(conditions, config));
+        JSONObject getObject = getPositionAdvertiserStat(token, jsonObject);
+//        System.out.println("返回结果:" + getObject);
+        if (null == getObject) {
+            XxlJobHelper.log("头条广告主数据获取异常");
+            log.error("头条广告主数据获取信息为空==》accountId:{}", token.getAccountId());
+            return;
+        }
+        Integer code = getObject.getInteger("code");
+        String message = getObject.getString("message");
+        if (null == code || code != 0) {
+            log.error("头条广告主数据获取异常:{}---code--{}", message, code);
+
+            //请求过于频繁
+            if (40100 == code) {
+                log.info("广告主日报请求频繁,code:{},准备重试,accountId:{},错误消息:{}", code, token.getAccountId(), message);
+                //添加重试
+                if (Check.isNull(advertiserAccountList)) {
+                    redisUtil.add("POSITION_ADVERTISER" + conditions.getStartDate(), Arrays.asList(token.getAccountId()), 1, TimeUnit.HOURS);
+                } else {
+                    advertiserAccountList.add(token.getAccountId());
+                    redisUtil.add("POSITION_ADVERTISER" + conditions.getStartDate(), advertiserAccountList, 1, TimeUnit.HOURS);
+                }
+            } else {
+                if (advertiserAccountList.contains(token.getAccountId())) {
+                    advertiserAccountList.remove(token.getAccountId());
+                    redisUtil.add("POSITION_ADVERTISER" + conditions.getStartDate(), advertiserAccountList, 1, TimeUnit.HOURS);
+                }
+            }
+
+            return;
+        }
+        JSONArray dataArray = getObject.getJSONObject("data").getJSONArray("list");
+        if (advertiserAccountList.contains(token.getAccountId())) {
+            advertiserAccountList.remove(token.getAccountId());
+            redisUtil.add("POSITION_ADVERTISER" + conditions.getStartDate(), advertiserAccountList, 1, TimeUnit.HOURS);
+        }
+        if (null == dataArray || dataArray.isEmpty()) {
+
+            return;
+        }
+//        List<BytedanceAdvertiserReportHourly> hourlyList = new ArrayList<>();
+        List<BytedanceAdvertiserReportDaily> dailyList = new ArrayList<>();
+
+        try {
+            for (int i = 0; i < dataArray.size(); i++) {
+                JSONObject data = dataArray.getJSONObject(i);
+//                if (null != conditions.getTimeGranularity()
+//                        && conditions.getTimeGranularity().equals(CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY)) {
+//                    // 时报
+//                    BytedanceAdvertiserReportHourly hourlyReport =
+//                            JSONObject.parseObject(data.toJSONString(), BytedanceAdvertiserReportHourly.class);
+//                    hourlyReport.setAdvertiserId(conditions.getAdvertiserId());
+//                    String hour = hourlyReport.getStatDatetime().substring(11, 13);
+//                    hourlyReport.setStatDatetime(hourlyReport.getStatDatetime().substring(0, 10).replace("-", ""));
+//                    hourlyReport.setHour(Integer.parseInt(hour));
+//                    hourlyList.add(hourlyReport);
+//
+//                } else {
+                // 日报
+                BytedanceAdvertiserReportDaily dailyReport =
+                        JSONObject.parseObject(data.toJSONString(), BytedanceAdvertiserReportDaily.class);
+                dailyReport.setAdvertiserId(conditions.getAdvertiserId());
+                dailyReport.setStatDatetime(dailyReport.getStatDatetime().substring(0, 10).replace("-", ""));
+                dailyReport.setInventoryName(InventoryEnum.getNameByCode(dailyReport.getInventory()));
+                dailyList.add(dailyReport);
+//                }
+            }
+//            if (hourlyList.size() > 0) {
+//                bytedanceAdvertiserReportHourlyMapper.insert(hourlyList);
+//            }
+            if (dailyList.size() > 0) {
+                bytedanceAdvertiserReportDailyMapper.insertPosition(dailyList);
+            }
+        } catch (Exception e) {
+            log.info("获取广告主数据错误:{}", e.toString());
+        }
+        page++;
+        int totalPage =
+                getObject.getJSONObject("data").getJSONObject("page_info").getInteger("total_page");
+        if (page <= totalPage) {
+            getPositionAdvertiserReportByPage(token, conditions, page);
+        } else {
+            JSONObject param = new JSONObject();
+            param.put("advertiser_id", token.getAccountId());
+            param.put("start_date", conditions.getStartDate().replace("-", ""));
+            param.put("end_date", conditions.getEndDate().replace("-", ""));
+            if (null != conditions.getTimeGranularity()
+                    && conditions.getTimeGranularity().equals(CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY)) {
+                param.put("date_type", "hourly");
+            } else {
+                param.put("date_type", "daily");
+            }
+            HttpUtils.httpPostRequest(urlPath, param, null);
+        }
+    }
+
+    /**
+     * 获取广告主报表信息
+     *
+     * @param token
+     * @param conditions
+     * @return
+     */
+    public JSONObject getPositionAdvertiserStat(OauthToken token, JSONObject conditions) {
+        // 请求地址
+        String url = bytedanceApiUrl + BytedanceConstant.BYTEDANCE_V2_REPORT_advertiser_GET;
+        JSONArray groupBy = new JSONArray();
+        groupBy.add("STAT_GROUP_BY_FIELD_ID");
+        groupBy.add("STAT_GROUP_BY_FIELD_STAT_TIME");
+        groupBy.add("STAT_GROUP_BY_INVENTORY");
+        conditions.put("group_by", groupBy);
+//        System.out.println("入参:" + conditions);
+        return HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, conditions);
+    }
+
+    /**
      * -------------------------------------------------------------------------获取代理商
      */
     @Override

+ 34 - 0
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAdvertiseLoadJob.java

@@ -134,6 +134,40 @@ public class BytedanceAdvertiseLoadJob {
     }
 
     /**
+     * 广告主日报 分版位
+     *
+     * @throws Exception
+     */
+    @XxlJob("bytedancePositionAdvertiserDailyReport")
+    public void bytedancePositionAdvertiserDailyReport() throws Exception {
+        String param = XxlJobHelper.getJobParam(); // 执行参数
+        if (Check.isNull(param)) {
+            log.error("入参为空");
+            return;
+        }
+        String token = tokenService.getByAccountId(Long.valueOf(param));
+        if (Check.isNull(token)) {
+            log.error("此账户未获取到相关token,accountId:{}", param);
+            return;
+        }
+        OauthToken oauthToken = new OauthToken();
+        oauthToken.setAccessToken(token);
+        oauthToken.setAccountId(Long.parseLong(param));
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String yesterda = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -1);
+        String yesterda2 = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -2);
+        dailyExecutorService.submit(
+                new Runnable() {
+                    @Override
+                    public void run() {
+//                        advertiserDataService.getPositionAdvertiserReport(oauthToken, yesterda, yesterda, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+//                        advertiserDataService.getPositionAdvertiserReport(oauthToken, yesterda2, yesterda2, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+                        advertiserDataService.getPositionAdvertiserReport(oauthToken, yesterda2, nowDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+                    }
+                });
+    }
+
+    /**
      * 广告主时报
      *
      * @throws Exception