Ver Fonte

批量修改

yumeng há 5 anos atrás
pai
commit
3b8c4989d3

+ 26 - 3
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -20,7 +20,7 @@ import java.util.*;
  */
 public class DateUtils extends PropertyEditorSupport {
 
-    private static Logger logger= LoggerFactory.getLogger(DateUtils.class);
+    private static Logger logger = LoggerFactory.getLogger(DateUtils.class);
 
     /**
      * 以毫秒表示的时间
@@ -1227,7 +1227,7 @@ public class DateUtils extends PropertyEditorSupport {
             e.printStackTrace();
         }
         //得到相差的天数 betweenDate
-        return  (endDate.getTime() - startDate.getTime())/(60*60*24*1000);
+        return (endDate.getTime() - startDate.getTime()) / (60 * 60 * 24 * 1000);
     }
 
     /***
@@ -1313,8 +1313,31 @@ public class DateUtils extends PropertyEditorSupport {
         return calendar.getTime();
     }
 
+
+    public static List<Date> findDates(Date dBegin, Date dEnd) {
+        List<Date> lDate = new ArrayList<Date>();
+        lDate.add(dBegin);
+        Calendar calBegin = Calendar.getInstance();
+        // 使用给定的 Date 设置此 Calendar 的时间
+        calBegin.setTime(dBegin);
+        Calendar calEnd = Calendar.getInstance();
+        // 使用给定的 Date 设置此 Calendar 的时间
+        calEnd.setTime(dEnd);
+        // 测试此日期是否在指定日期之后
+        while (dEnd.after(calBegin.getTime())) {
+            // 根据日历的规则,为给定的日历字段添加或减去指定的时间量
+            calBegin.add(Calendar.DAY_OF_MONTH, 1);
+            lDate.add(calBegin.getTime());
+        }
+        return lDate;
+    }
+
+
     public static void main(String[] args) throws ParseException {
-        System.out.println(calDiffMonth(DateUtils.parseDate("2019-04-01", "yyyy-MM-dd"), new Date()));
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String s = DateUtils.addDay(nowDate, -180);
+        System.err.println(nowDate);
+        System.err.println(s);
     }
 
 }

+ 82 - 21
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -1,17 +1,28 @@
 package org.jeecg;
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
+import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.crawler.modules.oceanengine.service.IOceanEngineService;
+import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
+import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
+import io.swagger.models.auth.In;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -24,10 +35,57 @@ import java.util.concurrent.Executors;
 public class SampleTest {
     @Autowired
     private IOceanEngineService oceanEngineService;
+    @Autowired
+    private IKuaishouInterfaceService interfaceService;
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+    @Autowired
+    private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+
     @Test
-    public void testOceanEngineJob(){
-        String account="3248395570@qq.com";
-        String password = "Ydxq-704127411";
+    public void testOceanEngineJob() {
+
+
+
+
+        try {
+            CtopOauthToken byId = oauthTokenService.getById(303094936123368L);
+            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+            String endDate = DateUtils.addDay(nowDate, -180);
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            Date start = simpleDateFormat.parse(nowDate);
+            Date end = simpleDateFormat.parse(endDate);
+            List<Date> dates = DateUtils.findDates(end,start);
+            for (int i = 0; i < dates.size(); i++) {
+                String formatDate = simpleDateFormat.format(dates.get(i));
+                int code = bytedanceReportService.bytedanceMaterialReport(byId, formatDate, formatDate);
+                //如果成功的话跑视频清洗数据方法,失败会进入重试库,重试成功后再清洗数据
+                if (code == 200 || code == 1) {
+                    byteDanceVideoReportDailyService.videoInfoListByAccountId(formatDate, formatDate, byId.getAccountId());
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+/*
+        List list = new ArrayList();
+        list.add(1);
+        list.add(2);
+        list.add(3);
+        list.add(7);
+        for (int i = 0; i < list.size(); i++) {
+            Integer o = (Integer) list.get(i);
+            List<ConvertVo> convertList = interfaceService.getConvertList(6435317L, "42761e184c6e966236fcfd167375a875", o);
+            System.err.println(convertList);
+        }*/
+
+
+
+        String account = "3248395570@qq.com";
+       /* String password = "Ydxq-704127411";
         oceanEngineService.login(account,password);
         oceanEngineService.douyinHotHandler(1,1);
         oceanEngineService.effectCaseHandler(1);
@@ -36,45 +94,48 @@ public class SampleTest {
         oceanEngineService.hotMaterialHandler(1,1,"西瓜");
         oceanEngineService.hotMaterialHandler(1,3,"火山");
         oceanEngineService.hotMaterialHandler(1,9,"穿山甲");
-        log.info("巨量创意抓取完成");
+        log.info("巨量创意抓取完成");*/
     }
 
     @Autowired
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
+
     @Test
-    public void kuaishouLogin(){
-        Long start =System.currentTimeMillis();
-        List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY,1);
-        if(list!=null&&!list.isEmpty()){
-            for (BindAccountLogin login:list) {
-                if(null==login.getCookie()||"".equals(login.getCookie().trim())){
+    public void kuaishouLogin() {
+        Long start = System.currentTimeMillis();
+        List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY, 1);
+        if (list != null && !list.isEmpty()) {
+            for (BindAccountLogin login : list) {
+                if (null == login.getCookie() || "".equals(login.getCookie().trim())) {
                     kuaishouWebInterfaceService.getkuaishouWebLoginCookie(login);
                 }
             }
         }
         Long end = System.currentTimeMillis();
-        log.info("总用时:{}毫秒",end-start);
+        log.info("总用时:{}毫秒", end - start);
     }
+
     static ExecutorService executorService = null;
     static CountDownLatch countDownLatch = null;
+
     @Test
-    public void kuaishouCommentDelete(){
-        Long start =System.currentTimeMillis();
-        List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY,1);
-        if(list!=null&&!list.isEmpty()){
+    public void kuaishouCommentDelete() {
+        Long start = System.currentTimeMillis();
+        List<BindAccountLogin> list = bindAccountLoginService.getListByParams(CtopAdConstant.PLATFORM_TYPE_KUAISHOU_PY, 1);
+        if (list != null && !list.isEmpty()) {
             executorService = Executors.newFixedThreadPool(10);
             countDownLatch = new CountDownLatch(list.size());
             list.forEach(login -> {
-                executorService.submit(()->{
+                executorService.submit(() -> {
                     try {
-                        if(null!=login.getCookie()&&!"".equals(login.getCookie().trim())){
-                            kuaishouWebInterfaceService.deleteAllComment(new HashMap<>(),login);
+                        if (null != login.getCookie() && !"".equals(login.getCookie().trim())) {
+                            kuaishouWebInterfaceService.deleteAllComment(new HashMap<>(), login);
                         }
-                    }catch (Exception e){
+                    } catch (Exception e) {
 
-                    }finally {
+                    } finally {
                         countDownLatch.countDown();
                     }
                 });
@@ -86,7 +147,7 @@ public class SampleTest {
             e.printStackTrace();
         }
         Long end = System.currentTimeMillis();
-        log.info("总用时:{}毫秒",end-start);
+        log.info("总用时:{}毫秒", end - start);
     }
 //    @Autowired
 //    private PangolinLoginService pangolinLoginService;

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -109,6 +109,11 @@ public class KuaishouInterfaceConstant {
      */
     public static final String APP_SEARCH = "/rest/openapi/v1/tool/app/search";
 
+    /**
+     * 获取可选的应用定向
+     */
+    public static final String CONVERT_LIST = "/rest/openapi/v1/tool/convert/list";
+
 
     /**
      * 获取定向标签

+ 25 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -9,6 +9,7 @@ import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.RandomUtil;
 import cn.com.ctop.kuaishou.modules.batch.entity.*;
+import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.SpendVo;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
@@ -1811,4 +1812,28 @@ public class BatchController {
     }
 
 
+    @GetMapping(value = "/getConvertList")
+    public Result<List<ConvertVo>> getConvertList(Long accountId, Integer type) {
+        Result result = new Result<>();
+        try {
+            if (Check.isNull(accountId) || Check.isNull(type)) {
+                throw new Exception("必填参数不能为空");
+            }
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(oauthToken)) {
+                throw new Exception("未获取到账户信息");
+            }
+
+            List<ConvertVo> convertList = iKuaishouInterfaceService.getConvertList(accountId, oauthToken.getAccessToken(), type);
+            result.setResult(convertList);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+        }
+        return result;
+    }
+
+
 }

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaiShouGroup.java

@@ -159,6 +159,7 @@ public class KuaiShouGroup {
 
 
     private Long convertId; // 转化目标
+    private Integer useAppMarket; // 转化目标
     private String groupCreateTime;
     private String groupUpdateTime;
 

+ 36 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/vo/ConvertVo.java

@@ -0,0 +1,36 @@
+package cn.com.ctop.kuaishou.modules.batch.entity.vo;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.sql.Date;
+
+@Data
+public class ConvertVo implements Serializable {
+    @JsonProperty("app_name")
+    private String appName;
+    @JsonProperty("convert_target")
+    private Integer convertTarget;
+    @JsonProperty("convert_name")
+    private String convertName;
+    @JsonProperty("deep_conversion_count")
+    private Long deepConversionCount;
+    @JsonProperty("deep_conversion_type")
+    private Integer deepConversionType;
+    @JsonProperty("type")
+    private Integer type;
+    @JsonProperty("app_id")
+    private Long appId;
+    @JsonProperty("convert_id")
+    private Long convertId;
+    @JsonProperty("convert_count")
+    private Long convertCount;
+    @JsonProperty("click_url")
+    private String clickUrl;
+    @JsonProperty("create_time")
+    private String createTime;
+    @JsonProperty("update_time")
+    private String updateTime;
+
+}

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml

@@ -31,6 +31,7 @@
         app_id,
         app_icon_url,
         convert_id,
+        use_app_market,
         group_create_time,
         group_update_time,
         create_time,
@@ -66,6 +67,7 @@
             #{getGroup.appId},
             #{getGroup.appIconUrl},
             #{getGroup.convertId},
+            #{getGroup.useAppMarket},
             #{getGroup.groupCreateTime},
             #{getGroup.groupUpdateTime},
             #{getGroup.createTime},

+ 14 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService.java

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.batch.service;
 
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
 import cn.com.ctop.kuaishou.modules.report.entity.*;
@@ -10,6 +11,7 @@ import com.alibaba.fastjson.JSONObject;
 
 import java.text.ParseException;
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -480,6 +482,18 @@ public interface IKuaishouInterfaceService {
      */
 
     void getAsyncCreativeList(Long accountId, String accessToken, Long campaignId);
+
+
+    /**
+     * 获取转化目标
+     *
+     * @param accountId
+     * @param accessToken
+     * @param type
+     * @return
+     */
+    List<ConvertVo> getConvertList(Long accountId, String accessToken, Integer type);
+
 }
 
 

+ 32 - 20
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java

@@ -58,6 +58,18 @@ public class BatchServiceImpl implements IBatchService {
     private KuaiShouGroupMapper groupMapper;
     @Autowired
     private KuaiShouCreativeMapper creativeMapper;
+    @Autowired
+    private KuaiShouGroupMapper kuaiShouGroupMapper;
+    @Autowired
+    private KuaiShouGroupTargetMapper targetMapper;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
+    @Autowired
+    private IKuaiShouImageGetService imageGetService;
+    @Autowired
+    private RestTemplate rest;
 
 
     /**
@@ -133,8 +145,7 @@ public class BatchServiceImpl implements IBatchService {
      * @param unitName
      * @return
      */
-    @Autowired
-    private KuaiShouGroupMapper kuaiShouGroupMapper;
+
 
     @Override
     public Boolean checkUnitName(Long campaignId, String unitName) {
@@ -157,11 +168,6 @@ public class BatchServiceImpl implements IBatchService {
      * @param requestJson
      * @return
      */
-    @Autowired
-    private ICtopOauthTokenService oauthTokenService;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-
     @Override
     public JSONObject createUnit(JSONObject requestJson) throws Exception {
         Long accountId = requestJson.getLong("accountId");
@@ -197,6 +203,16 @@ public class BatchServiceImpl implements IBatchService {
             unitJson.put("unit_type", requestJson.getInteger("unitType"));
         }
 
+        // 转化目标id
+        if (!Check.isNull(requestJson.getInteger("convertId"))) {
+            unitJson.put("convert_id", requestJson.getInteger("convertId"));
+        }
+
+        // 优先从系统应用商店下载
+        if (!Check.isNull(requestJson.getInteger("useAppMarket"))) {
+            unitJson.put("use_app_market", requestJson.getInteger("useAppMarket"));
+        }
+
         //投放开始时间
         if (!Check.isNull(requestJson.getString("beginTime"))) {
             String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
@@ -447,9 +463,6 @@ public class BatchServiceImpl implements IBatchService {
      * @throws Exception
      */
 
-    @Autowired
-    private KuaiShouGroupTargetMapper targetMapper;
-
 
     @Override
     public JSONObject copyUnit(KuaiShouGroup group, Long copyToCampaignId) {
@@ -489,6 +502,15 @@ public class BatchServiceImpl implements IBatchService {
                     }
 
                 }
+
+                // 优先从系统应用商店下载
+                if (!Check.isNull(group.getUseAppMarket())) {
+                    unitJson.put("use_app_market", group.getUseAppMarket());
+                }
+                // 转化目标id
+                if (!Check.isNull(group.getConvertId())) {
+                    unitJson.put("convert_id", group.getConvertId());
+                }
                 // 投放结束时间
                 if (!Check.isNull(group.getEndTime())) {
                     unitJson.put("end_time", group.getEndTime());
@@ -807,10 +829,6 @@ public class BatchServiceImpl implements IBatchService {
      * @param requestJson
      * @return
      */
-    @Autowired
-    private IKuaiShouImageGetService imageGetService;
-
-
     @Override
     public JSONObject createCreative(JSONObject requestJson) throws Exception {
         if (Check.isNull(requestJson)) {
@@ -1167,9 +1185,6 @@ public class BatchServiceImpl implements IBatchService {
      * @param requestJson
      * @return
      */
-    @Autowired
-    private IKuaiShouImageGetService iKuaiShouImageGetService;
-
     @Override
     public JSONObject updateCreative(JSONObject requestJson) throws Exception {
         if (Check.isNull(requestJson)) {
@@ -1249,9 +1264,6 @@ public class BatchServiceImpl implements IBatchService {
     }
 
 
-    @Autowired
-    private RestTemplate rest;
-
     private String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap) throws ParseException {
         try {
             MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();

+ 49 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -8,6 +8,7 @@ import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.*;
 import cn.com.ctop.kuaishou.modules.batch.entity.*;
+import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
 import cn.com.ctop.kuaishou.modules.batch.mapper.*;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
@@ -16,7 +17,6 @@ import cn.com.ctop.kuaishou.modules.report.entity.*;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
 import cn.com.ctop.kuaishou.modules.report.service.*;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -1178,7 +1178,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         }
         JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
         if (Check.isNull(details)) {
-
             return;
         }
         addGroup(token.getAccountId(), details);
@@ -1281,6 +1280,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     group.setGroupCreateTime(detail.getString("create_time"));
                     group.setGroupUpdateTime(detail.getString("update_time"));
                     group.setConvertId(detail.getLong("convert_id"));
+                    group.setUseAppMarket(detail.getInteger("use_app_market"));
                     group.setCreateTime(new Date());
                     group.setUpdateTime(new Date());
                     groups.add(group);
@@ -3163,5 +3163,52 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     }
 
+    /**
+     * 获取转化目标
+     *
+     * @param accountId
+     * @param accessToken
+     * @param type
+     * @return
+     */
+    @Override
+    public List<ConvertVo> getConvertList(Long accountId, String accessToken, Integer type) {
+        List<ConvertVo> convertVoList = new ArrayList<>();
+        try {
+
+            log.info("获取转化目标:accountId:{}", accountId);
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CONVERT_LIST;
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Access-Token", accessToken);
+            headers.put("Content-Type", "application/json");
+            JSONObject requestJson = new JSONObject();
+            requestJson.put("advertiser_id", accountId);
+            requestJson.put("type", type);
+
+            String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            Integer code = resultJson.getInteger("code");
+            if (code == 0) {
+                JSONObject data = resultJson.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    JSONArray details = data.getJSONArray("details");
+                    if (!Check.isNull(details)) {
+                        for (int i = 0; i < details.size(); i++) {
+                            ConvertVo convertVo = JsonUtil.jsonToObj(details.getJSONObject(i), ConvertVo.class);
+                            convertVoList.add(convertVo);
+                        }
+
+                    }
+
+                }
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return convertVoList;
+    }
+
 
 }

+ 26 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

@@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 
+import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -247,6 +248,11 @@ public class ReportServiceImpl implements IReportService {
 
     @Autowired
     private BytedanceReportMaterialDailyMapper materialDailyMapper;
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+    @Autowired
+    private IByteDanceVideoReportDailyService byteDanceVideoReportDailyService;
+
     @Override
     public void loadBytedanceHistoryData(CtopOauthToken token) {
         for (int i = 1; i < 180; i++) {
@@ -255,6 +261,26 @@ public class ReportServiceImpl implements IReportService {
             this.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
             this.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
         }
+
+        try {
+            log.info("获取历史素材报表:accountId:{}", token.getAccountId());
+            String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+            String endDate = DateUtils.addDay(nowDate, -180);
+            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+            Date end = simpleDateFormat.parse(nowDate);
+            Date start = simpleDateFormat.parse(endDate);
+            List<Date> dates = DateUtils.findDates(start, end);
+            for (int i = 0; i < dates.size(); i++) {
+                String formatDate = simpleDateFormat.format(dates.get(i));
+                int code = bytedanceReportService.bytedanceMaterialReport(token, formatDate, formatDate);
+                //如果成功的话跑视频清洗数据方法,失败会进入重试库,重试成功后再清洗数据
+                if (code == 200 || code == 1) {
+                    byteDanceVideoReportDailyService.videoInfoListByAccountId(formatDate, formatDate, token.getAccountId());
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
     }
 
     private ByteDanceAdvertiserReportDTO getReportDTO(CtopOauthToken token, Date startDate, Date endDate, String bytedanceReportTypePl) {